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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

How to filter an orders table by items

Hi, I have a single orders table with 3 fields:

Each row contains a single product, but of course, I can have the same order id with different products

 
Document Number (order id)UPC Code (product id)Amount
1000347037630049202252112
100034703805833349119623
100034703505833349119624
1000347047630049202252112
100034704905833349119654

 

I need to create a slicer letting our sales to filter orders containing one or more products chosen but also showing the whole order content (other products ordered in the same order).

 

The problem is I'm not able to show the entire content of the orders but only the products selected in the slicer.

 

How can I do this?

 

Thank you!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

You need a complex measure selector. It is sort of kind of like Inverse Selector: https://community.powerbi.com/t5/Quick-Measures-Gallery/Inverse-Selector/m-p/648290#M325

 

But, I created a sample file for you attached below that is specific to your case.

 

Create a disconnected table:

Codes = DISTINCT('Table'[UPC Code])
 
Use that for your slicer and then this measure:
Measure =
VAR __Codes = VALUES('Codes'[UPC Code])
VAR __Docs = SELECTCOLUMNS(FILTER(ALL('Table'),[UPC Code] IN __Codes),"__Document Number",[Document Number])
RETURN
IF(MAX([Document Number]) IN __Docs,1,0)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Just try to change the filter from '[Measure is 1' to '[Measure] is 0'.

exclude.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

You need a complex measure selector. It is sort of kind of like Inverse Selector: https://community.powerbi.com/t5/Quick-Measures-Gallery/Inverse-Selector/m-p/648290#M325

 

But, I created a sample file for you attached below that is specific to your case.

 

Create a disconnected table:

Codes = DISTINCT('Table'[UPC Code])
 
Use that for your slicer and then this measure:
Measure =
VAR __Codes = VALUES('Codes'[UPC Code])
VAR __Docs = SELECTCOLUMNS(FILTER(ALL('Table'),[UPC Code] IN __Codes),"__Document Number",[Document Number])
RETURN
IF(MAX([Document Number]) IN __Docs,1,0)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg, thank you for your support

Is it possible to do also the other way around? I'd like to exclude orders containing specific products

 

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Just try to change the filter from '[Measure is 1' to '[Measure] is 0'.

exclude.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors