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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.