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
IHam
Helper III
Helper III

Finding the averages of different halves of a data set

Hi, I wish to find a "trajectory" score for each individual. I have a dataset that has a score recorded for an individual during a particular time. I would like to find the average score for the first half of the data (the values achieved before the median of the time scores) and then the average score for the second half of the data by time. Then find the difference which will be shown in a card after someone is selected by a slicer. The table is called Track Data.

I have tried:

average of first half = calculate(AVERAGE(value),'Track Data'[Number Time]<=median('Track Data'[Number Time]))
I think I can see why this fails but not sure about the fix.
Thanks in advance.
Here is a small sample of the data: 
 
ValuePersonNumber Time
611
9121
5831
2541
5871
3512
3422
1232
8142
662
6133
8343
7553
1763
973
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @IHam ,

 

Let me know if this is what is needed.

 

Create Measures

 

Median = CALCULATE(Median(Table2[Value]), ALLEXCEPT(Table2,Table2[Person]))
Average First HAlf = CALCULATE(AVERAGE(Table2[Value]), FILTER(ALLEXCEPT(Table2,Table2[Person]),Table2[Value] < [Median]))
Average Second HAlf = CALCULATE(AVERAGE(Table2[Value]), FILTER(ALLEXCEPT(Table2,Table2[Person]),Table2[Value] >= [Median]))
Divide Val = DIVIDE([Average First HAlf],[Average Second HAlf],0)

 

1.JPG

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @IHam ,

 

Let me know if this is what is needed.

 

Create Measures

 

Median = CALCULATE(Median(Table2[Value]), ALLEXCEPT(Table2,Table2[Person]))
Average First HAlf = CALCULATE(AVERAGE(Table2[Value]), FILTER(ALLEXCEPT(Table2,Table2[Person]),Table2[Value] < [Median]))
Average Second HAlf = CALCULATE(AVERAGE(Table2[Value]), FILTER(ALLEXCEPT(Table2,Table2[Person]),Table2[Value] >= [Median]))
Divide Val = DIVIDE([Average First HAlf],[Average Second HAlf],0)

 

1.JPG

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Many thanks, it needed a bit of switching as the median is of the number time and the average is of the value. But once that is changed it works - thanks for your help, and I see what's going on now.

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.