Yes, you can do some kind of affinity analysis in Tableau. The link below will get you started. You may need to tweak the approach a little to meet your requirements.
Hope this helps.
I have recently done something similar. See if this can help. You can download the workbook and check the data source set up and calculations I made.
I f you help me with the steps to undertake.
First self join the table.
Now you have two tables in the data pane. Drag and drop Subcategory in the view from each of them.
Create a calc to color the view based.
Set the color.
For label create the calc below.
Put to label and set this as Table(down). You can change this based on your end result.
If that helps, please mark the answer as helpful and correct.
I'd suggest create a mock up data and share along with the end result.