Greg_Deckler's avatar
Greg_Deckler
Icon for Community Champion rankCommunity Champion
5 years ago

Decimal Duration Converter

Kind of surprised this wasn't already out there but here is a converter for a duration in decimal form to something else. You might end up with a decimal duration when doing math on two date/time columns like:

([Date1] - [Date2]) * 1.

 

Conversion Measure = 
    VAR __Value = SUM([Decimal Days])
    VAR __Days = TRUNC(__Value)
    VAR __Hours = TRUNC ( (__Value - __Days) * 24 )
    VAR __Minutes = TRUNC ( (__Value - __Days - __Hours / 24) * 24*60 )
    VAR __Seconds = TRUNC ( (__Value - __Days - __Hours / 24 - __Minutes/24/60) * 24*60*60 )
RETURN
    __Days&":"&__Hours&":"&__Minutes&":"&__Seconds