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
Anonymous
Not applicable

Converting time value to a decimal number so it could be displayed as a value

Hey everyone,
So initally i had two time values, which was StartTime and EndTime and right now I got the duration between both as one column, but in the duration format. The problem is, I can't figure out how to make it as a decimal or whole number, so I could display it as a sum in histogram. The closest I got to this is take duration as total hours, however, I need precise time to be displayed in the histogram as a value. Any ideas? 

9 REPLIES 9
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

check out this code

 

let
    StartTime = #time(12,0,0),
    EndTime = #time(16,30,0),
    DurationDigital = Number.From(EndTime-StartTime)*24
in
    DurationDigital

 

Jimmy801_0-1600160060628.png

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

It seems like its displaying 4,5, but i would need it to be 4:30(as a decimal number) if that makes sense.
Thanks for your help. 

Anonymous
Not applicable

Hello @Anonymous 

 

4:30 it's text format. Just convert the duration to text. Here the code

let
    StartTime = #time(12,0,0),
    EndTime = #time(16,30,0),
    DurationDigital = Duration.ToText(EndTime-StartTime)
in
    DurationDigital

 

Jimmy801_0-1600165089055.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

Anonymous
Not applicable

@Jimmy801 

that is basically how I want to do it

Gediminas12_0-1600168980652.png

 

 

Hello @Anonymous 

 

I don't think that you can sum a time-format like "4:30" in Power BI. I don't know how exactly you need to sum and show. But you could make something like this

Jimmy801_0-1600169820660.png

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

@Jimmy801  That would be a possible solution how did you do that? can you share your file with me? 

Hello @Anonymous 

 

but I didn't any sum. What i did is to create a column with decimals and a new column1 to format it to "hh:mm".

Jimmy801_0-1600170709870.png

 

in the histrogram I've used Column1 for values and Column for the Axis. I don't know if this could be of any help. But maybe it could be a starting point 🙂

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

Anonymous
Not applicable

@Jimmy801 That is what I need, however I can't sum up text value to display it in histogram, any way I could sum up this text format to display it into values? 

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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 Kudoed Authors