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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

How to count a specific text value in a different table

Hi all!

 

I just started working with powerBI and can't find the right solution for my question.  I have the following tables/collumns

 

Table A 

- A collumn with names

 

Table B (customers)

- Collumn with names where customers bought something (Related to collumn in table A)

 

So in table A i want to add a collumn with the count of the names in collumn 1, and how many times they are mentioned in table B. I tried some count and if statements but haven't figured out the right statement. 

2 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

Hi @Anonymous 

it depends on full your data model, but in common case it could be enogh to create the next measure (if you have relationships between tables) to table1

Measure = calculate(countrows('Table2'))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

g_datasense
Advocate I
Advocate I

Hello @Anonymous ,

 

You can create a calculate column on the Table A:

CALCULATE(

         COUNT(Table B[name])
)

 

Or you can do the same with a measure. I think your column didn't work because you are not in the same context, for this you should use CALCULATE.

 

Thanks,

Guilherme

https://www.linkedin.com/in/antunesguilherme 

 

 

View solution in original post

3 REPLIES 3
g_datasense
Advocate I
Advocate I

Hello @Anonymous ,

 

You can create a calculate column on the Table A:

CALCULATE(

         COUNT(Table B[name])
)

 

Or you can do the same with a measure. I think your column didn't work because you are not in the same context, for this you should use CALCULATE.

 

Thanks,

Guilherme

https://www.linkedin.com/in/antunesguilherme 

 

 

az38
Community Champion
Community Champion

Hi @Anonymous 

it depends on full your data model, but in common case it could be enogh to create the next measure (if you have relationships between tables) to table1

Measure = calculate(countrows('Table2'))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Can i add a last date filter here as well? So that i can count only the values from the last date available.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.