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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Calculate Top Quartile with filter

Hi All, 

 

I am trying to calculate the Top Quartile of data with a filter applied. 

A subset of data looks like this: 

YearSchoolResponsesQ5
2019School 1941688.22
2019School 2909988.38
2019School 3777892.33
2019School 4757286.31
2019School 5755188.83
2019School 6653185.17
2019School 7591986.00
2019School 8587091.05
2019School 9503689.00
2019School 10450188.23
2019School 11411387.60
2019School 12402588.50
2019School 13387290.62
2019School 14362992.41
2019School 15338786.24
2019School 16318490.53
2019School 17297993.45
2019School 189878.59
2019School 199794.47
2019School 209088.77
2019School 214781.81
2019School 224580.32
2019School 233489.49

 

I am using the following formula

 

Top_Quartile_School = 
    PERCENTILEX.INC(
    ALLSELECTED(Table[School]),
        [Q5],
        .75)

 

This works generally, however I need to be able to filter and calculate the Top Quartile where responses >100 and I cant seem to build this into the measure and get it to work.

 

Notes:

I need to do this as a measure rather than create another table as I have other dashboard filters. 

Both Responses and Q5 are measures

 

I have had a look at this thread: https://community.powerbi.com/t5/Desktop/PERCENTILE-inside-CALCULATE-does-not-anymore-recognise-data... but I cant quite figure out how to get it to work. 

 

Thanks for any help

4 REPLIES 4
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create a simple table to test:

61.PNG

Responses = SUM(School[Res])
Q5 = SUM(School[Students])/CALCULATE(SUM(School[Students]),ALLSELECTED(School))

Please try this measure:

Top_Quartile_School = RANKX(GROUPBY(ALLSELECTED('School'),'School'[Year],School[School]),[Q5],CALCULATE([Q5]))

Then apply filter to the table visual, and it shows schools' rank:

62.PNG

Later, you can filter any number of top rank you want.

 

Hope this helps.

 

Best Regards,

Giotto Zhi

 

Anonymous
Not applicable

Thanks @v-gizhi-msft  this is great and I will most certainly use this somewhere in the report. 

I want to be able to calculate the top quartile of Q5 records with more than 100 responses dynamically if possible though as I need to create a visual (a lolipop graph) that shows the gap to the top quartile for each school. Is there a way to do this with percentile.inc?

amitchandak
Super User
Super User

Anonymous
Not applicable

Thanks @amitchandak neither of those solutions are applicable I dont think. I want to handle it within a measure and filter to >100 responses. 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.