1. How would you calculate Year-over-Year (YoY) Growth for each Product?
Compare current year's sales with the previous year's sales at Product level.
(
SUM([Sales])
-
LOOKUP(SUM([Sales]),-1)
)
/
ABS(LOOKUP(SUM([Sales]),-1))
Compute Using: Year
Partition By: Product
This helps identify fast-growing and declining products.
2. How would you identify customers who have increased their spending every year?
Check whether sales are continuously increasing year-over-year.
SUM([Sales]) >
LOOKUP(SUM([Sales]),-1)
AND
LOOKUP(SUM([Sales]),-1) >
LOOKUP(SUM([Sales]),-2)
This identifies loyal customers with growing business value.
3. How would you calculate Basket Size (Average Items per Order)?
A common Retail and E-Commerce KPI.
SUM([Quantity])
/
COUNTD([Order ID])
Example:
- Quantity Sold = 10,000
- Orders = 2,000
Basket Size = 5 Items per Order
4. How would you identify products frequently purchased together?
Use a self-join on Order ID.
Data Source Logic
SELECT
A.OrderID,
A.ProductName Product1,
B.ProductName Product2
FROM Orders A
JOIN Orders B
ON A.OrderID = B.OrderID
AND A.ProductName <> B.ProductName
In Tableau:
COUNTD([Order ID])
Higher counts indicate strong product affinity.
5. How would you calculate Customer Retention Rate?
Customers who purchased this year and also purchased last year.
COUNTD(
IF YEAR([Order Date]) = YEAR(TODAY())
AND
{ FIXED [Customer ID] :
MIN(YEAR([Order Date]))
}
< YEAR(TODAY())
THEN [Customer ID]
END
)
/
COUNTD([Customer ID])
This is one of the most important KPIs in customer analytics and subscription businesses.
Interview Follow-up
A senior Tableau interviewer may ask:
"When would you use Table Calculation vs LOD vs Custom SQL?"
Answer:
- Table Calculation → Running Total, Rank, Moving Average.
- LOD → Customer-level, Product-level fixed calculations.
- Custom SQL → Heavy transformations better handled before Tableau.
- Best Practice: Push large calculations to the database whenever possible for better performance.