0
0
Tableaubi_tool~10 mins

Common LOD use cases (customer first purchase, cohorts) in Tableau - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to calculate the first purchase date per customer using LOD expression.

Tableau
{ FIXED [Customer ID] : MIN([1])}
Drag options to blanks, or click blank then click option'
A[Purchase Date]
B[Order Date]
C[Transaction Date]
D[Sale Date]
Attempts:
3 left
💡 Hint
Common Mistakes
Using a date field that is not related to purchase, like shipping date.
2fill in blank
medium

Complete the LOD expression to count unique customers who made their first purchase in each cohort month.

Tableau
COUNTD({ FIXED DATETRUNC('month', [Order Date]) : IF DATETRUNC('month', [Order Date]) = [1] THEN [Customer ID] END })
Drag options to blanks, or click blank then click option'
ADATETRUNC('month', [First Purchase Date])
BDATETRUNC('month', [Order Date])
CDATETRUNC('year', [Order Date])
DDATETRUNC('day', [Order Date])
Attempts:
3 left
💡 Hint
Common Mistakes
Using order date instead of first purchase date for cohort grouping.
3fill in blank
hard

Fix the error in the LOD expression to calculate the number of months since a customer's first purchase.

Tableau
DATEDIFF('month', [1], [Order Date])
Drag options to blanks, or click blank then click option'
A[First Purchase Date]
B[Customer First Purchase]
CMIN([Order Date])
D{ FIXED [Customer ID] : MIN([Order Date]) }
Attempts:
3 left
💡 Hint
Common Mistakes
Using a field that is not aggregated or calculated per customer.
4fill in blank
hard

Fill both blanks to create a cohort calculation that assigns customers to their first purchase month and calculates retention month.

Tableau
DATETRUNC('month', [1]) AS CohortMonth, DATEDIFF('month', [2], [Order Date]) AS RetentionMonth
Drag options to blanks, or click blank then click option'
A[Order Date]
B{ FIXED [Customer ID] : MIN([Order Date]) }
C[First Purchase Date]
D[Customer ID]
Attempts:
3 left
💡 Hint
Common Mistakes
Using order date directly instead of first purchase date for cohort assignment.
5fill in blank
hard

Fill all three blanks to write a cohort retention calculation: assign cohort month, calculate retention month, and count distinct customers.

Tableau
{ FIXED DATETRUNC('month', [1]), DATEDIFF('month', [2], [Order Date]) : COUNTD([3]) }
Drag options to blanks, or click blank then click option'
A[Order Date]
B{ FIXED [Customer ID] : MIN([Order Date]) }
C[Customer ID]
D[First Purchase Date]
Attempts:
3 left
💡 Hint
Common Mistakes
Counting orders instead of customers, or using order date instead of first purchase date.