Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
mlim0806
Frequent Visitor

Create one table with split columns for each field values

Hi Community, 

 

I'm trying to create a table that displays the count of people within the three categories (gender, ETNY, and travel) within each city. How I achieve this in excel is a trick creating a separate pivot table for each category and simply hiding the repeated columns giving the illusion of one table.

 

The issue with the matrix table in pbi is that it layers on these different field values rather than keeping them separate. 

 

Input data:

CityGenderETNYTravelPerson ID
OrlandoMaleBLYes1
MiamiMaleHIYes2
New YorkFemaleINYes3
DCMaleASYes4
DCFemaleBLNo5
DCFemaleHIYes6
New YorkFemaleINNo7
HoustonFemaleASYes8
DCFemaleBLYes9
New YorkMaleHINo10
HoustonFemaleINNo11
MiamiFemaleASYes12
New YorkMaleBLNo13
OrlandoFemaleHIYes14
OrlandoMaleINYes15
OrlandoFemaleASNo16

 

Desired output:

 GenderETNYTravel 
CityFemaleMaleASBLHIINNoYesTotal number of Person IDs
DC31121 134
Houston2 1  1112
Miami111 1  22
New York22 112314
Orlando221111134
Grand Total106444461016
1 ACCEPTED SOLUTION
ahadkarimi
Solution Specialist
Solution Specialist

Hi @mlim0806, give these a try, and if you run into any issues, let me know.

Measures:

Female Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Gender] = "Female")
Male Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Gender] = "Male")
AS Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "AS")
BL Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "BL")
HI Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "HI")
IN Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "IN")
Yes Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Travel] = "Yes")
No Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Travel] = "No")

use the measures to create a summary table in a matrix visual:
Drag City to Rows.

Drag Female Count, Male Count, AS Count, BL Count, HI Count, IN Count, No Count, Yes Count, to Values in the matrix.
add another measuer:

Total Persons = COUNT('Table'[Person ID])


 

View solution in original post

4 REPLIES 4
ahadkarimi
Solution Specialist
Solution Specialist

Hi @mlim0806, give these a try, and if you run into any issues, let me know.

Measures:

Female Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Gender] = "Female")
Male Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Gender] = "Male")
AS Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "AS")
BL Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "BL")
HI Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "HI")
IN Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[ETNY] = "IN")
Yes Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Travel] = "Yes")
No Count = 
CALCULATE(COUNT('Table'[Person ID]), 'Table'[Travel] = "No")

use the measures to create a summary table in a matrix visual:
Drag City to Rows.

Drag Female Count, Male Count, AS Count, BL Count, HI Count, IN Count, No Count, Yes Count, to Values in the matrix.
add another measuer:

Total Persons = COUNT('Table'[Person ID])


 

Easy solution! Thank you!

My pleasure!

amitchandak
Super User
Super User

@mlim0806 , One of the ways is to unpivot the columns Gender, ETNY, Travel. But that will increase table rows 

 

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.