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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

How to List All Products Listed Under a Category by Filtering a Product.

 

Hi, 

I am trying to work out a simple logic in Power BI. I have simple model, a product is linked to category with sales number.

If a user filters a product, i want to list out all the products related the category of the "product selected" and the sales amount. I have uploaded an image of the dummy wireframe to illustrate what i aim to do. 

I would appreciate , if you could help. thanks 

list_allproductsofacategory.PNG

 

thanks 

1 ACCEPTED SOLUTION

@Anonymous 

For @v-lili6-msft  solution to work you need to add a disconnected table of the list of products.

Product Selection = DISTINCT ( 'Product'[ProductName] )

That is the list that the users will pick from.  Then the measure will pick up the product selected, apply that filter to get the category and calc the amount for everything in that category.

Sales Filtered = 
VAR _SelectedCategory =
    CALCULATETABLE (
        VALUES ( Category[Category] ),
        FILTER (
            ALL ( 'Product' ),
            'Product'[ProductName] IN VALUES ( 'Product Selection'[ProductName] )
        )
    )
RETURN
    CALCULATE (
        SUM ( Sales[Amt] ),
        FILTER ( Category, Category[Category] IN _SelectedCategory )
    )

ListAllProducts.jpg

I have updated your sample .pbix with the measures.  https://www.dropbox.com/s/z1e2auo1176z6r5/list_allproductsofacategory.pbix?dl=0

Please mark the post from @v-lili6-msft  as the solution.

View solution in original post

13 REPLIES 13
jdbuchanan71
Super User
Super User

You could set the slicer interaction to not apply to the visuals you don't want filtered.

jdbuchanan71
Super User
Super User

@Omar_Sek 

If the product table was connected it would filter the rows that are returned to the 

SUM ( Sales[Amt] )

 The disconnected table lets us read the user selection then build the list of categories and apply that list as our filter.

@jdbuchanan71  thanks , i start using the disconnected table for filter but I find some difficulties especially when I have in a page several visualizations, I must make for each visualization these measures and often it is complicated as this example:
I have a list of factories, each factory belongs to a group.
I use a diconnected table for the filters, this table contains the list of factories.
I filter on a factory and I would like to display on map all factories that belong to the same cluster.

Hi! I encountered exactly the same problem. Once the disconnected table is created and applied to the slicer, the other visuals are affected. Did you find a solution? Thank you

Omar_Sek
Frequent Visitor

@jdbuchanan71 @v-lili6-msft  

I had the same a problem , this solution works well for me, 

but my question : why we have to use a disconnected table for the filter ? 

Omar_Sek
Frequent Visitor

I have a same a problem , the solution work very well but I have a question : why we have to use a disconnected table for the filter ? 

v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

For your requirement, you couldn't create a relationship between table1 and table2, or you could use a separate table for slicer.

 

Then create a measure by this formula

Measure = 
VAR _category =
    CALCULATETABLE (
        VALUES ( Table2[Category] ),
        FILTER ( ALL ( Table2 ), Table2[ProductName] IN VALUES ( Table1[ProductName] ) )
    )
RETURN
    CALCULATE (
        SUM ( Table2[Amt] ),
        FILTER ( Table2, Table2[Category] IN _category )
    )

Result:

6.JPG

 

and here is sample pbix file, please try it.

By the way, if you want to upload the file, You need to upload it to OneDrive and post the link here. Do mask sensitive data before uploading.

 

 

Best Regards,

Lin

 

 

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

Thanks for the reply.  I have attached the pbix file now. The tables are related, i can see your solution working when the table is not joined but it doesnt work when the tables are with relationship. 

 

regards

Anbu 

 

How to List All Products Listed Under a Category by Filtering a Product- DEMO

@Anonymous 

For @v-lili6-msft  solution to work you need to add a disconnected table of the list of products.

Product Selection = DISTINCT ( 'Product'[ProductName] )

That is the list that the users will pick from.  Then the measure will pick up the product selected, apply that filter to get the category and calc the amount for everything in that category.

Sales Filtered = 
VAR _SelectedCategory =
    CALCULATETABLE (
        VALUES ( Category[Category] ),
        FILTER (
            ALL ( 'Product' ),
            'Product'[ProductName] IN VALUES ( 'Product Selection'[ProductName] )
        )
    )
RETURN
    CALCULATE (
        SUM ( Sales[Amt] ),
        FILTER ( Category, Category[Category] IN _SelectedCategory )
    )

ListAllProducts.jpg

I have updated your sample .pbix with the measures.  https://www.dropbox.com/s/z1e2auo1176z6r5/list_allproductsofacategory.pbix?dl=0

Please mark the post from @v-lili6-msft  as the solution.

Hi! Thank you a lot for your solution. I applied it to my case (select one city and show the data for the whole province) and find it really helpful. But when I 

Product Selection = DISTINCT ( 'Product'[ProductName] )

apply this Product Selection to the slicer, my other charts are affected by this. Because I just want  one chart to realize this functuion to show the data of all the cities of the corresponding province, while the other charts( pie chart and so on) continuouly show the data of this selected city.  Do you have some ideas?  

Anonymous
Not applicable

Thanks  I was eagerly waiting for your reply.  I will try this out now. 🙂 

Anonymous
Not applicable

Hey @Anonymous 

As far as I unerstand, you need to create a connection in the model between the tables.

Then the filteration will work.

Please share your PBIX if not resolved.

Cheers!
A

Anonymous
Not applicable

Thanks, how do we upload the pbix file here, i cannot see any file upload option. 

 

regards

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.