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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.