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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.