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
OpenRoad
New Member

Filter Dataset by Secondary Column Only

I'm trying to figure out how to filter a dataset to by a secondary column only.

In Excel the non-optimal workaround is to have two slicers (eg. one for store and one for product and after selecting the store, set the second slicer to select multiple and use a shift click to multi-select all the products then remove the store slicer. In PowerBI the shift click method does not work and the number of products is too large to quickly select by clicking on individually. How can I set it up to filter the dataset by a secondary column only?

For example:

 

Data Table  
   
StoreProductSales
Steve's AutoTires10
Steve's AutoOil4
Rachael's AutoTires9
Rachael's AutoBrakes12
Jeff's AutoBrakes4
Jeff's AutoOil3
   
   
Slicer1  
Steve's Auto<-- Selected Steve's Auto
Rachael's Auto  
Jeff's Auto  
   
   
Resulting Table (Products Steve's Auto Sells)
   
StoreProductSales
Steve's AutoTires10
Steve's AutoOil4
Rachael's AutoTires9
Jeff's AutoOil3

 

Thanks!

4 REPLIES 4
v-jiascu-msft
Employee
Employee

 

Hi, @OpenRoad

 

You could not achieve your goal if you do this in one table. Creating another table would make this easier.

1. Create a new table with only stores. (Copy the table, keep just column STORE, delete duplicates. )

2. Delete the relationship if Power BI creates it automatically.

3. Create a measure like this.

Measure =
IF (
    HASONEVALUE ( 'DataTable2'[Store] ),
    IF (
        MIN ( 'DataTable'[Product] )
            IN CALCULATETABLE (
                VALUES ( 'DataTable'[Product] ),
                FILTER (
                    ALL ( 'DataTable' ),
                    'DataTable'[Store] = VALUES ( DataTable2[Store] )
                )
            ),
        "y",
        BLANK ()
    ),
    0
)

 

Hope this would be a little help.

 

Capture02.JPG 

 

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

@OpenRoad

 

Hi,

 

Did it work? What else can I do for you?

 

Best Regards!

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
OpenRoad
New Member

Also, attempts to use a ALL command on the 'store' column have been met with data type errors.

OpenRoad
New Member

So far I've been able to still return the total number of Product Sales for all Store's while only showing products for the selected store by using Measure = Calculate(sum(Table[Sales]),all(Table[Stores])) but have not been able to have the other relevant Stores appear in the table.

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.