Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hallo everyone,
If I have this table and I want to calculate for each ID the duration between the end time and the start time of the next event.
In the column marked in green is the value I want to calculate.
Could you please helop out there?
I know dateiff will calculate but only in the same raw but what I need is in different rows.
Solved! Go to Solution.
Hi @Anonymous ,
You may create measure like DAX below.
DiffTime=
Var _ThisTime = SELECTEDVALUE(Table1[Event time])
Var _SecondTime= CALCULATE(MIN(Table1[Start time]),FILTER(ALLSELECTED(Table1), Table1[ID] =MAX(Table1[ID]) && Table1[Event time] >_ThisTime ))
Return
DATEDIFF(_ThisTime , _SecondTime, MINUTE )
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You may create measure like DAX below.
DiffTime=
Var _ThisTime = SELECTEDVALUE(Table1[Event time])
Var _SecondTime= CALCULATE(MIN(Table1[Start time]),FILTER(ALLSELECTED(Table1), Table1[ID] =MAX(Table1[ID]) && Table1[Event time] >_ThisTime ))
Return
DATEDIFF(_ThisTime , _SecondTime, MINUTE )
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |