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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors