Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I'm trying to calculate the difference between timestamp. My code isn't working.
Hi @Sonyat810 ,
Due to I don't know your data model, here I will create a sample to have a test.
Measure:
Diff between Timestamp =
VAR _DIFFSECOND =
DATEDIFF ( MAX ( 'Table'[Start] ), MAX ( 'Table'[End] ), SECOND )
VAR _HOUR =
FORMAT ( QUOTIENT ( _DIFFSECOND, 60 * 60 ), "00" )
VAR _MINUTE =
FORMAT ( QUOTIENT ( _DIFFSECOND - _HOUR * 60 * 60, 60 ), "00" )
VAR _SECOND =
FORMAT ( _DIFFSECOND - _HOUR * 60 * 60 - _MINUTE * 60, "00" )
RETURN
COMBINEVALUES ( ":", _HOUR, _MINUTE, _SECOND )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
How do I attach my .pbix file?
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
86 | |
84 | |
66 | |
49 |
User | Count |
---|---|
140 | |
113 | |
106 | |
64 | |
60 |