Forum Discussion

Novice_92's avatar
Novice_92
Frequent Visitor
4 years ago

Duration hh:mm

Morning everyone,

 

I'm looking to convert whole number into hh:mm without it converting into d:hh:mm when it exceeds 24hrs via DAX.

 

Any ideas?

 

TIA

 

 

4 Replies

  • Can you give a few examples? Is the whole number in units of days, hours, minutes, or something else?

    • Novice_92's avatar
      Novice_92
      Frequent Visitor

      Hi,

       

      whole number in this case = seconds and require the formula to convert this into hours & minutes. 

       

       

      • AlexisOlson's avatar
        AlexisOlson
        Icon for Super User rankSuper User

        Try something like this:

        Duration (hh:mm:ss) = 
        VAR _Seconds = Table1[Seconds]
        VAR _Hours = INT ( _Seconds / 3600 )
        VAR _Remainder = ( _Seconds - _Hours * 3600 ) / 3600 / 24
        RETURN
            FORMAT ( _Hours, "00:" ) & FORMAT ( _Remainder, "nn:ss" )

        You can drop the ":ss" if you just want "hh:mm".