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

Calculating cross-tabulation in unpivoted table

I have a table of the form: [id, program, enrollment_date] where id is the unique ID of a customer, program is 1 of 12 programs that customer has enrolled in, and enrollment_date is the date that they enrolled. A single customer can be enrolled in multiple programs and that would appear as multiple rows in the table - one for each enrollment date.

 

I'm trying to show (for a given program) how many of its enrollees are also enrolled in the other programs. Something like the following visual but where the cells are a number of customers that enrolled in both of the respective programs. I'm not sure where to start with calculating the cross-membership, let alone the visual I could use. Any help would be much appreciated!

Image result for correlation matrix

1 ACCEPTED SOLUTION

Hi,

 

You may download my PBI file from here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
astotz
Frequent Visitor

Sorry, but I didn't see a way to attach a file to the post. Below is a paste of a small example. There is one record for each unique customer<->program enrollment. Results in this example would be a 3x3 matrix where the cells would be the % of the row enrolled in the column:

 

 P1P2P3
P1100%30%0%
P237.5%100%0%
P30%0%100%

 

 

idprogramdate
1P11/20/2019
2P11/18/2019
3P11/16/2019
4P11/14/2019
5P11/12/2019
6P11/10/2019
7P11/8/2019
8P11/6/2019
9P11/4/2019
10P11/2/2019
11P21/20/2019
12P21/20/2019
13P21/22/2019
14P21/22/2019
15P21/22/2019
3P21/20/2019
4P21/22/2019
5P21/22/2019
16P31/22/2019
17P31/22/2019
18P31/22/2019

 

I appreciate the prompt responses!

Hi,

 

You may download my PBI file from here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Super helpful to see how this was done. You used some patterns I wasn't aware of. Thanks so much!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @astotz,

 

I think matrix visual and r visual will suitable for your requirement, please share some sample data then we can test to create graph.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Share your source data and also show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.