Follow the Metric Recipe below to create the metric:
1. Create the dataset
Navigate to the Datasets page and create a new Dataset for the selected source.
a) Create the Dataset
Data Source
Views
Columns
Shopify
Customers
CreatedAt
NumberOfOrders
b) Create a new calculated column in the dataset
Edit the Dataset.
Click the "+" column on the right side to add a new calculated metric.
Into the function field, type in $NumberOfOrders to copy the whole column.
Click Run to update the table.
Rename the new calculated column into "New or Returning".
Apply a formula to this column:
CASE WHEN $NumberOfOrders > 1 THEN 1 ELSE 0 END
Save the Dataset.
2. Create the Custom Metric for "Total Customers"
Navigate to Metric Builder and create a new Custom Metric by selecting the Dataset you previously created.
Fill out the Measure, Date, Dimension, Aggregation, and Filter fields as shown in the diagram below.
Name your metric and save it.
Measure
NumberOfOrders
Date
CreatedAt
Dimension
/
Aggregation
COUNT
Filters
/
3. Create the Custom Metric for "Returning Customers"
Navigate to Metric Builder and create a new Custom Metric by selecting the Dataset you previously created.
Fill out the Measure, Date, Dimension, Aggregation, and Filter fields as shown in the diagram below.
Name your metric and save it.
Measure
NumberOfOrders
Date
CreatedAt
Dimension
/
Aggregation
COUNT
Filters
NumberOfOrders is greater than 1
4. Create a Calculated Metric for "Returning Customer Rate"
Navigate to Data Calculations and create a new Calculated Metric.
Divide Returning Customers with Total Customers.
Set the Format to Percentage.
Name your metric and save it.