'Calculate Percentiles Using Two Variables
I have created a percentile measure in my data using one column of data (ENGAGED_DAYS) but where more than one person has the same value (i.e. PERSON_CODE 2 and 3) I'd like to use another column as a tie-breaker (REQUEST_PER_ACTIVE_DAY).
The data looks like this... |COURSE_CODE|PERSON_CODE|ENGAGED_DAYS|REQUESTS_PER_ACTIVE_DAY| |-----------|-----------|------------|-----------------------| |MATHS101 |1 |10 |15 | |MATHS101 |2 |15 |11 | |MATHS101 |3 |15 |17 | |MATHS101 |4 |20 |10 |
SORRY - CAN'T GET THE TABLE TO RENDER CORRECTLY
I created this measure...
EngDays = SUM('All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE'[ENGAGED_DAYS])
And this is the measure I created which calulates the percentile based on ENGAGED_DAYS only....
Course_Activity_Percentile =
VAR EngDays =
[EngDays]
RETURN
IF(
HASONEVALUE('All Faculty Course Activity Percentile 2022-04-04 - NO
PERCENTILE'[PERSON_CODE]),
COALESCE(
DIVIDE(
--Numerator (below) counts values that are < the students's active day count in the course
CALCULATE(
COUNTROWS('All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE'),
FILTER(
ALLEXCEPT('All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE','All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE'[CANVAS_COURSE_CODE]),
'All Faculty Course Activity Percentile 2022-04-04 - NO
PERCENTILE'[ENGAGED_DAYS] < EngDays
)
),
--Denominator (below) counts the total students in the course
CALCULATE(
COUNTROWS('All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE'),
ALLEXCEPT('All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE','All Faculty Course Activity Percentile 2022-04-04 - NO PERCENTILE'[CANVAS_COURSE_CODE])
)
),
0
)
)
Can anyone help me to incorporate this additional factor into the calculation.
Thanks very much for your help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
