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
LinlookZDJ
Helper I
Helper I

Changing decimal number into duration and display in visual chart

Dear Power BI Experts,

 

I have the following "Time Gap" column display the duration in decimal format. I have took quite some time but couldn't figure out the solution.

How can I display the decimal number in time duration and display in visual chart? For example for 0.002777 it should display as 4mins in the visual chart.

 

1.jpg

 

2.jpg

 

Attached my sample dashboard for your reference:

https://drive.google.com/drive/folders/1Lkea9FOpyR8p6GNlxKpEM__j_Lz0X5kS?usp=sharing

 

Thank you for your time.

 

Best regards

Lin  

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can leave your column as a decimal and use a measure expression like this in your tooltip to see the average formatted in hh:mm:ss.

 

Avg Time Gap = FORMAT(CONVERT(AVERAGE(Testing[Time Gap]),DATETIME), "hh:mm:ss")
 
Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

7 REPLIES 7
mahoneypat
Microsoft Employee
Microsoft Employee

You can leave your column as a decimal and use a measure expression like this in your tooltip to see the average formatted in hh:mm:ss.

 

Avg Time Gap = FORMAT(CONVERT(AVERAGE(Testing[Time Gap]),DATETIME), "hh:mm:ss")
 
Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi Pat,

 

Thanks for the solution! It works!

 

Just that is it possible for the tooltip value to appear on my bar instead of pointing on the bar to see the duration? For example 25:36 to swap with 0.02. So that we can look at the bar directly instead of pointing on it. 

 

LinlookZDJ_1-1629611520996.png

 

Appreciate a lot for your kind assistance!

 

Best regards

Lin

 

Anonymous
Not applicable

Even easier:

 

= Table.AddColumn(LastStep, "Minutes", each Duration.TotalMinutes(Duration.From([Time Gap])))

 

--Nate

Anonymous
Not applicable

You can add a column--let's say your last step name is LastStep. Add a new step, and in the formula bar, type:

 

= let day = each [Time Gap] in Table.AddColumn(LastStep, "Minutes", each Duration.TotalMinutes(#duration(day, 0,0,0)))

 

--Nate

Greg_Deckler
Community Champion
Community Champion

@LinlookZDJ Couple of ways to approach this. You could convert this to minutes by doing the following:

INT([Time Gap] * 24 * 60)

 

You could also convert this to seconds:

INT([Time Gap] * 24 * 60 * 60)

and then use a custom format string ala Chelsie Eiden's Duration - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

Thanks for the prompt reply.

 

However, I have tried to use your DAX formula to create a measure but it was unable to detect my Time Gap column, is there anything I have missed out?

LinlookZDJ_0-1629523770355.png

 

Best regards

Zhang DunJie

@LinlookZDJ Well if it is a measure, then you will need an aggregation like SUM, MAX or AVERAGE around your column reference.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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