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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Format duration in decimal for charts

Hi 

I have a column that represent the execution time of scheduled jobs. This column is shown in "time value" for each rows like "01:32:24".  Because bar chart can't show only number and decimals values, I'm trying to convert it into a decimal format like 01.32.

 

Here's what I have 

 

Jobname   duration in time

Job 1         01:24:20

Job 2         02:16:08

Job 3         00:01:32

 

What I want is 

 

Jobname   duration in decimal

Job 1         01.24.20

Job 2         02.16.08

Job 3         00.01.32

 

 

And then use the duration in decimal to do sums and averages in a bar chart  

 

 

How can I do that?

Many thanks for your help 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Convert the literal to correct duration, then the engine recognize it and store it as decimal number inherently.

= Table.AddColumn(Source, "Conv", each let l = List.Transform(Text.Split([Duration], ":"), Number.From) in #duration(0,l{0},l{1},l{2}), type duration)

CNENFRNL_0-1655783627153.png

CNENFRNL_1-1655783702853.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Convert the literal to correct duration, then the engine recognize it and store it as decimal number inherently.

= Table.AddColumn(Source, "Conv", each let l = List.Transform(Text.Split([Duration], ":"), Number.From) in #duration(0,l{0},l{1},l{2}), type duration)

CNENFRNL_0-1655783627153.png

CNENFRNL_1-1655783702853.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Thanks for your help.

But in my case i want to show the value in a bar chart. 

 

Currently in my chart the value that is shown is in this format 0.04843.... instead of 01:09:45

That's normal because natively you can only show int and decimal values in charts. it's not possible to show time values. 

 

based on those limitations, i'm trying to change the time format in a int format similar like 1.9.

45

 

How can i do this to be used in a chart ? 

 

Thanks 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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