Forum Discussion
android1
10 years agoPost Patron
Time difference in hours
Hi, I'm trying to calculate the diiference in hours between two date/time columns. When I use DateDiff I am not able to use the two columns below.
Sean
10 years agoCommunity Champion
android1 So you've verified both columns are date/time.
Then maybe you have some start (FROM) times that are after the corresponding end (TO) times.
See if this works - but don't forget that this means some of your data is not in the right order...
Hours = SWITCH(
TRUE(),
'Table'[TimeFrom]<'Table'[TimeTo], DATEDIFF('Table'[TimeFrom], 'Table'[TimeTo], HOUR),
'Table'[TimeFrom]>'Table'[TimeTo], DATEDIFF('Table'[TimeTo], 'Table'[TimeFrom], HOUR),
0 )abodqmm
2 years agoRegular Visitor
Dear Sean i tried this method and it worked fine i want to see it in minutes how can i do it ?????