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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Pharms
Frequent Visitor

Ranking averages into quartiles

Hello

Can't find quite what I am after in other posts. The scenario is I have about 50 people each with a result in a variety of subjects, at different points in time. I would like to rank the people into quartiles based on their average over the subjects. The data looks something like this

Pharms_0-1702218936014.png

Currently in excel where the owner averages and then ranks, then manually assigns quartiles. This data will soon be in a SQL server and I have been asked to automate this process. It will be a card filtered by the individual so I can assign a Term filter to the visual, but struggling with the quartiling by average of results.

 

Hope I am being clear enough and many thanks for any advice in advance. 

1 ACCEPTED SOLUTION

@Pharms 

Please find attached the file with the expected outcome:

Quartile = 

VAR __Avg = [Student Average]
VAR __Q1  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.25  )
VAR __Q2  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.50  )
VAR __Q3  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.75  )
RETURN
    SWITCH(
        TRUE(),
        __Avg > 0 && __Avg <= __Q1 , "Q1",
        __Avg > 0 && __Avg <= __Q2, "Q2",
        __Avg > 0 && __Avg <= __Q3 , "Q3",
         "Q4"
    )

Fowmy_0-1702323954952.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Pharms
Frequent Visitor

PupilSubjectTermResult  PupilAverageQuartile   
AMT22English80  A76.3Q4 Q142.3
BMT22English85  B72.0Q3 Q260.75
CMT22English71  C76.0Q4 Q374
DMT22English33  D43.0Q2   
EMT22English35  E57.9Q2   
FMT22English67  F63.6Q3   
GMT22English50  G41.6Q1   
HMT22English84  H64.4Q3   
AMT22Maths66.23        
BMT22Maths59.07        
CMT22Maths78.76        
DMT22Maths63        
EMT22Maths57        
FMT22Maths57        
GMT22Maths41        
HMT22Maths61        
AMT22French72        
BMT22French76        
CMT22French66        
DMT22French62        
EMT22French48        
FMT22French76        
GMT22French60        
HMT22French54        
AMT22Chemistry62        
BMT22Chemistry69        
CMT22Chemistry74        
DMT22Chemistry26        
EMT22Chemistry38        
FMT22Chemistry59        
GMT22Chemistry33        
HMT22Chemistry64        
AMT22Geography85        
BMT22Geography75        
CMT22Geography90        
DMT22Geography48        
EMT22Geography61        
FMT22Geography68        
GMT22Geography40        
HMT22Geography83        
AMT22History79        
BMT22History68        
CMT22History82        
DMT22History32        
EMT22History79        
FMT22History66        
GMT22History21        
HMT22History63        
AMT22Physics71        
BMT22Physics71        
CMT22Physics86        
DMT22Physics31        
EMT22Physics62        
FMT22Physics50        
GMT22Physics41        
HMT22Physics60        
AMT22Religious Studies86        
BMT22Religious Studies77        
CMT22Religious Studies80        
DMT22Religious Studies28        
EMT22Religious Studies55        
FMT22Religious Studies53        
GMT22Religious Studies32        
HMT22Religious Studies73        
AMT22Spanish86        
BMT22Spanish68        
CMT22Spanish56        
DMT22Spanish64        
EMT22Spanish86        
FMT22Spanish76        
GMT22Spanish56        
HMT22Spanish38        

 

Hi @Fowmy Is this what you mean? I have trimmed it down.

 

I have created a card easily enough to simply display one pupil's results average using slicers and filters.

 

I would like BI to tell me what quartile that average sits in based on the all the individual averages in the group. The table on the left is the raw data, the two smaller tables I calculated.

@Pharms 

Please find attached the file with the expected outcome:

Quartile = 

VAR __Avg = [Student Average]
VAR __Q1  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.25  )
VAR __Q2  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.50  )
VAR __Q3  =  PERCENTILEX.EXC( ALLSELECTED( 'Table'[Pupil]) , [Student Average] , 0.75  )
RETURN
    SWITCH(
        TRUE(),
        __Avg > 0 && __Avg <= __Q1 , "Q1",
        __Avg > 0 && __Avg <= __Q2, "Q2",
        __Avg > 0 && __Avg <= __Q3 , "Q3",
         "Q4"
    )

Fowmy_0-1702323954952.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@Pharms 

Could you share the expected result in Excel as you have share the source data?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.