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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jernbanen
New Member

DAX calculation.

I have a report created from different data tables showing train traffic data like this. I need help for 2 issues: 1) How do I make the arrive_delay column to show times as hh:mm:ss instead of as decimal numbers. 2) I need a calculation or a measure that shows in % how many of each days total counted arrives are more than 3:00 minutes delayed and a calculation of the average delay of these delayed arrivals.

 

Can anyone help me making these calculations or measures?

 

27-01-2019 12.38 Office Lens.jpeg

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

For the first one, there is a blog article here:

https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

 

And a quick measure:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Seconds-2-HHMMSS/m-p/195615

 

For the second one, you are going to need the reverse, convert your hhmmss times to seconds probably.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/342279


@ 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...

View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@jernbanen

 

For the first issue, you just need to change the format. No matter you create a column or measure.

 

differnce = Sheet1[real]-Sheet1[schedule]

c1.JPG

 

 

difference2 = sum(Sheet1[real])-SUM(Sheet1[schedule])

Capture.JPG

 

for the second issue,you can try below coding

count% = 
DIVIDE( CALCULATE(COUNT(Sheet1[schedule]),FILTER(Sheet1,Sheet1[differnce]*86400>180)),COUNT(Sheet1[schedule]))

c.JPG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Greg_Deckler
Super User
Super User

For the first one, there is a blog article here:

https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

 

And a quick measure:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Seconds-2-HHMMSS/m-p/195615

 

For the second one, you are going to need the reverse, convert your hhmmss times to seconds probably.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/342279


@ 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.