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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jaliu1290
Frequent Visitor

Return all values NOT related to sliced value

Hello Power BI community!

 

I have a table called Dataset:

LocationProduct
TorontoABC
TorontoDEF
TorontoHIJ
CalgaryABC
CalgaryDEF
VancouverHIJ

 

On a page, I would like to insert a slicer by Location and return 2 tables:

Table 1 should return all Product related to sliced Location.

Table 2 should return entire list of Product, EXCEPT Product that is related to sliced location.

 

So for example, if I slice by Calgary:
Table 1 should return ABC, DEF
Table 2 should return HIJ

If I slice by Toronto:

Table 1 should return ABC, DEF, HIJ
Table 2 should return (blank)

 

If I slice by Vancouver:

Table 1 should return HIJ
Table 2 should return ABC, DEF

 

How do I create Table 2??

 

Thank you in advance!

4 REPLIES 4
Kedar_Pande
Community Champion
Community Champion

@jaliu1290 

Create Table 1 Measure

ProductsInLocation = 
CALCULATETABLE(
VALUES(Dataset[Product]),
ALL(Dataset),
TREATAS(VALUES(Dataset[Location]), Dataset[Location])
)

Create Table 2 Measure

ProductsNotInLocation = 
EXCEPT(
VALUES(Dataset[Product]),
[ProductsInLocation]
)

This setup ensures that Table 1 shows the sliced products, while Table 2 shows all other products.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

If this helped, please give Kudos or mark it as a Solution .
Best regards,
Kedar
Connect on LinkedIn
v-denglli-msft
Community Support
Community Support

Thanks for the reply from MattAllington and rohit1991, please allow me to provide another insight.
Hi @jaliu1290 ,

Please refers to the following steps.
Create a calculated table that derives from the product field.

vdengllimsft_0-1734922457917.png


Create the following measure to flag unrelated products.

Measure = 
IF (
    SELECTEDVALUE ( 'Table'[Location] ) <> BLANK (),
    CALCULATE (
        COUNTROWS ( 'Product' ),
        KEEPFILTERS ( NOT 'Product'[Product] IN VALUES ( 'Table'[Product] ) )
    ),
    1
)

 

Use the calculated table field to create a table visual. Then add the measure to the visual level filter with the setting is 1. The final result is as follows.

vdengllimsft_1-1734922785228.png


Please see the attached pbix file for reference.

Best Regards,
Dengliang Li

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

rohit1991
Resolver III
Resolver III

To achieve this:

  1. Table 1: Use default filtering; add a slicer for Location and display Product. It will show products related to the selected location.

  2. Table 2: Create a calculated table with this DAX:
    Table2 =EXCEPT(VALUES(Dataset[Product]),CALCULATETABLE(VALUES(Dataset[Product]),Dataset[Location] IN VALUES(Dataset[Location])))

MattAllington
Community Champion
Community Champion

I wrote an article about this a few years ago. 
https://exceleratorbi.com.au/items-not-selected-slicer/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.