## What are ‘Calculated Metrics’ and what can I use them for?

With Calculated Metrics you can convert and combine raw metrics into new more complex metrics. Typically a Customer Success team would be required to send database query requests to the IT department which takes up both our time and theirs. There may even be multiple data requests, e.g. average number of downloads per week, average number of downloads per month and total downloads over the past year. With Calculated Metrics you can simply request downloads per day from IT and do all of the calculations yourself with the use of the average, min, max, sum and last saving yourself time whilst providing the freedom and flexibility you require.

## How to Create a Calculated Metric

We appreciate the Calculated Metrics section can seem confusing at first so let’s run through a few examples. First of all we need to go to the Calculated Metrics page within Planhat, to access the Calculated Metrics page, go to the Customer Intelligence module, select ‘Trends & Analytics’ and then ‘Calculated Metrics’. On the right hand side we’re going to select the ellipsis icon and from the sub menu and select ‘Create new metric’.

It’s important to remember when you’re creating a Calculated Metric and specifying which Metric/Activity to use, you must use the exact spelling, including capitals.

For this example, we’re going to be calculating the number of downloads over the past 90 days (you might not be tracking the number downloads, so you would replace this metric with something else that you are tracking). Start off by naming your metric, we’ve named ours “Number of downloads”. Then you need to enter your formula in the grey box below. For this example, we would use the formula below in order to calculate the number of downloads over the past 90 days.

``["SUM", {"type": "metricOverTime", "days": 90, "op": "SUM", "prop": "activities.Downloaded a report"}, {"type": "metricOverTime", "days": 90, "op": "SUM", "prop": "activities.downloaded content"}]``

The image below is showing how it would look in Planhat. We have named our metric and we have the equation directly below. Now we hit "save" and the metric will be created. Let’s break the equation down and explain what the equation is doing. The equation below is telling the system that we want to see the past 90 days of data.

``{"type": "metricOverTime", "days": 90,``

The next part of the equation is telling the system to SUM the metric “activities.Downloaded a report”.

``"op": "SUM", "prop": "activities.Downloaded a report"},``

The whole equation is telling the system to SUM the metrics “activities.Downloaded a report” and “activities.downloaded content” over the past 90 days. We’re taking two separate metrics and combining them to create a new metric.

``["SUM", {"type": "metricOverTime", "days": 90, "op": "SUM", "prop": "activities.Downloaded a report"}, {"type": "metricOverTime", "days": 90, "op": "SUM", "prop": "activities.downloaded content"}]``

When creating a calculated metric you can incorporate a vast range of metrics. Any metrics that you have available in the follow sections can be used: System Metrics, User Activities, Company Metrics, Conversations, Tasks and Revenue. We've provided some examples below to help illustrate how to incorporate these metrics into your calculated metrics.

### System Metrics

We want to view the max CSM score over a 90 day period. Look at the equation used to achieve this in the image below. As you can see, we’ve used the ‘system.csm_score’ System Metric in the Calculated Metric. All of the System Metrics listed below can be utilised in the same way:

• system.users_total (Number of users)
• system.activity_count (Activity count)
• system.health (Health score)
• system.csm_score (CSM score)
• system.users_active_last1 (Users active last day)
• system.users_active_last7 (Users active last seven days)
• system.users_active_last30 (Users active last thirty days)
• system.users_active_last90 (Users active last ninety days)

### User Activities

We would like to know the amount of reports that have been downloaded over the last 100 days. The equation in the image below is used to achieve this and as you may have noticed, the first part of the naming convention now begins with ‘activities’ not ‘system’.  Because we're using a metric from the "User Activities" section. ### Company Metrics

We would like to see the forecast over the last 32 days. We can do this by using the “Company Metrics” in a Calculated Metric. When we’re writing an equation we use ‘metrics’ not ‘Company Metrics’ as you can see in the image below. ### Conversations

We would like to see the total live chats that have occurred over the past 90 days. We can do this by using “Conversations” in a Calculated Metric. The equation to do this is in the image below. We would like to see the total amount of tasks in the past. We can do this by using “Tasks” in a Calculated Metric. The equation to do this is in the image below. ### Revenue

We would like to see the average contract length over the past 100 days. We can do this by using “Revenue” in a Calculated Metric. The equation to do this is in the image below. Once you've had a go for yourself and you understand the basics you might want to create some more advanced calculated metrics, if that's the case, we recommend reading: Calculated Metrics Use Cases.

We hope this has been informative and easy to follow. We understand for some of our user's this is quite technical so if you need any assistance setting up your calculated metrics, please contact support who will be more than happy to assist you 👍.