Forum Discussion
Anonymous
2 years agoNot applicable
Top N Rank Dynamic Filter Using Field Parameters
Hi all, First time poster here. I've tried searching for answers all over but don't seem to be able to find the exact answer I was looking for. So hoping the DAX gurus here can pass provide some ...
lbendlin
2 years agoSuper User
You're nearly there.
var m = selectedvalue('Date-Reporting Dates'[Reporting Date])
return CALCULATE(
RANKX(
ALLSELECTED('[Dashboard]'[Primary Root Cause Level 0]),
[Count], , DESC),
'Date-Reporting Dates'[Reporting Date]=m)
)
Anonymous
2 years agoNot applicable
Thanks Ibendlin. I've updated the DAX, but nothing appears to have changed. Here's the full formula.
Rank =
VAR _m=SELECTEDVALUE('Date-Reporting Dates'[Reporting Date])
Return
SWITCH(
TRUE(),
SELECTEDVALUE(pBreachesField[pBreachesField Fields])="'[Dashboard] Incidents'[Primary Root Cause Level 0]",
CALCULATE(
RANKX(
ALLSELECTED('[Dashboard] Incidents'[Primary Root Cause Level 0]),
[Count], , DESC),
'Date-Reporting Dates'[Reporting Date]=_m)
,
SELECTEDVALUE(pBreachesField[pBreachesField Fields])="'[Dashboard] Incidents'[Primary Root Cause Level 1]",
CALCULATE(
RANKX(
ALLSELECTED('[Dashboard] Incidents'[Primary Root Cause Level 1]),
[Count], ,DESC),
'Date-Reporting Dates'[Reporting Date]=_m
)
)
If it helps, this is the Dynamic Filter formula used to filter the chart.
Dynamic Filter Top N =
VAR _selectednumber = SELECTEDVALUE('Top N'[Top N])
return
IF(
ISFILTERED('Top N'),
INT(
[Rank] <= _selectednumber
),1
)
- lbendlin2 years agoSuper User
Can you post a sample .pbix ?
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216- Anonymous2 years agoNot applicable
Not sure if this link will work given that it's a work OneDrive link.
- lbendlin2 years agoSuper User
close but it requires authentication. see if you can find a way to share publicly.