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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
stribor45
Post Prodigy
Post Prodigy

Converting to mm:ss

I looked at this post which explaing about conversion from decimal to hh:ss. I tried to adapt it to my needs. My decimal number is day and according to google i need to multiply it by 86400 to get it into seconds in order to be able to use this code.

I can see that it is giving me conversion error but I have no idea which line of code this is. How would I determine where is the error from this.

stribor45_1-1697506724320.png

 

stribor45_0-1697506712132.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @stribor45 ,

 

You can try the following dax:

 

Column =
VAR time = 'Table'[Day]
VAR hours = ROUNDDOWN(24 * time , 0)
VAR H_rem = 24 * time - ROUNDDOWN(24 * time , 0)
VAR minutes = ROUNDDOWN(60 * H_rem , 0)
VAR M_rem = 60 * H_rem - ROUNDDOWN(60 * H_rem , 0)
VAR seconds = ROUND(60 * M_rem , 0)
Return
TIME(hours,minutes,seconds)

 

vyangliumsft_0-1697697942241.png

I show hh:mm:ss in Power Query, to Power BI Desktop it shows up fine and cannot reproduce your scenario:

vyangliumsft_1-1697697942245.png

Is your Power BI Desktop the latest version, if not, upgrade to the latest version in the link below:

Download Power BI Desktop from Official Microsoft Download Center

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @stribor45 ,

 

You can try the following dax:

 

Column =
VAR time = 'Table'[Day]
VAR hours = ROUNDDOWN(24 * time , 0)
VAR H_rem = 24 * time - ROUNDDOWN(24 * time , 0)
VAR minutes = ROUNDDOWN(60 * H_rem , 0)
VAR M_rem = 60 * H_rem - ROUNDDOWN(60 * H_rem , 0)
VAR seconds = ROUND(60 * M_rem , 0)
Return
TIME(hours,minutes,seconds)

 

vyangliumsft_0-1697697942241.png

I show hh:mm:ss in Power Query, to Power BI Desktop it shows up fine and cannot reproduce your scenario:

vyangliumsft_1-1697697942245.png

Is your Power BI Desktop the latest version, if not, upgrade to the latest version in the link below:

Download Power BI Desktop from Official Microsoft Download Center

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

stribor45
Post Prodigy
Post Prodigy

in power query my data is shown as duration but once it is loaded into the model it is showing as a decimal number. Thats why I am trying to use this code above. Is there an easier way to show this decimal number as hh:mm:ss?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors