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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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.

 

 

 

 

0 REPLIES 0

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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