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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
TASylbaryn
New Member

Measure to count items in table 1 but filtered across Table1 and Table2

I'm sure I'm missing somethinging here so any help would be appreciate. Also, happy to do the leg work myself if you can point me in the right direction. 

 

Table 1 is linked to Table 2 (1 to many) on CustomerID

 

I want to creat a measure that counts CustomerIDs from Table 1. I want to filter this on Table1 [colour] = "red"  and by Table 2 [product]="grocery" OR [product]="butchers". 

 

Measure to count items in table 1 but filtered across Table1 and Table2

 

My attemp is below but it ignores the filters I'm tring to establish on Table 2. 

 

Test2 = CALCULATE(COUNTA(Table1[CUSTOMERID]), FILTER('Table1',Customer[colour]="red"),'Table2'[product] IN {"grocery","butchers"})
 
I think I'm fundamentally missing somethng to would appreciate the help and guidence. 
 
Thank you. 
1 REPLY 1
some_bih
Super User
Super User

Hi @TASylbaryn it could be you need RELATED

Test2 = CALCULATE(COUNTA(Table1[CUSTOMERID]), FILTER('Table1',Customer[colour]="red"),RELATED('Table2'[product]) IN {"grocery","butchers"})

I hope this is ok for you.

Check the link for example

https://dax.guide/related/ 





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

Proud to be a Super User!






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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