Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

add time

I have to sum the time in a particular format.   for Example :   9:26:22 9:22:14 9:12:27 9:05:25 9:15:24 Sum is 46:21:52 - i have to get in this format.   But, when i am trying to do in po...
  • v-cherch-msft's avatar
    v-cherch-msft
    7 years ago

    Hi Anonymous

     

    You may add Table1 in your formula. Attached the sample file.

    New Time =
    VAR a =
        SUMX (
            Table1,
            HOUR ( Table1[Time] ) * 3600
                + MINUTE ( Table1[Time] ) * 60
                + SECOND ( Table1[Time] )
        )
    VAR hours =
        TRUNC ( a / 3600 )
    VAR minutes =
        TRUNC ( MOD ( a, 3600 ) / 60 )
    VAR seconds =
        MOD ( a, 60 )
    RETURN
        hours & ":"
            & minutes
            & ":"
            & seconds
    

    Regards,

    Cherie