Metrics

  • Updated

A Metric is a computed property that can be utilized in a variety of different analyses. Like Derived Columns, this property is also defined within Analytics. The definition of a Metric may include arbitrary computations, such as joins with other datasets, filters, aggregations, etc.

For example, imagine that you have a Transactions dataset which has among other columns, a column named Sale Price which is a numeric value containing the sale value of a transaction. One may define a metric named Revenue, that aggregates the Sale Price column. Depending on the context where it's used, the metric will perform this aggregation.

A Metric can be used anywhere in the app that the Catalog is accessible.

The configuration for a Metric is saved within Analytics and accessible through the Catalog. It can be utilized like any other column through the catalog.

A metric has the following configuration:

  • Name - The name of a metric must be unique across all columns (including metrics and cohorts) for that dataset.
  • Default Aggregation - By default, this aggregation type will be used in contexts where the metric is used as a measure, e.g.count, sum, etc.

Metrics are not tied to a specific dataset, which is one of the main differences between them and derived columns.

There are 5 different types of Metrics that you can create:

Create a New Metric

  1. In the Left Navigation Panel, select on + and then select Metric.
  2. You can either select from the templates - Simple Aggregation, And/Or, Filter shown in the options or create Custom metrics. This choice only helps with starting quickly, you can always change it later without losing any work.
  3. In the resulting Block Editor view, you will see the Block Editor interface.
  4. Using blocks, define the computation for your metric.
  5. As you work on the definition of the Metric, click on Run Metric to sample the computed values. The resulting table will show values of the metric, potentially accompanied by any dimensions.
  6. Click on the top-left to specify a name and description for the Metric.
  7. Click Save to persist the Metric's definition in the Catalog.
  8. The new Metric can now be used as a Catalog entity anywhere that the Catalog is accesible, e.g. inside exploration templates, block editor, etc.
Create metric

Types of Metrics

Listed below are the different types of Metrics that are available in Analytics.

We use a demo app called Flix to create these sample metrics. You can also see these examples inside the app.

Simple Aggregation

This template allows you to calculate a simple aggregated metric. Follow the steps below to create a metric of this type.

  1. Navigate to + on the left navigation panel, click Metric and choose Simple Aggregation.
  2. As an example, let us create a metric for Total Subscription Revenue. This metric is the total revenue generated by Flix monthly subscriptions.
  3. In the Aggregate block, let us choose the aggregator as sum and set price from the Subscriptions dataset as the value.
  4. Click Run Metric and your result will be displayed. You can change the chart type from the drop-down at the top-right of the visualization window.
  5. Give your metric a name and add a description (optional).
  6. Click Save to save all your changes.
Simple aggregate

Filter

This metric template allows you to apply filter to any kind of input.

  1. Navigate to + on the left navigation panel, click Metric and choose Filter.
  2. As an example, let us consider creating a metric for users whose Total Time Viewed on the platform is greater than 100000 minutes.
  3. In the Filter block, let us choose the value as All Users.
  4. Then, set the filter - since we already have a metric that calculates Total Time Viewed, we choose that and set the value as > 100000
  5. Click Run Metric and your result will be displayed. You can change the chart type from the drop-down at the top-right of the visualization window.
  6. Give your metric a name and add a description (optional).
  7. Click Save to save all your changes.
Filter

And/Or

This template in Metrics allows you to use nested and/or statements to produce a true/false value. Let us create a metric for purchases made and total time viewed in the last 30 days

  1. Navigate to + on the left navigation panel, click Metric and choose And/Or.
  2. In the And/Or block, let us choose the Purchased in Last 30 Days cohort and set the value to True.
  3. Click + and add another condition - choose the TTV Last 30 Days derived column and set the value to 500
  4. Click Run Metric and your result will be displayed. You can change the chart type from the drop-down at the top-right of the visualization window.
  5. Give your metric a name and add a description (optional).
  6. Click Save to save all your changes.
And/Or

Custom

This template allows you to calculate a cohort of values by composing any number of blocks. Let us create a metric of this type.

  1. Navigate to + on the left navigation panel, click Metric and choose Custom.
  2. As an example, let us create a metric to determine Average total time viewed. This is the average total time viewed across all users. For a given user, total time viewed is the total time that the user spent viewing content on the platform.
  3. Let us begin with an Formula block and write the logic to calculate the Incremental Duration. The logic is as follows:
    Data.Content.duration * Data."Product Events"."Incremental Completion Fraction"
  4. Next, add an Aggregate block to calculate the sum of incremental duration. Let's call this Aggregate 1. Set the aggregator as sum and choose the previously configured Incremental Duration block as the value. Let us filter the results by event-type, so add a filter: event_type is Play Content. We also group the result by Users.
  5. Then, add another Aggregate block, let's call this Aggregate 2. Here, set the aggregator as avg and choose Aggregate 1 as the value.
  6. Click Run Metric and your result will be displayed. You can change the chart type from the drop-down at the top-right of the visualization window.
  7. Give your metric a name and add a description (optional).
  8. Click Save to save all your changes.
Custom

Formula

This template allows you to write a custom formula using algebraic operations, functions like round, substring, etc. Here's how you can create one.

  1. Navigate to + on the left navigation panel, click Metric and choose Formula.
  2. As an example, let us create a metric for Total Revenue. This is the total revenue across PPV purchases, advertisements and monthly subscriptions.
  3. In the Metric block, let us enter our custom NetScript logic to calculate total revenue. The logic is as follows : 
    Metrics."Total Ad Revenue" + Metrics."Total Subscription Revenue" + Metrics."Total Purchase Revenue"
  4. Click Run Metric and your result will be displayed. You can change the chart type from the drop-down at the top-right of the visualization window.
  5. Give your metric a name and add a description (optional).
  6. Click Save to save all your changes.
Formula

View Metrics

Metrics Page

  1. In the Left Navigation Panel, select the icon which says Metrics.
  2. The resulting page lists a set of templates at the top for defining new metrics. There is a search bar to find individual metrics by name. Below that is a paginated listing of all Metrics in the system.
  3. Each Metric entry in the listing contains the following information:
    1. Name
    2. Description (if any)
    3. Type (this refers to the template used when defining the Metric).
View metric