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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Average of Measure

Hi all.

 

First or all, let me tell you that I went through several posts with similar questions but I couldn't solve the issue anyway. So I am seeking for help here. And I am coming back to PowerBI after some months of travelling so I am not at my best shape Smiley Happy

 

I am working with data about vehicle trips. Each vehicle only does one trip per day. Each trip might have several stops, hence the multiple start and end times for each vehicle per day.

 

I want to get info about the average trip time, average stop time, stops per tripaverage stops per trip, all of this per vehicle and per day.

 

I am working with a set of data that looks like this:

Capture.PNG

 

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

First question: is is well processed? Should I use another structure? This structure confuses me to be honest.

 

So far, I could only work on the trip time. I created this measure: TripLengthHours = DATEDIFF(MIN(Trips[TripStartTime]),MAX(Trips[TripEndTime]),SECOND)/3600

 

For individual values, it works good, but on a matrix, the Total values obviously go mad:

 

Capture.PNG

 

 

 

 

 

 

Second question: what is wrong with the measure or the thinking (probably a lot)?

 

Third question: could you help me with the remaining values I am looking for?

 

Thanks a lot in advance.

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may try a similar way as shown here.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may try a similar way as shown here.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Works like a charm, thank you.

 

In the meantime, I am trying to improve the file for the other calculations, could you take a look at this please?

 

https://community.powerbi.com/t5/Desktop/Calculation-over-rows-with-condition/td-p/325152

 

Thanks again!

Anonymous
Not applicable

Capture.PNG

Some improvising?

 

I'm trying Smiley Very Happy

 

TripLengthHours = DATEDIFF(
CALCULATE(MIN(Trips[Value]),Trips[Attribute]="TripStartTime"),
CALCULATE(MAX(Trips[Value]),Trips[Attribute]="TripEndTime"),
SECOND)/3600

 

Same problem, of course.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.