Forum Discussion
QuasemS
10 years agoFrequent Visitor
Calculating day/time difference
I have two columns, both with dates and times in the same format. I want to create a new column to calculate the days/times differences between the two columns. But when I try to change the data type...
- 10 years ago
You can also add a custom column in Query Editor.
=Duration.ToText([AlarmClearedUTC]-[AlarmSentUTC])
And then in DAX
Column = IF ( LEFT ( Table1[Duration], IFERROR ( SEARCH ( ".", Table1[Duration] ), 1 ) - 1 ) = "", 0, LEFT ( Table1[Duration], IFERROR ( SEARCH ( ".", Table1[Duration] ), 1 ) - 1 ) ) & " DAY " & RIGHT ( Table1[Duration], 8 )Or Duration.ToRecord and expand?
Duration.ToRecord([AlarmClearedUTC]-[AlarmSentUTC])
Anonymous
6 years agoNot applicable
Also can use a measure, i feel little faster loading time with this
TimeDiff = CONVERT(SELECTEDVALUE(Table[Date1],0)-SELECTEDVALUE(Table[Date2],0),DATETIME)
and then change the format to time hh:mm:ss
Cheers
Cheers
- TrentAssist6 years agoFrequent Visitor
Thanks, this idea helped me on a similar issue i was batttling with.