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

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!:
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.