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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
alalei
Frequent Visitor

Co-occurrence Matrix

Hi,

I have a table with data showing tests that the transactions hit. The table looks like:

powerbi_a.PNG

 

I want to create a co-ocurrence matrix visual that shows number of transactions for each test pair, like: 

powerbi_b.PNG

 

Anyone know how to achieve this? My original table is a SQL view in an import mode, and it's contains almost 1M rows so the table size is quite large. I hope to not duplicate the table if possible.

5 REPLIES 5
parry2k
Super User
Super User

@alalei very hard to tell why it will not work, can you remove extra columns and stick to the original # of columns, although I don't think it will be the reason though. Do you have any filters on the page? 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@alalei that is correct, coexist name = New table, coexist = original table.  Measures are global to the model, doesn't matter where you put those. 

 

Now, what is not working? Can you give an example with data? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k , the desired matirx for dummy data is shown as expected, but when I apply the same method in real data, the count for each pair is larger than the actual count. My original table has a few more descriptive columns, but the combination of trx id and test name in each row is unique.

alalei
Frequent Visitor

Hi @parry2k ,

 

Thank you so much for the quick response! Would you mind specifing the 'Coexist Name' and 'Coexist'? I replaced 'Coexist Name' with 'newTable' and 'Coexist' with my original table name but didn't get the desired results. Should the meausre be created in the original table?

 

Much appreciated.

alalei

parry2k
Super User
Super User

@alalei you have to create another table with unique values of test name column, it will be a disconnected table in your model. Once the new table is added, in matrix visual, use Test Name on rows from the original table, put Test Name  from this new table onto the columns, and add the following measure on the values:

 

Count Id = 
VAR __RowAndColumnValues = UNION ( VALUES ( 'Coexist Name'[Name] ), VALUES ( Coexist[Name] ) )
VAR __TableWithCount = 
CALCULATETABLE ( 
    SUMMARIZE ( 
        ALLSELECTED ( CoExist ), 
        'Coexist'[Id], 
        "@Cnt", COUNTROWS ( Coexist ) 
    ), 
    TREATAS ( __RowAndColumnValues, Coexist[Name] ) 
)
 RETURN SUMX ( FILTER ( __TableWithCount, [@Cnt] > 1 ), 1 )

 

Here is the output:

parry2k_0-1691972419190.png

 

 

👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.