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
Sonal28
Regular Visitor

Display time in Y-axis using Power BI clustered column chart

I have multiple time for the selected date. I need to show average time for the selected date/ month using clustered column chart.
Average time which will come top of the BAR. X axis will be time axis. And average time will be there on top of the BAR and height accordingly. How to acheive this. please advice. Thanks in advance.

1 ACCEPTED SOLUTION

@Sonal28,

Power BI doesn't support time in Y-axis of clustered column chart, there are workarounds for you to create the visual.

1. Use integer to represent the Time and dispaly integer in Y-Axis, there is a similar thread for your reference.
2. Use R visual, please see this similar thread.

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

5 REPLIES 5
phersan
Regular Visitor

I recently got stuck with this same issue, and option #1 on @v-yuezhe-msft's reply got me pretty close by converting the times to integers with a format of HHMMSS. (Ex: 9:24:38 AM would equal 92438).

 

You can reference that original solution here by @v-shex-msft on another thread:

https://community.fabric.microsoft.com/t5/Desktop/Display-duration-as-HH-MM-SS-on-Y-axis/m-p/88111/h...

 

Just wanted to share an update that Power BI rolled out a Dynamic formatting for DAX measures feature, which gets us even closer now, by displaying an integer as HH:MM:SS.

 

Basically, just follow shex's instructions to create a DAX measure that represents your time as an integer (they used MAX, but I needed an AVERAGE) :

 

DAX Start Time = (HOUR(AVERAGE(data_table[Start Time]))*10000) + (MINUTE(AVERAGE(data_table[Start Time]))*100) + (SECOND(AVERAGE(data_table[Start Time]))*1)

 

Next, change the format of your measure to "Dynamic", and you'll get a drop-down option to input a format string for your measure. I chose "00:00:00" as my format (you can include negative and zero formats as well separated by a semi-colon, if you want to be thorough. see below)

phersan_0-1697735736453.png

 

Next, create a Line Graph and use your new DAX measure as the Y-Axis. You'll need to format your Y-Axis in the settings of the chart so that the Display Units don't get auto-formatted to thousands (K). Set that option to "None"

phersan_1-1697731437771.png

 

Here is what my final Line Graph looks like in my test file:

phersan_2-1697731650429.png

 

The only drawback I have noticed so far is that you won't be able to format your time in 12HH format with an AM/PM indicator. I played around with the formatting by making my AM times negative and PM times positive inside my measure, and including the AM and PM indicators in the positive;negative formatting strings (Ex: "00:00:00 PM; 00:00:00 AM") but still no luck, unless I'm missing something simpler. I don't believe you can use date/time format patterns directly within the Dynamic format feature (i.e. just typing "HH:MM:SS" as your format string didn't work for me).

 

Perhaps someone smarter than me could hack a mathematical conversion or a clever DAX measure to display a 12HH graph correctly because I'm drawing a blank.

 

Also, it doesn't look like I can attach a sample pbix file, but if it eventually lets me then I will include what I put together.

 

Hope this helps!

Paulo

Sonal28
Regular Visitor

SLA.PNGSLA1.png

 

I need to show above data using clustered column chart.
Average time which will come top of the BAR. X axis will be time axis. And average time will be there on top of the BAR and height accordingly. How to acheive this. please advice. Thanks in advance.

@Sonal28,

Power BI doesn't support time in Y-axis of clustered column chart, there are workarounds for you to create the visual.

1. Use integer to represent the Time and dispaly integer in Y-Axis, there is a similar thread for your reference.
2. Use R visual, please see this similar thread.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yuezhe-msft , 

 

Does pbi already have this feature of displaying time in the y axis?

 

Thank you so much, 

 

Pedro 

Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.