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
Nosh10
Helper II
Helper II

Count and Group Multiple Columns

Hello, 

 

I have not been able to find an answer to this question and hope someone can help me out. Thank you. 

 

 I have the following data. 

Gender Group 1Gender Group 2Gender Group 3
FFM
FFM
MFF
MFF
MMF

 

I would like to create a pie chart that shows two categories "M" and "F" across three columns and the total number of males and females for each category. For example Pie chart shows M = 6 and F = 9. Is this possible in PBI? Thank you. 

 

Thank you. 

 

1 ACCEPTED SOLUTION
BI_Jo
Resolver III
Resolver III

Hi,

 

To achieve this you can unpivot the table in Power Query Editor:

 

1. Highlight the 3 columns and use the 'unpivot columns' button in the 'transform' menu:

2. Add a new column called something like 'count' and add the value 1 to each row

 

3. Set the new column format to 'whole number'

4. You can now create a pie chart like this, setting the 'count' column as the value and the male/female column as the legend:

BI_Jo_0-1604622275021.png

Hope this helps.

 

Jo

View solution in original post

3 REPLIES 3
camargos88
Community Champion
Community Champion

@Nosh10 ,

 

Check the attached file.

 

I've unpivoted the table, like:

Capture.PNG

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



BI_Jo
Resolver III
Resolver III

Hi,

 

To achieve this you can unpivot the table in Power Query Editor:

 

1. Highlight the 3 columns and use the 'unpivot columns' button in the 'transform' menu:

2. Add a new column called something like 'count' and add the value 1 to each row

 

3. Set the new column format to 'whole number'

4. You can now create a pie chart like this, setting the 'count' column as the value and the male/female column as the legend:

BI_Jo_0-1604622275021.png

Hope this helps.

 

Jo

It worked. Thank you so much!

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.