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
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
Employee
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
Employee
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
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.