Forum Discussion
juli__sia123412
7 years agoFrequent Visitor
Average days between orders
Question is simple, but I'm totally lost. I have the next data: buyerID - OrderId - Rank (1,2,3...meant order index) - Purchase date 123 - 123347 - 1 ...
- 7 years ago
you would first need to create a calculated column that gets the difference in days between orders
DateDiff Previous TransactiondDate =DATEDIFF(CALCULATE(max(Table2[Purchase date]),FILTER(ALL('Table2'),Table2[buyerID] = EARLIER(Table2[buyerID]) && 'Table2'[Purchase date] < EARLIER(Table2[Purchase date]) )), Table2[Purchase date], day)then you can do an avg on that difference with a calculated measureavg = CALCULATE(AVERAGE(Table2[DateDiff Previous TransactiondDate]))
vanessafvg
7 years agoCommunity Champion
you would first need to create a calculated column that gets the difference in days between orders
DateDiff Previous TransactiondDate =
DATEDIFF(
CALCULATE(
max(Table2[Purchase date])
,FILTER(
ALL('Table2')
,Table2[buyerID] = EARLIER(Table2[buyerID]) && 'Table2'[Purchase date] < EARLIER(Table2[Purchase date]) )), Table2[Purchase date], day)
then you can do an avg on that difference with a calculated measure
avg = CALCULATE(AVERAGE(Table2[DateDiff Previous TransactiondDate]))
- MAAbdullah_475 years agoHelper V
Hi vanessafvg
Please note (Earlier) is not supported by DAX , you have to find alternative solution.
THNX