Forum Discussion

GCC's avatar
GCC
Frequent Visitor
7 years ago
Solved

Analysis scenario

Hello, I'm relatively new to Power BI and am struggling with an analysis scenario and wondering if anyone has a suggestion on how to handle it. I've detailed my calculation steps below which are ba...
  • v-cherch-msft's avatar
    7 years ago

    Hi GCC 

    You may try below measures.

    Step1 = COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[School]=MAX('Table'[School])))
    Step3_rank = RANKX(FILTER(ALLSELECTED('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[School]=MAX('Table'[School])),CALCULATE(SUM('Table'[cum_total_tariff_pts])),,ASC,Skip)
    Lowest 20% avg = CALCULATE(AVERAGE('Table'[cum_total_tariff_pts]),FILTER(ALLSELECTED('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[School]=MAX('Table'[School])&&[Step3_rank]<=[Step1]*0.2))
    Middle 60% avg = CALCULATE(AVERAGE('Table'[cum_total_tariff_pts]),FILTER(ALLSELECTED('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[School]=MAX('Table'[School])&&[Step3_rank]<=[Step1]*0.2+[Step1]*0.6&&[Step3_rank]>[Step1]*0.2))
    Top 20% avg = CALCULATE(AVERAGE('Table'[cum_total_tariff_pts]),FILTER(ALLSELECTED('Table'),'Table'[Year]=MAX('Table'[Year])&&'Table'[School]=MAX('Table'[School])&&[Step3_rank]>[Step1]*0.2+[Step1]*0.6))

    Regards,