Custom Measures - Introduction

josephmckeownjosephmckeown Moderator, Lightspeed Staff Posts: 72 moderator
edited December 2019 in Reporting & Analytics

Custom Measures are a tool that we can use to give more numeric details to data on Analytics reports.

They can be used for simple counts of data. For example:

  • The number of Multi-Store locations in a grouping
  • The number of customer names associated with a particular email address.
  • The number of Discounts used in a particular time frame.


They can also be used for more complex counting, for example:

  • The number of sales where the sale line employee is not the sale employee
  • The number of instances where an ID field (like Vendor ID, UPC, or Manufacturer SKU) are empty
  • The number of times when a certain tag occurs in products


Finding Custom Measures

Custom Measures live in the Custom Fields, to the left of your Analytics Data:

To create a new Custom Measure, follow Custom Fields> New> Custom Measure


A Simple Custom Measure

The most basic usage of Custom Measures is "Count Distinct", where we assign the number 1 to each instance of a Dimension being measured.

Say we want to count the number of stores that processed Sales each day. When we open the Custom Measure editor, we'll get this panel:

If we click on the Field to measure: "Choose Field..." menu, we'll see a list of available Dimensions that we can scroll through...

...or we could start typing the name of the field we're looking for and we'll get get options that meet our criteria...

Once we've selected our Dimension to measure, we can either select "Count Distinct", which assigns a "1" to each unique Dimension...


...or we could select "List", which presents the results as a list of all results:

Like Custom Dimensions, we need to run our report a second time to pull the results onto our table:


...and like Custom Dimensions, we need to assign a meaningful title to the Custom Measure:

A More Complicated Custom Measure

Let's say though, that want to find the number of times where the Sale Line employee was not the same person as the Sale employee, we could use a Custom Measure to count this.

From our Custom Measure editor, we would first select the "Custom Filter" checkbox:

Which brings up the code editor.

The editor uses Look ML, the same language used in Calculations and Custom Dimensions.

So let's build a simple logical calculation now:

In this instance, I'm searching for instances where I ask whether the Employee equals the Sale Line Employee, and I count the numbers where the answer is "No".

When I save the results...

My results seem really low.

Why?

Because in this model, I'm asking it to count Employees that were not the same as Sale Line Employees.

What I should ask to do is count Sales where the Employee was not the same as the Sale Line Employee.

So I'll go back to my editor by selecting the gear icon and "edit"

My code will stay the same, but instead, I'm changing the "Field to Measure" from Employee...


...to Sale ID

Now, when I save and run...

That looks better!



Calculations Home

Joseph McKeown
Lightspeed Analytics and reporting consultant
Lightspeed HQ

1 comment

  • cslcorpcslcorp Member Posts: 1

    Hey Joseph-How can you get a total for returns/refunds. I was able to create a function that will list the amount returned, but was not able to get a total I'm guessing because of the "Table calculations being run on the total row, not as an aggregation of the data rows"


Sign In or Register to comment.