Creating Metrics

How to define metrics in the report engine

Ed Campbell avatar
Written by Ed Campbell
Updated over a week ago
  • To create a new metric right-click on any folder and select Create Metric

  • Name your metric and click OK

Metric Definition

This is where you can define how your metric is calculated using basic mySQL queries. To get started click on the + button to expand the section.

The formula box is where you can write standard mySQL queries to calculate your metrics. Your calculation will most likely refer to specific fields in your datasource which can either be dragged into the box above or referenced by 'Field ID'. Similarly, if you are creating a metric consisting of other metrics (composite metric) then you can either drag an existing metric into the dotted box or refer to it by 'Metric ID'.

For more information on metric types please click here.

Let's say I want to create a new metric, Impressions from the datasource SA360. 

  • Under datasource, choose the correct table and column:

  • Click and drag the column into the dotted box on the right.

  • Enclose it with SUM('column') to sum up al values

Once you have dropped this metric the Formula box will display the Field ID in curly brackets { } and the box will dynamically fill in the correct name.

Alternatively, if you cannot drag and drop, you can type the Field ID in the formula box surrounded by curly brackets { } and the box will also dynamically pick up the correct name.
You can quickly find your field ID by hovering over the field name in the list (this will appear in a link at the bottom of the screen).

The box will only fill in the field name once you have closed the curly brackets:

Please note: If you have forgotten to close brackets the Report Engine will return an error message (syntax error or access violation).

Adding more than one definition

You can add more than one metric definition into the report engine for your metric. This is often done when you have two datasources with the same data but at a more granular level. If you have more than one metric definition, the order of the metric definitions is important. 

The report engine will automatically take the first metric definition unless the report contains an incompatible dimension so that it cannot use the first definition. In this instance the second definition specified will be used.

For more information on alternative metric definitions please follow the link. 

How do I know which datasources are compatible with my metric?

Once you have created your metric a list of compatible datasource Ids and names will appear under your metric definition. This will help help you identify which datasources are compatible with your metric.


Reports using this metric

The report engine will display all reports that are currently using the metric you have created. This is a list of dashboards links where you can navigate to the dashboard where your metric is being used.

ID

This is your metric ID which is unique to your metric. This can be used in metric definitions if you do not want to drag and drop from a list. 

Changelog

This is where you can see who edited your metric last and at what time. This allows you to audit who has been editing your metrics. 

Did this answer your question?