Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
WalletMasster
Regular Visitor

Creating a Slicer that filters top 5 and bottom 5 branches

I tried this but it only works for visual that contains branchlocation and profit
Measure 1:

BottomNFilter =
VAR TotalBranches = COUNTROWS(ALL(Geography[BranchLocation]))
VAR BottomN = TotalBranches - [SelectedTopNumber] + 1
RETURN IF([BranchRankByAmount] >= BottomN, 1, 0)
Measure 2:
BranchRankByAmount = IF(HASONEVALUE(Geography[BranchLocation]), RANKX(ALL(Geography[BranchLocation]), [Total Sales],, DESC))
Measure 3:
CombinedFilter =
IF (
    HASONEVALUE('TopN'[Index]),
    IF (
        VALUES('TopN'[Index]) = "Top 5 Branches",
        [Top5Branches],
        [BottomNFilter]
    )
)
Measure 4:
SelectedTopNumber =
IF (
    HASONEVALUE('TopN'[index]),
    SWITCH (
        VALUES('TopN'[index]),
        "Top 5 Branches", 5,
        "Bottom 5 Branches", 5
    ),
    1
)
Measure 5:
Top5Branches = VAR SelectedNumber = [SelectedTopNumber]
RETURN IF([BranchRankByAmount] <= SelectedNumber, 1, 0)
 
i drag combined filter to each of the visual i want the slicer to filter, but it only work for table that shows branchlocation and some other column but lets say i do number of customers by region on a map where the lat and long is based on branch location it does not work,when i choose top 5 it shows all the branches but when i choose bottom 5 the map is empty same for other visuals
1 REPLY 1
some_bih
Super User
Super User

Hi @WalletMasster I understand your slicer selection affect result on different visuals? When you analyze your specific visual, measure and solution (with slicer) working fine? If yes, then create separate pages for different visuals, if it is what is ok for you.

Hope this help.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.