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
Anonymous
Not applicable

Filter Data across an id column using logic with multiple slicers

Hi All, 

I am wondering if this is possible.
I have some product data associated with Ids and the goal is to let users filter for ids where there is a corresponding product mix across those ids.

Sample Data

IdProduct
1a
1b
1e
2a
2b
2c
3a
3c
3e
4d
4e
4f
5g
5h
5i

 

I would like to utilize two slicers the user can pick ids from to filter the data to return ids where any value from slicer 1 is found and any value from slicer 2 is found. Example here would be Id has any product from slicer 1 AND any product from slicer 2

 

has any ofand has any of 
slicer1slicer2
ae
b 
c 
d 

 

to return something like this

 

IdHas Product Mix
1yes
3yes
4yes


Any Help is appreciated and thank you for your time.

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Anonymous ,

Please create 2 new tables:

Table 2 = DISTINCT('Table'[Product])
Table 3 = DISTINCT('Table'[Product])

Then use them to create two slicers.

vcgaomsft_0-1669788864278.png

Then create a new measure:

Measure = 
VAR _table1 = CALCULATETABLE(VALUES('Table'[Id]),'Table'[Product] IN ALLSELECTED('Table 2'[Product]))
VAR _table2 = CALCULATETABLE(VALUES('Table'[Id]),'Table'[Product] IN ALLSELECTED('Table 3'[Product]))
VAR _table3 = INTERSECT(_table1,_table2)
VAR _result = IF(MAX('Table'[Id]) IN _table3,"YES")
RETURN
_result

Result;

vcgaomsft_1-1669788969677.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Anonymous ,

Please create 2 new tables:

Table 2 = DISTINCT('Table'[Product])
Table 3 = DISTINCT('Table'[Product])

Then use them to create two slicers.

vcgaomsft_0-1669788864278.png

Then create a new measure:

Measure = 
VAR _table1 = CALCULATETABLE(VALUES('Table'[Id]),'Table'[Product] IN ALLSELECTED('Table 2'[Product]))
VAR _table2 = CALCULATETABLE(VALUES('Table'[Id]),'Table'[Product] IN ALLSELECTED('Table 3'[Product]))
VAR _table3 = INTERSECT(_table1,_table2)
VAR _result = IF(MAX('Table'[Id]) IN _table3,"YES")
RETURN
_result

Result;

vcgaomsft_1-1669788969677.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

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