Forum Discussion

pedroccamaraDBI's avatar
pedroccamaraDBI
Icon for Post Partisan rankPost Partisan
3 years ago
Solved

Convert seconds into hour minute and seconds

Hello everyone!!
I'm working with time values and I'm trying to get hh:mm:ss from an INT column.
My dax measure is:

TTime =
VAR TotalSeconds = MIN( 'UserActivity'[Audio Duration In Seconds])
VAR Days = INT(TotalSeconds / 86400)
VAR RemainingSeconds = MOD(TotalSeconds, 86400)
VAR Hours = INT(RemainingSeconds / 3600)
VAR Minutes = INT(MOD(RemainingSeconds, 3600) / 60)
VAR Seconds = MOD(MOD(RemainingSeconds, 3600), 60)
RETURN
    TIME(Days * 24 + Hours, Minutes, Seconds)
For example, 140771 seconds is 1 day 15 hours, 6 minutes and 11 seconds and it's showing 15:06:11 (measure formated as long time) and of course it should show 39:06:11
Can anyone help me? What am I missing here?
Thanks in advance