Forum Discussion
gusly
10 years agoHelper II
How do display duration properly?
I'm displaying durations in some of my charts. However, I haven't figured out how to do it in a proper way. Currently I'm using a column that represent minutes as a decimal number. Not optimal, si...
dshah
9 years agoFrequent Visitor
First convert the data into seconds. Then divide the data by 86400 (60 min x 60 secs x 24 hours) to get output that can be converted to time. Then use below to get time equivalent
FORMAT([seconds]/86400,"Long Time"). This gives time equivalent with AM / PM at end. You can use Left to trim it.
Left(FORMAT([seconds]/86400,"Long Time"),7)
This solves the averaging problem and other time duration related problems.
Additional Date/Time formats in DAX can be find below
https://technet.microsoft.com/en-us/library/ee634813(v=sql.105).aspx
Hope this helps.
beerygaz
9 years agoFrequent Visitor
This doesn't work for durations lower than 3600 seconds, however, as you end up with 12:mm:ss rather than 0:mm:ss