Forum Discussion

sabeensp's avatar
sabeensp
Icon for Helper IV rankHelper IV
7 years ago
Solved

Convert measure value into hh:mm:ss

Hello,

 

I have a meassure which is SUM(Table1[Field1]) + SUM(Table2[Field2]) Returns a single number like 7685

 

I need to convert 7685 to HH:MM:SS, how do I do that?

 

Thanks in advance.

  • Hi sabeensp 

    You may try below measure.

    Measure =
    TIME ( 0, 0, 0 )
        + DIVIDE ( SUM ( TABLE1[Column1] ) + SUM ( TABLE2[Column2] ), ( 24 * 60 * 60 ) )
    

    Regards,

6 Replies

  • v-cherch-msft's avatar
    v-cherch-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi sabeensp 

    You may create a measure like below and format it.

    Measure = TIME(0,0,SUM(Table1[field1])+SUM(Table1[field2]))

     

    Regards,

    • sabeensp's avatar
      sabeensp
      Icon for Helper IV rankHelper IV

      v-cherch-msft  I tried

      Production Time = TIME(0,0,SUM(TABLE1[Column1]) + SUM(TABLE2[Column2]))
      Both Columns are numeric, they are in different related table, but that should not cause the problem.
      I get following error:

       

      Error Message:
      MdxScript(Model) (15, 45) Calculation error in measure [Production Time]:

      An argument of function 'TIME' has the wrong data type or the result is too large or too
      small.

      • v-cherch-msft's avatar
        v-cherch-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        Hi sabeensp 

        You may try below measure.

        Measure =
        TIME ( 0, 0, 0 )
            + DIVIDE ( SUM ( TABLE1[Column1] ) + SUM ( TABLE2[Column2] ), ( 24 * 60 * 60 ) )
        

        Regards,