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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
alalei
Frequent Visitor

Need help - Matrix Visual

Hi community,

 

I have a table with customer ID, product code, and product group data. The combination of customer ID and Product Code in each row is unique. The table looks like this:

powerbi_a.PNG

 

I want to create a matrix visual to show the number of customers for each pair of group I product and group II product. The desired table looks like this:
Before expand

powerbi_b.PNG

After expand
powerbi_c.PNG

 

Can anyone help me achieve this please?

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, I am not sure if I understood your question correctly, but please check the below.

For now, the total shows 6, but if you have different business logic please describe what number needs to be shown as a total.

Jihwan_Kim_0-1691987301598.png

 

 

expected result measure: = 
VAR _codelist =
    VALUES ( 'Product'[Product code] )
VAR _brandlist =
    VALUES ( 'Product'[Product brand] )
VAR _customerID =
    SUMMARIZE (
        FILTER ( Data, Data[Product Code] IN _codelist ),
        Data[Customer ID]
    )
VAR _result =
    COUNTROWS (
        FILTER (
            Data,
            Data[Customer ID]
                IN _customerID
                    && Data[Product Code] IN _brandlist
        )
    )
RETURN
    _result

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim , thank you for your solution! I'm envisioning the total to be 9 (3+3+2+1) as:
customer 2: ac, bc

customer 3: ad

customer 4: ac, ad

customer 5: ac, ad, bc, bd
Also, I have another table visual showing the customer ID, Product Code in Data table. When I click the row in the matrix, I want my table visual to be updated based on my selection. For example, when I click 3 on the second row of my matrix (i.e., ac pair), I want to see the three records in the table visual.

Could you please provide any guidance on this?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.