Create and Save a Metric
While you can work with facts and metrics directly in Analytical Designer, you can also create new ones and customize the existing ones to provide more business context for your users.
Your GoodData Demo Workspace comes with a number of metrics, for example Order Amount which is defined as Quantity*Price
.
The following animation will show you how we created the Order Amount metric using the Advanced Metric Editor.
Create Your First Metric
In the following tutorial, you will create a simple # of Canceled Orders metric.
Steps:
Go to Manage and in the Data tab, select Metrics.
Click + Create Metric. The Metric Editor page opens.
Click Custom metric.
The Create Metric window opens.
Enter the name of the metric. For the purpose of this tutorial, enter # of Canceled Orders.
Now you will create the formula for your first metric.
SELECT # of Orders WHERE Order Status = Canceled
Select the model elements (facts, attributes, etc.) using the right-hand pane rather than typing them into the editor text box. For example, to select the value “Canceled” for Order Status, go to Attribute Values > Order Status > Canceled.To construct the formula:
- Type SELECT in the main text box.
- On the Elements browser on the right, click Metrics. The list of metrics appears.
- Double-click # of Orders. The element is added to the formula.
- Type WHERE.
- Click Attributes. In the list of attributes, double-click Order Status. The element is added to the formula.
- Type =
- Click Attribute Values, then click Order Status. The list of values for the Order Status attribute appears.
- Double click Canceled. The element is added to the formula.
Click the Add button in the bottom right corner. A page with the metric’s details opens. The following animation demonstrates the procedure:
Click Data to return to your Data overview page. Your new metric appears in the Metrics list.
Create Additional Metrics
Click the + Create Metric button again to create the following metrics by repeating the procedure above.
Metric | Formula |
---|---|
# of Orders | SELECT COUNT( Order ID ) |
Average Order Amount | SELECT Order Amount / # of Orders |
Revenue |
|
You can click the Analyze tab to see how your new metrics work in Analytical Designer.