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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. 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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors