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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors