Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I am trying to get a percentage of customers who rebuy based on the initial product purchased. I have a standard fact/dimension data warehouse with a Order Placed fact, a Customer dimension, and a Product dimension.
I have set up the following custom metric in the demand table to get the number of customers whose first purchase included the selected product:
First Purchase Customer Count = CALCULATE(DISTINCTCOUNT(Demand[CustomerKey]),Demand[Customer Order Sequence Number] = 1)
Next I need a custom metric that will show the number of customers who purchased again. This should only include those customers who purchased the item on their first order, but shouldn't be filtered based on the item(s) purchased in their second order. The DAX I have attempted, but is not working is:
Rebuyer Count = CALCULATE(DISTINCTCOUNT(Demand[CustomerKey]),Demand[Customer Order Sequence Number] = 2,ALL('Product'[Item]),FILTER(SUMMARIZE(Demand,Demand[CustomerKey],[Customer Order Sequence Number]),[Customer Order Sequence Number] = 1))
Here is a screenshot of my table thus far:
Can someone please give me guidance in how to create that second formula?
Thank you
I was able to find a formula that gives me the correct answer, but it runs into the 1M row limit unless I filter on the product subcategory. This is the formula:
Rebuyer Count = COUNTROWS(INTERSECT(SUMMARIZE(FILTER(Demand,Demand[Customer Order Sequence Number] = 1),[CustomerKey]),SUMMARIZE(CALCULATETABLE(FILTER(Demand,Demand[Customer Order Sequence Number] = 2),all('Product')),[CustomerKey])))
Can anyone help me refine this formula so it works for my full data set?
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
117 | |
101 | |
71 | |
61 |