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
Anonymous
Not applicable

Percentile of multiple filtered data

Firstly apologies if this is not clear - first time poster (and very new user!)

 

I have some data (example below) that I am trying to get upper and lower quartiles grouped by person.

 

I've got a matrix table set up which has filters for Group and Type, then I've got a measure set up to calculate the Average, Q1 and Q3 for each person's sales. This works fine when just one type is selected, but if I select more than one type the average still works but the quartile calculations are wrong. It seems to be doing something like calculating the quartile for each person and then adding those together to get the final result rather than calculating the quartile by person

 

Data:

 

TypeNameGroupSales
ApplePeterA177417
AppleJaneA107345
AppleMaryA0
AppleStevenA20960
AppleRebeccaA51420
AppleAndyA24638
AppleKateA0
AppleBevB24359
AppleShaheenB19121
BananaPeterA485971
BananaJaneA77258
BananaMaryA0
BananaStevenA6332
BananaRebeccaA99248
BananaAndyA23550
BananaKateA0
BananaBevB44733
BananaShaheenB260788

 

 

Matrix I have generated (All Groups and Types selected in filter):

 

Name     Sum of Sales

Andy48188
Bev69092
Jane184603
Kate0
Mary0
Peter663388
Rebecca150668
Shaheen279909
Steven27292

 

Q1 of this data set would be 184603, I'm getting something much lower (sorry can't say exactly what as the above is dummy data).

 

Is anyone able to help? I've tried various SUMMARIZE and ALLSELECTED options but am really struggling. 

 

Thank you hugely in advance.

 

Percentile Measure:

 

Quartile 1 = VALUE(PERCENTILE.INC('Table'[Sales],0.75))

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Solved it - I ended up creating two measures as follows:

 

Q1 = PERCENTILEX.INC(VALUES(Table[Name]),CALCULATE(SUM(Table[Sales])),0.75)

 

Average = AVERAGEX(VALUES(Table[Name]),CALCULATE(SUM(Table[Sales])))

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I've just realised that I have the same problem with the Average - I forgot I'd fiddled it as follows:

 

Average = SUM('Table'[Sales])/DISTINCTCOUNT('Table'[Name])

 

So, when I add more than one Type together it is taking the average of the two types e.g. for Peter it is averaging Apple and Banana, and then the value I get is the average of those averages. So the same problem as the percentiles.

 

 

Anonymous
Not applicable

Solved it - I ended up creating two measures as follows:

 

Q1 = PERCENTILEX.INC(VALUES(Table[Name]),CALCULATE(SUM(Table[Sales])),0.75)

 

Average = AVERAGEX(VALUES(Table[Name]),CALCULATE(SUM(Table[Sales])))

Hi Anonymous, 

 

I'm facing same your problem and your answer helped me, but i need one more thing to achive my goal. 

 

%75= PERCENTILEX.INC(VALUES(Product[Productname]),CALCULATE(fact[value]),0.75)
it is working but i need to add ALLSELECTED to this function so this work on all the visable table

Hi @Anonymous,

Glad to hear you have resolved your issue, please mark your workaround as answer, so more people will learn things and get helful information clearly.

Best Regards,
Angelia

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.