Power BI Percent of Total but not Top N

26 Views Asked by At

I am trying to calculate the percentage of premium which should change as I apply slicers on the data. The below formula for a calculated measure works perfectly.

% of 2025P Gross EP = DIVIDE(SUM('Premium'[2025P Gross EP]), CALCULATE(SUM('Premium'[2025P Gross EP]),ALLSELECTED('Premium')),0)

HOWEVER - I want to show only the TOP 5 of a different field ('MIX', that uses % premium). When I use the filter (hidden, locked) it immediately recalculates so the TOP 5 adds to 100% without any slicers, just the top five classes (out of thousands) showing as 100% of the premium (which impacts the result of the 'MIX' field). If I adjust the below formula to be "ALL" instead of "ALLSELECTED" then while my filter for TOP 5 works as needed, my slicers don't affect the premium at all.

Is there a way to work this so I can show TOP 5 without it actually filtering/recalculating my data, but also have that data affected by my slicers?

I tried to use RANKX on the 'MIX' field within the calculation to only pull in the TOP 5 MIX without an outside filter, but it won't give me only top, it gives me every class.

Impact 25P MIX = var MIX = ([% of 2025P Gross EP]-[% of 2024P Gross EP])*[2024P LR] return calculate(MIX, FILTER( VALUES('Calculations'[Class]), RANKX(ALLSELECTED('Calculations'[Class]),ABS(MIX),,desc)<=5 ) )

0

There are 0 best solutions below