Forum Discussion
TheGreatestGoat
8 years agoFrequent Visitor
Calculate A Customer's Second Order
Hi There, I am trying to calculate the time between a customer's first order and second order. I have been able to calculate the difference between first and last date as follows using measures: ...
- 8 years ago
You can try this MEASURE pattern
Days between second order and third order = VAR temp = ADDCOLUMNS ( VALUES ( 'Sales Fact Table'[purchase_Date] ), "RANK", RANKX ( VALUES ( 'Sales Fact Table'[purchase_Date] ), [purchase_Date], , DESC, DENSE ) ) RETURN DATEDIFF ( MINX ( FILTER ( temp, [RANK] = 3 ), [purchase_Date] ), MINX ( FILTER ( temp, [RANK] = 2 ), [purchase_Date] ), DAY ) - 8 years ago
Try this MEASURE to do the average
Measure = AVERAGEX ( ALLSELECTED ( 'Sales Fact Table'[Customer] ), [Days between second order and third order] )
Ashish_Mathur
Super User
8 years agoI really cannot helop now. The maximum i can do is share the file with you which i already have done.
Devesh790
3 years agoFrequent Visitor
Hi Ashish,
What if we wanted to see it in calculated coloumns
- Ashish_Mathur3 years ago
Super User
That is a very sold post. Share some data, describe the question and show the expected result.