Forum Discussion

joshuar's avatar
joshuar
Frequent Visitor
4 years ago
Solved

Using Percentiles Based On Column

I am trying to do a percentile calculation based on what customer segment(group) that a customer is in. I have a column that corresponds to the customer ID and reflects what segment they are in.   ...
  • v-zhangti's avatar
    4 years ago

    Hi, joshuar 

     

    First of all, the output result you gave about C should be wrong, correct as shown in the figure.

    Second, if you want to calculate by group, you can change the formula PERCENTILEX.INC.

    PERCENTILEX.INC function (DAX) - DAX | Microsoft Learn

     

    Measure = SWITCH(
    TRUE(),
    MAX('RFM Table'[F Value])<= PERCENTILEX.INC(FILTER(ALL('RFM Table'),[Customer Group]=SELECTEDVALUE('RFM Table'[Customer Group])),[F Value],0.2), "1",
    MAX('RFM Table'[F Value])<= PERCENTILEX.INC(FILTER(ALL('RFM Table'),[Customer Group]=SELECTEDVALUE('RFM Table'[Customer Group])),[F Value], 0.40 ), "2",
    MAX('RFM Table'[F Value])<= PERCENTILEX.INC(FILTER(ALL('RFM Table'),[Customer Group]=SELECTEDVALUE('RFM Table'[Customer Group])),[F Value], 0.60 ), "3",
    MAX('RFM Table'[F Value])<= PERCENTILEX.INC(FILTER(ALL('RFM Table'),[Customer Group]=SELECTEDVALUE('RFM Table'[Customer Group])),[F Value],0.80 ), "4", "5")

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.