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
CarterB13
Frequent Visitor

Using hh:mm:ss format on Power BI charts

Hey I seem to be having an issue using hh:mm:ss format measures in Power BI charts. (Bar, line, area, etc) I try to drag the measure to any of the axis spots (x, y, line) and nothing happens, it wont drop that measure into the axis spot. Even if I go with table, bring the field in and then switch visual to a chart it puts the field in the "Tooltips" section.

 

The field is a measure and this is the code.  Any ideas? I have that measure formatted as (h:mm:ss) also tried different variations of times. Tried dividing by 1 or multipying by 86400. Neither worked. 

 

*AvgSpeedOfAnswer = TIME(0,0,CALCULATE(SUM('Interactions'[QueueTime_s]),filter('Queues','Queues'[IsInbound]=1),FILTER('Interactions','Interactions'[IsAnswered]=1))/SUM('Interactions'[IsAnswered]))
3 REPLIES 3
Greg_Deckler
Super User
Super User

@CarterB13 Chelsie Eiden's Duration - Microsoft Power BI Community


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Thanks for the info.  So do I just create a new measure using this code? This seems like it wouldnt work based on the calculation I am using in my measure. I am still learning dax, so excuse any dumb questions. 

 

*AvgSpeedOfAnswer = TIME(0,0,CALCULATE(SUM('Interactions'[QueueTime_s]),filter('Queues','Queues'[IsInbound]=1),FILTER('Interactions','Interactions'[IsAnswered]=1))/SUM('Interactions'[IsAnswered]))

 

Chelsie Eiden's Duration = 
// Duration formatting 
// * @konstatinos 1/25/2016
// * Given a number of seconds, returns a format of "hh:mm:ss"
//
// We start with a duration in number of seconds
VAR Duration = SUM([Duration])
// There are 3,600 seconds in an hour
VAR Hours = INT ( Duration / 3600)
// There are 60 seconds in a minute
VAR Minutes = INT ( MOD( Duration - ( Hours * 3600 ),3600 ) / 60)
// Remaining seconds are the remainder of the seconds divided by 60 after subtracting out the hours 
VAR Seconds = ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 ),3600 ), 60 ),0) // We round up here to get a whole number
RETURN
// We put the hours, minutes and seconds into the proper "place"
Hours * 10000 + Minutes * 100 + Seconds

 

@CarterB13 The key takeaway is that you need to get your duration into the appropriate form and then apply a custom format string.


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

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.