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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Jeff2Jets
Helper III
Helper III

Create a new column

I have two tables. For this question, I will call them 'States' and 'Counties'. The 'States' table has many columns about each State; State Capital, State Flag, State Bird, State Flower, etc.

The 'States' table has a column with the name 'State'. There are 50 rows in the table, each with the name of one of the 50 US States, as seen below:

"Alabama"
"Alaska"
...

The 'Counties' table has two columns; 'State' and 'County'. Each row contains the name of a State and a County. For instance,  Alabama has 67 Counties, so there are 67 rows in the County table, as seen below:

"Alabama","Autauga"
"Alabama","Baldwin"
...

I want to create a new numeric column in the 'States' table that shows the # of Counties. I tried using LOOKUP, but that returned multiple values and produced an error. What function can I use to create a numeric column within the 'States' table that contains the # of Counties for each State?

Thanks!

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Jeff2Jets ,

 

ensure relate both tables, then write a calculated column in states table like:

Count =

COUNTROWS(RELATEDTABLE(Counties))

View solution in original post

2 REPLIES 2
Jeff2Jets
Helper III
Helper III

Thanks! That was exactly what I needed.

FreemanZ
Super User
Super User

hi @Jeff2Jets ,

 

ensure relate both tables, then write a calculated column in states table like:

Count =

COUNTROWS(RELATEDTABLE(Counties))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors