Forum Discussion
Anonymous
6 years agoNot applicable
Top N Filter doesn't work (with examples)
Hi everyone¡ due to the good help I received with my previous problem with PowerBI, I have decided to ask for help again. I want to filter the entire page by the Top N Managers...
DataZoe
6 years agoMicrosoft Employee
Anonymous I actually did a presentation on how to do this a couple months ago, it may help you with your solution.
My solution is actually a top/bottom x (shows top x and bottom x on the same chart) but can easily be modified to do only top x.
This is the ranking measure:
Rank (Desc) of Managers by Value =
IF (
ISBLANK ( [Value] ),
BLANK (),
RANKX (
FILTER (
ALLSELECTED ( Datos[Manager] ),
ISBLANK ( [Value] ) = FALSE ()
),
[Value],
,
DESC,
DENSE
)
)
and then you create a flag measure to work with your selected "X":
Rank Flag for Value =
IF (
ISBLANK ( [Value] ),
BLANK (),
IF (
[Rank (Desc) of Managers by Value] <= [Selected N]),
1,
0
)
)
Then you put the [Rank Flag for Value] as a FILTER FOR THIS VISUAL on the bar chart visuals.
This is also shown here: https://community.powerbi.com/t5/Data-Stories-Gallery/Executive-Insights-by-Decisive-Data/m-p/181742