Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Change to mm:ss format

I have connected to excel data source in format of mm:ss which shows up as the following in power bi but want to show it as mm:ss and want to show that value in a card and in a chart and plot a...
  • v-luwang-msft's avatar
    3 years ago

    Hi Anonymous ,

    Refer the below sample (adjust from second to dd.hh:mm:ss,adjust it according your need,you could adjust your time  to second,through *60 to get it):

    Measure = 
    VAR ss =
        SUM ( 'test'[seconds] )
    VAR mm =
         ( ss - MOD ( ss, 60 ) ) / 60
    VAR hh =
         ( mm - MOD ( mm, 60 ) ) / 60
    VAR mmm =
        mm - MOD ( mm, 60 )
    VAR res = ss - hh * 3600
    VAR rem =
         ( res - MOD ( res, 60 ) ) / 60
    VAR ress = ss - rem * 60 - hh * 3600
    RETURN
        hh & ":" & rem & ":" & ress

     

     

    Best Regards

    Lucien