Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to calculate Date + time

Hello,   I want to calculate a date/time + time to get results in date/time.  My data setting is following:   Column A: Date/time [DD:MM:YYYY hh:nn:ss] Column B: Time [hh:nn:ss]   Results in ...
  • v-deddai1-msft's avatar
    v-deddai1-msft
    5 years ago

    Hi Anonymous ,

     

    You can use the following measure to convert Decimal number [in hours] to Time value

     

    Measure =
    VAR vSeconds =
        MAX ( 'Table'[Hours] ) * 3600
    VAR vMinutes =
        INT ( vSeconds / 60 )
    VAR vRemainingSeconds =
        MOD ( vSeconds, 60 )
    VAR vHours =
        INT ( vMinutes / 60 )
    VAR vRemainingMinutes =
        MOD ( vMinutes, 60 )
    RETURN
        TIME ( vHours, vRemainingMinutes, vRemainingSeconds )

     

     

     

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

     

    Best Regards,

    Dedmon Dai