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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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
Community Champion
Community Champion

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
Community Champion
Community Champion

hi @Jeff2Jets ,

 

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

Count =

COUNTROWS(RELATEDTABLE(Counties))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.