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
jseow
Frequent Visitor

Counts based on inclusion in paired categories

Hi all,

 

I have a table with test data that looks like:

CategoryContact
A1
A2
A3
A4
B1
B2
B3
C1
C

2

 

I would like to creat some sort of Matrix that looks like:

 ABC
A4  
B33 
C22

2

 

This shows me that there are for example, 3 distinct contacts that have membership in both category A and B, while A/C and BC only have 2 distinct contacts.

 

Long term I would need to scale this up to many categories, so a way to show this without creating a new measure for each pair would be ideal. Would also like to be able to then drill down into the pairings to view contact details for where someone is in both categories.

 

Is this something PBI supports?

 

Thanks,

John

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jseow

 

This calculated table might be close

 

Table 2 = GENERATE(
                    'Table',
                    FILTER(
                        SELECTCOLUMNS(
                            'Table',
                            "CategoryB",[Category],
                            "ContactB",[Contact]),
                        [ContactB]=[Contact])
                        )

It creates a join between categories via the [Contact] column. 

 

You can then [Category] to rows, [CategoryB] to columns and do a disinct count of Contact in the values.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jseow

 

This calculated table might be close

 

Table 2 = GENERATE(
                    'Table',
                    FILTER(
                        SELECTCOLUMNS(
                            'Table',
                            "CategoryB",[Category],
                            "ContactB",[Contact]),
                        [ContactB]=[Contact])
                        )

It creates a join between categories via the [Contact] column. 

 

You can then [Category] to rows, [CategoryB] to columns and do a disinct count of Contact in the values.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks Phil, that seems to definitely work for me!

 

If anyone knows how to create the ability to drill down into the overlap cells in the matrix to view actual contact details, that would also be very helpful!

 

 

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.