Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anth_NC_QN
Frequent Visitor

Duration format MIN:SEC in table

Hi everyone,

 

English is not my native language but i'll try to be as precise as possible. Sorry if i'm not clear. Please do ask me more details.

 

I've been trying to reproduce this excel table in power bi desktop :

Anth_NC_QN_0-1688446912437.png

It's part of a shop performance evaluation based on a X month period. So in 2021 for eg, the average waiting time in minutes before being assisted is 2mn and 45sec which i converted from the decimal number 2,75 by dividing it by 24, and formatting the result.

Anth_NC_QN_3-1688450259585.png

 

In power bi, i've loaded only one table which contains the "waiting time" column in decimal numbers :

Anth_NC_QN_1-1688447543681.png

In order to display the results in a table, i've created this measure for the 2021 column i'm trying to reproduce :

wait time = CALCULATE(AVERAGE(VM_DATA_QUANTI[waiting time]), FILTER(VM_DATA_QUANTI, VM_DATA_QUANTI[Année]="2021"))

 

Here's the table with the same data i used for the excel table screenshot :

Anth_NC_QN_2-1688447990927.png

 

The next step was to try formatting the results in MIN:SEC by completing the above dax formula using "FORMAT" :

wait time =
CALCULATE(
AVERAGE(VM_DATA_QUANTI[waiting time]),
FILTER(VM_DATA_QUANTI, VM_DATA_QUANTI[Année]="2021"),
FORMAT(INT(VM_DATA_QUANTI[waiting time] * 1), "00") & ":" & FORMAT(MOD(VM_DATA_QUANTI[waiting time] * 60, 60), "00")
)

 

I'm using MOD in the second part of the FORMAT formula to find the remaining seconds once the minutes in whole numbers have been calculated.

As you can imagine, it didn't work lol.

 

Would you please have a solution on how i can display those decimal numbers in the same format as the excel screenshot ?

 

Thanks 🙏

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anth_NC_QN 
Please try

wait time =
VAR WaitTime =
    CALCULATE (
        AVERAGE ( VM_DATA_QUANTI[waiting time] ),
        FILTER ( VM_DATA_QUANTI, VM_DATA_QUANTI[Année] = "2021" )
    )
VAR TotalSeconds = WaitTime * 60
VAR Seconds =
    MOD ( TotalSeconds, 60 )
VAR Minutes =
    QUOTIENT ( TotalSeconds, 60 )
RETURN
    TIME ( 0, Minutes, Seconds )

You can then choose you preference of the time format type.

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Anth_NC_QN 
Please try

wait time =
VAR WaitTime =
    CALCULATE (
        AVERAGE ( VM_DATA_QUANTI[waiting time] ),
        FILTER ( VM_DATA_QUANTI, VM_DATA_QUANTI[Année] = "2021" )
    )
VAR TotalSeconds = WaitTime * 60
VAR Seconds =
    MOD ( TotalSeconds, 60 )
VAR Minutes =
    QUOTIENT ( TotalSeconds, 60 )
RETURN
    TIME ( 0, Minutes, Seconds )

You can then choose you preference of the time format type.

@tamerj1 , spot on !

I'm not used to working with variables (VAR) in power bi. I'll get to it.

Thank you

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.