combinations of items report

combinations of items report

I am trying to build a report and I'm a bit stuck. I will try to simplify the example of what I'm trying to do, I wonder if someone may be able to help me.

So I have a table looking like something like this:

ID            Product
1                  A
1                  B
1                  D
2                  B
2                  C
3                  A
4                  A     
4                  C
4                  D
4                  E

So a report would show, for each product, the number of unique IDs that contain other products. Not sure if I'm making any sense, but something like "IDs that contain Product A contain 1 Product B, 1 Product C, 2 Product Ds and 1 Product E"

So the result table may look like:

A B C D E
A 3 1 1 2 1
B 1 2 1 1 0
C 1 1 2 1 1
D 2 1 1 2 1
E 1 0 1 1 1

Or maybe something like:

A A 3
B 1
C 1
D 2
E 1
B A 1
B 2
C 1
D 1
E 0
C A 1
B 1
C 2
D 1
E 1
D A 2
B 1
C 1
D 2
E 1
E A 1
B 0
C 1
D 1
E 1

Now I know I perhaps overly complicated it but in general, for every product, I would need only IDs that contain that product, then summary of unique ID counts by each product?