Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi there,
I'm getting stuck with a query and haven't been able to find any answers in previous posts from other users.
Effectively, I have 2 columns of interest: Date and UserID. I'm trying to calculate the amount of days in between consequtive orders for the individual users. I've made a screenshot of an example file with column 3, days between orders, the desired column to make. (In my actual data, these values are of course not perfectly fitlered like this).
Thanks in advance for your wisdom!
Cheers,
Jeroen
Solved! Go to Solution.
Please follow these steps:
1.Create a new calculation column and write
Days between orders = DATEDIFF(calculate(max('Table'[Date]),filter('Table','Table'[UserID]=earlier('Table'[UserID])&&'Table'[Date]<earlier('Table'[Date]))),'Table'[Date],DAY)
2.The results obtained are as follows
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Write this calculated column formula
Days between orders = Data[Date]-calculate(max(Data[Date]),filter(Data,Data[UserID]=earlier(Data[UserID])&&Data[Date]<earlier(Data[Date])))
Hope this helps.
Thanks heaps for this Ashish, this did exactly what I asked.
I discovered I made a mistake in my logic however, as I am actually trying to see how many days it took for a customer to order again after a certain event. Therefore, my end result should ideally look like this:
Would there be a way of tweaking the fomula to get this as a result?
Thanks again for your help!
Thanks Ashish, incredible!
You are welcome.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 86 | |
| 69 | |
| 37 | |
| 29 | |
| 26 |