Forum Discussion
Power BI - Ranking on a Matrix Visual
Tried your above suggestions, makes no difference. I don't believe that the issue lies with my DAX as from the first Screenshot you can see my Rank Measure works fine when I'm using the Expand down all level hierarchy.
However just using the + icon to expand from parent level thats not showing correctly as per my second screenshot.
try this one.
Rank =
VAR CurrentLevel =
SWITCH(
TRUE,
ISINSCOPE('Customer GP Data'[New MF Code & Parent Name]), 1,
ISINSCOPE('Customer GP Data'[Customer Name & Code]), 2,
BLANK()
)
VAR CurrentParent = SELECTEDVALUE('Customer GP Data'[New MF Code & Parent Name])
VAR ParentRank =
IF(
CurrentLevel = 1,
RANKX(
ALL('Customer GP Data'[New MF Code & Parent Name]),
CALCULATE(SUM('Customer GP Data'[Total Est GP])),
,
DESC,
Dense
),
BLANK()
)
VAR ChildRank =
IF(
CurrentLevel = 2,
RANKX(
FILTER(
ALL('Customer GP Data'[Customer Name & Code]),
'Customer GP Data'[New MF Code & Parent Name] = CurrentParent
),
CALCULATE(SUM('Customer GP Data'[Total Est GP])),
,
DESC,
Dense
),
BLANK()
)
RETURN
SWITCH(
TRUE,
NOT(ISBLANK(ParentRank)), ParentRank,
NOT(ISBLANK(ChildRank)), ChildRank,
BLANK()
)