Forum Discussion

Pharms's avatar
Pharms
Frequent Visitor
2 years ago
Solved

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 peopl...
  • Fowmy's avatar
    Fowmy
    2 years ago

    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"
        )