Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Using a calculated duration in visuals - is this now possible?

So I had a total seconds measure, that using dax I put into a duration of days:hours:minutes:seconds, but I can not use that in any visuals. I know years ago when I tried doing things like this there...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

    Based on your needs, I have created the following form.

     

     

    You can use the following dax to get the result you want

    Measure = 
         VAR TotalSeconds = SELECTEDVALUE('Table'[seconds])
         VAR Seconds = MOD(TotalSeconds, 60)
         VAR Minutes = MOD(INT(TotalSeconds / 60), 60)
         VAR Hours = MOD(INT(TotalSeconds / 3600), 24)
         VAR Days = INT(TotalSeconds / 86400)
         RETURN
         FORMAT(Days, "00") & " days " & 
         FORMAT(Hours, "00") & ":" & 
         FORMAT(Minutes, "00") & ":" & 
         FORMAT(Seconds, "00")

     

     

    Best Regards,

    Jayleny

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.