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])
Eric_Zhang
10 years agoMicrosoft Employee
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
8 years agoNot applicable
This is exactly what I'm looking for, but it doesn't work in Direct Query mode, do you have any alternatives for that?
- Anonymous8 years agoNot applicable
Importing the data?