March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
87 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |