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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
stubax
Frequent Visitor

Time on Y-Axis

Thought I would show a simple solution for adding time format to Y-Axis of charts as I couldn't find a solution for this - 

starting with a simple dataset below - (time is in time format HH:MM:SS)

 

stubax_5-1685633787612.png

 

Step 1 -

Add a new column turning time into a decimal in hours e.g. 01:30:00 = 1.5 hours 

using formula - 

Decimal Time = Data[Time]*24
stubax_4-1685633728088.png

 

Step 2 -
Add new measure summing this new column
using formula - 
SumofDecimalTime = sum(Data[Decimal Time])
 
Step 3 - 
Add new measure converting SumofDecimalTime measure into time format
using formula - 
HH:MM:SS =
VAR vHoursDecimal = [SumofDecimalTime]
VAR vHours = INT ( vHoursDecimal )
VAR vMinutesDecimal = 60 * ( vHoursDecimal - vHours )
VAR vMinutes = INT ( vMinutesDecimal )
VAR vSeconds = ROUND ( 60 * ( vMinutesDecimal - vMinutes ), 0 )
VAR vHH = IF ( LEN ( vHours ) = 1, "0" & vHours, vHours )
VAR vMM = IF ( LEN ( vMinutes ) = 1, "0" & vMinutes, vMinutes )
VAR vSS = IF ( LEN ( vSeconds ) = 1, "0" & vSeconds, vSeconds )
RETURN
    CONVERT ( vHH & vMM & vSS, INTEGER )
 
Step 4 - change format of new HH:MM:SS measure in the format box to 00:00:00 (have to type this in the box) as in the below - 
stubax_1-1685633122391.png

 

Step 5 - 

Add HH:MM:SS measure into Y-Axis of chart and Date column into X-Axis.

 

Step 6 - 

Change Y-Axis display units to None as in the below - 

stubax_2-1685633485258.png

 The result should be something similar to the below - 

stubax_3-1685633590179.png

Also works with bar charts. Hope this helps anyone struggling with getting time on the Y-Axis.

 

 

 

 

3 REPLIES 3
mlvdijl
Frequent Visitor

Hi @RobertDosek. I usually create a second measure and use  FORMAT to show the time as mm:ss. This doesnt work in a chart because its essentially a text value, but you can put it in a table, matrix or card visual and use it as a tooltip on the chart. 

mlvdijl
Frequent Visitor

Great find! However, the axis isn't quite correct if I apply this solution, as it treats the time as integers it doesn't "stop" at 60, but goes through to 100. For example: a time of 00:18:54 is plotted about halfway between 18 and 19, while it should be very close to the 19 min line. 

 

After trying out several things including dynamic format string, I still find myself reverting back to using minutes as a decimal number on the axis, and creating a custom tooltip that shows the correctly formatted time.

 

Very annoying that PowerBi doesn't offer a better solution for this. Please vote for the idea below if you're also looking for this! 

 

Microsoft Idea

Hello, I agree... What do you mean by "creating a custom tooltip that shows the correctly formatted time"? 

Thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.