Lab 3: Create measures
In this lab, you will learn how to:
- Define business measures to track business performance and health
- Define customer measures to gain insights about individual customers
Exercise 1: Define measures and attributes
Task 1: Average value of in-store purchases
In this first task, we will create a measure to define the average value of all in-store purchases made at Contoso Coffee.
-
Expand Insights and select Measures from the left navigation menu.
-
Select + New from the toolbar, then select Build your own.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Average Store Purchase Value ($) and select Done.
-
Toggle Measure type from Customer to Business.
-
Next to Calculation 1, select Edit name.
-
Set the Name to Average Store Purchase Value ($).
-
Verify the Output attribute name is set to AverageStorePurchaseValue.
-
Select Done.
-
Under the Average Store Purchase Value ($) calculation, choose Average from the Select function drop-down.
-
Select + Add attribute, expand Purchases : PoS, and select TotalPrice.
-
Select Add.
-
Select the Run button to complete your measure.
In this next task, we will create a measure to define the Average value of all web purchases made at Contoso Coffee.
-
Select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Average Web Purchase Value ($) and select Done.
-
Toggle Measure type from Customer to Business.
-
Next to Calculation 1, select Edit name.
-
Set the Name to Average Web Purchase Value ($).
-
Verify the Output attribute name is set to AverageWebPurchaseValue.
-
Select Done.
-
Under the Average Web Purchase Value ($) calculation, choose Average from the Select function drop-down.
-
Select + Add attribute, expand Purchases : eCommerce, and select TotalPrice.
-
Select Add.
-
Select the Run button to complete your measure.
Task 2: Define customer measures
We will need two customer measures that can be used to calculate a customer attribute. We will create one measure to determine the customers’ total spend on Online Purchases and one measure to determine their total spend on In-Store purchases. Once we create these, we can then create a customer attribute to add those two together.
In this task, we will create a measure to define the total of all purchases made in-store.
-
Select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Total In Store Spend and select Done.
-
Under the Total In Store Spend calculation, choose Sum from the Select function drop-down.
-
Select + Add attribute, expand Purchases : PoS, select TotalPrice, and select Add.
-
To set up the measure calculation, select Dimensions (1).
-
Select Edit Dimensions.
-
Expand Purchases : PoS, select LoyaltyId, and select Done.
-
Select Apply.
-
Select the Run button to complete your measure. If you encounter an error and need to choose the Relationship path, select PoS_Purchases > Customer and select the Run button to complete.
Next, we will create a measure to define the total of all purchases made online.
-
Select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Total Online Spend, select Done.
-
Under the Total Online Spend calculation, choose Sum from the Select function drop-down.
-
Select + Add attribute, expand Purchases : eCommerce, select TotalPrice and click Add.
-
Under Set up your measure calculations, select Dimensions (1).
-
Select Edit dimensions.
-
Expand Purchases : eCommerce, select ContactId, and select Done.
-
Select Apply.
-
Select the Run button to complete your measure.
Task 3: Define customer attributes
First, we will define Total Loyalty Points earned by each customer.
-
If necessary, select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Total Club Points and select Done.
-
Under the Total Club Points calculation, choose Sum from the Function Type drop-down.
-
Select + Add attribute, expand Purchases : PoS, select RewardPointsAdded and select Add.
-
Select the Run button to complete your measure.
Next, we will define the total value of all purchases made for each customer.
-
Select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the Name to Lifetime Spend ($) and select Done.
-
Under the Lifetime Spend ($) calculation, choose Sum from the Function type drop-down.
-
Select + Add attribute.
-
Select the Measures tab, expand TotalInStoreSpend : CustomerInsights, select Calculation 1, and select Add.
-
Select the + (Plus sign) to add a plus sign after the attribute you just added. The plus sign should appear in the calculation formula.
-
Select + Add attribute.
-
Select the Measures tab, expand TotalOnlineSpend : CustomerInsights, select Calculation 1, and select Add.
-
Select the Run button to complete your measure.
Next, we will define the average value of all store purchases made for each customer.
-
Select Insights > Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the name to Average Store Purchase ($) and select Done.
-
Under the Average Store Purchase ($) calculation, choose Average from the Select function drop-down.
-
Select + Add attribute, expand Purchases : PoS, select Total Price, and select Add.
-
Select the Run button to complete the measure.
Task 4: Average value of web purchases
Next, we will define the average value of all web purchases made for each customer.
-
If necessary, select Measures from the left navigation menu.
-
Select + New > Build your own from the toolbar.
-
Next to the Untitled measure header text, select Edit details.
-
Set the name to Average Web Purchase ($) and select Done.
-
Under the Average Web Purchase ($) calculation, choose Average from the Select function drop-down.
-
Select + Add attribute, expand Purchases : eCommerce, select Total Price and select Add.
-
Select the Run button to complete your measure.