Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Time diff format calculation measure

Hey I m trying to convert calculation into time format but with no luck ( i have been trying to use mod/ int functions and adding "min" "sec" text). The aim is to apply is to a chart
 
Original formula:
Avarage time for 1 board =
VAR TU =
    FILTER ( TJob, TJob[SekundærNavn] = "Quality control HMD" )
RETURN
    DIVIDE (
        SUMX ( TU, TJob[Time diff] ),
        SUMX ( TU, TJob[Antal] )
        )
 
Time diff =
DATEDIFF(TJob[Start],TJob[**bleep**], MINUTE)
 
Could someone help me convert it? 

2 Replies

  • v-xiaotang's avatar
    v-xiaotang
    Community Support

    Hi Anonymous 

    Thanks for reaching out to us.

    you have to convert calculation into time format by using measure like below,

    example:

    fmtCol = 
    RIGHT ( "0" & INT ( TableName[Duration] / 3600 ), 2 )
        & ":"
        & RIGHT (
            "0"
                & INT ( ( TableName[Duration] - INT (TableName[Duration] / 3600 ) * 3600 ) / 60 ),
            2
        )
        & ":"
        & RIGHT ( "0" & MOD (TableName[Duration], 3600 ), 2 )

    Solved: formatting time value to hh:mm:ss - Microsoft Power BI Community

     

    Best Regards,

    Community Support Team _Tang

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Its similar workaround to mod/ int solution as text

     

    It may work for table row visual but i m calculating numerical values from many to one key id. I cant apply this function to chart