Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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 

  • 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)

2 Replies

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity 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)

    • Anonymous's avatar
      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