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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
powerbineeded
New Member

Summing the Prices of Common Products Across Different Categories

My data consists of four columns: Supplier, Brand, Product, and Price. Each Supplier has multiple brands (with Brand being unique across all suppliers), and each Brand has multiple products. How can I display only the products that are common across the selected brands when I place Brand in the columns, Product in the rows, and Price in the values?

For example:

  • If I select Brand X and Brand Y, the matrix should only show the products that are available in both Brand X and Brand Y.
  • If I select Brand X and Brand Z, the matrix should only show the products that are available in both Brand X and Brand Z.
  • If I select Brand X, Brand Y, and Brand Z, the matrix should only show the products that are available in all three brands.

In the picture, matrix should only show the 2 common products in red circle.

 

  • Screenshot 2024-12-02 143403.png
  •  
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try creating a measure like

Matches all chosen brands =
VAR NumVisibleBrands =
    CALCULATE (
        COUNTROWS ( VALUES ( 'Table'[Brand] ) ),
        ALLSELECTED ( 'Table'[Brand] ),
        VALUES ( 'Table'[Product] )
    )
VAR NumChosenBrands =
    COUNTROWS ( ALLSELECTED ( 'Table'[Brand] ) )
VAR Result =
    IF ( NumVisibleBrands = NumChosenBrands, 1 )
RETURN
    Result

Add this as a filter to the matrix visual and set it to only show when the value is 1.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-denglli-msft
Community Support
Community Support

Hi @powerbineeded ,

Is my follow-up just to ask if the problem has been solved?
 johnt75's solution worked in my test.

If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?

Thank you very much for your cooperation!

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.

johnt75
Super User
Super User

Try creating a measure like

Matches all chosen brands =
VAR NumVisibleBrands =
    CALCULATE (
        COUNTROWS ( VALUES ( 'Table'[Brand] ) ),
        ALLSELECTED ( 'Table'[Brand] ),
        VALUES ( 'Table'[Product] )
    )
VAR NumChosenBrands =
    COUNTROWS ( ALLSELECTED ( 'Table'[Brand] ) )
VAR Result =
    IF ( NumVisibleBrands = NumChosenBrands, 1 )
RETURN
    Result

Add this as a filter to the matrix visual and set it to only show when the value is 1.

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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