Get startedGet started for free

Enrich a data model by adding a metric

1. Enrich a data model by adding a metric

In this video, we'll demonstrate how to add a metric to a data model.

2. Scenario setup

Several analysts across Oakmark are analyzing the total amount deposited in customer savings accounts, but each analyst is getting different results.

3. Scenario setup

Leadership believes that the raw data is correct, and suspects that the mismatched results stem from each analyst performing the calculation differently.

4. Scenario setup

Oakmark's standard method for calculating savings totals is to take the Sum of the Balance column for accounts marked as "Savings" in the Account type column.

5. Scenario setup

Let's codify this business logic in a metric, so that each analyst starts from the same number every time.

6. Demo steps

First, add the **accounts** table. In the editor panel, select Add metric to open the **Add a metric** modal.

7. Demo steps

Now, let's define the metric. Add a name and description so users can identify the metric easily. For the formula, enter the calculation for the metric. We need to calculate the balance for Savings accounts only, so we can use the SumIf function on the Balance column to only add rows with an Account type of "Savings."

8. Demo steps

Then, press save. The metric appears in the editor panel under **Metrics**.

9. Demo steps

It also appears in the Properties tab under **Metrics**. Notice that here, the metric is greyed out and not able to be used. This is because this metric is only available for use downstream of the element it is defined in.

10. Demo steps

Now, press publish and select "Go to published version". Here, we can see the metric on the data model overview page. By default, the metric is listed as a Highlighted metric, though we can change that later if we want.

11. Demo steps

If we click on the metric to expand it, we can review its description and name.

12. Demo steps

Select **Explore in workbook** to see how the metric appears outside of the data model.

13. Demo steps

Exploring a metric opens a workbook, with a KPI chart that references the metric.

14. Demo steps

We can see that the KPI chart uses the base table from our data model as the data source, and that our Metric has automatically been added to the **Value** field.

15. Demo steps

Now, we can use this as a basis for exploration. If we change this chart to a bar chart, for example, and add the States column to the X-axis, we can see total money stored in savings by state, using the standard Oakmark definition of savings.

16. Demo steps

Or, we can convert it to a line chart and use the Credit score column as our X-axis to see how credit score relates to savings balance.

17. Let's practice!

Now, it's your turn! In the next exercises, you'll add metrics to a data model, and use them in a workbook to perform analysis.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.