Forum Discussion
ThomasDay
10 years agoImpactful Individual
Percentile category
Hello again, I'm looking to compute the percentile breaks in a visualization (filtered) table dynamically--change the slicer, things change...and then classify each row into a percentile category...
eljustino
10 years agoNew Member
Huh... other than a typo in the VAR UpperMiddle line (missing the PERCENTILEX.INC function), it worked for me with my mini sample version:
Here's the exact version:
PercentileCategory = //find cutoff points for profit margin quartiles VAR LowerMiddle = PERCENTILEX.INC(ALLSELECTED(HOSPITALS[Hospital_Name]), [TotalProfitMargin], 0.25) VAR Middle = PERCENTILEX.INC (ALLSELECTED(HOSPITALS[Hospital_Name]), [TotalProfitMargin], 0.50) Var UpperMiddle = PERCENTILEX.INC (ALLSELECTED(HOSPITALS[Hospital_Name]), [TotalProfitMargin], 0.75) RETURN //do nested if to set the category IF([TotalProfitMargin] < LowerMiddle , "Q1", IF([TotalProfitMargin] < Middle , "Q2", IF([TotalProfitMargin] < UpperMiddle , "Q3", IF([TotalProfitMargin] >= UpperMiddle, "Q4", "NA"))))