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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
AnthonyJoseph
Resolver III
Resolver III

AND logic in a slicer (when multi-selected)

Hi,

 

I am struggling to display category names based on the year slicer. When I select two different years from slicer then table should display the list of common categories that are present in all the selected years. I have pasted the sample data below:

 

CategoryYearunit
Apple2022100
Apple2021200
Apple2020500
Papaya2021100
Papaya202040
Cucumber2022150
Cucumber2021250

 

In this example when I select the year 2021 the output should be all the categories that have year 2021 i.e. Apple, Papaya and Cucumber.

 

When year 2020 and 2021 are selected, then table should be display Apple and Papaya.

 

When year 2022 and 2021 are selected, then table should be display Apple and Cucumber.

 

So basically, based on the years selected my visual should display the list of common categries in a table. 

 

Appreciate any help on how to achieve this.

 

Thanks,

AnthonyJoseph

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1667984468380.png

 

For fun only, a showcase of powerful Excel worksheet formula,

CNENFRNL_0-1667508645932.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1667984468380.png

 

For fun only, a showcase of powerful Excel worksheet formula,

CNENFRNL_0-1667508645932.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL I'm trying to use this logic in another graphs(ex: top 5 common categories in the selected years), which doesnt give the correct output. I guess it might be because of using ALLSELECTED function. I observed that when this calculation is used in graph (not table) by default all values in the year columns are  being considered as selectedvalues i.e. ALLSELECTED function is not keeping fitlers applied, is there any other work around that will work? 

 

Appreciate your inputs.

 

Thanks,

AnthonyJoseph

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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