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
Anonymous
Not applicable

Counting similar values on different columns to create a matrix

It is the first question I have ever posted here. I spend a long time trying to find an answer; however, I haven't got anything yet. It is an easy question, but I really stuck with it. I would appreciate it if anyone could help me.

 

I have a rank 1, 2, and 3 of products (A, B, C) in their different columns as in the table below;

 

Post AreaRank 1Rank 2Rank 3
EACB
NCBA
SEBAC
NWBAC
SWCBA
WCBA
RMABC
IGACB
CRCBA
HABCA
ENBAC
UBBAC
DABAC
TWBCA
BBCA
LUABC

 

I need to count the number of products in each column and create a matrix on my dashboard such as this.

 

 Rank 1 CountRank 2 CountRank 3 Count
A457
C457
B862

 

How can I achieve this task in pbi?

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

Yes, a calculated table is in the model, so it cannot be seen in Power Query Editor. But based on your calculated table, you can create measures to get the count results. I have created a sample file attached at bottom. Hope it is helpful. 

vjingzhang_0-1669887995825.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you very much for your answer, @v-jingzhang, but the rank columns are part of a big table and result from measures. However, I created a rank table in PBI to follow your instruction, but it looks created tables are not being transformed in the power query.

Hi @Anonymous 

 

Yes, a calculated table is in the model, so it cannot be seen in Power Query Editor. But based on your calculated table, you can create measures to get the count results. I have created a sample file attached at bottom. Hope it is helpful. 

vjingzhang_0-1669887995825.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Anonymous
Not applicable

Thanks a lot, @v-jingzhang; this worked for the case.

v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

The current table format is not friendly for a matrix visual, so you need to transform it in Power Query Editor first. Click "Transform data" to open Power Query Editor, select Rank1, Rank2, Rank3 columns (hold on Shift key to select multiple columns), right click on the column header and select "Unpivot Columns" option.

vjingzhang_0-1669258240292.png

 

You will get the following table. Click "Close & Apply" to apply this table to Power BI Desktop.

vjingzhang_1-1669258462784.png

 

Then add a matrix visual. Use "Value" on Rows, "Attribute" on Columns, "Post Area" on Values with "Count" aggregation type. 

vjingzhang_2-1669258628320.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.