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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
rschubs
Regular Visitor

New to DAX, need help w/ COUNTROWS w/ a filter using multiple tables.

rschubs_0-1731939461654.png

Hello everyone,

I am attempting to create a calculated column in the 'WFS Metrics' table with the following formula. My goal is to count the rows in the 'BAT Counts' table where the 'BAT Counts'[Full Name] field matches a name in the 'WFS Metrics'[Full Name] table/field while also making sure that the 'ACS BAT'[Condition] field equals "DCS-START" while none of the three tables have an active relationship. Any help would be appreciated, thanks.

1 ACCEPTED SOLUTION
v-linhuizh-msft
Community Support
Community Support

Thanks for the replies from Laxmanjatoth and lbendlin.

 

Hi @rschubs ,

 

It is recommended that you create relationships between the three table. The RELATED function can then be used:

 

Column = COUNTROWS(FILTER('BAT Counts',RELATED('ACS BAT'[Condition])="DCS-START"&&'BAT Counts'[Full Name]=RELATED('WFS Metrics'[Full Name]))
)

 

 

 The LOOKUPVALUE function can be used without creating a relationship, for example:

 

condition = LOOKUPVALUE('ACS BAT'[Condition],'ACS BAT'[Index],'BAT Counts'[Index])
Column = COUNTROWS(FILTER('BAT Counts','BAT Counts'[Full Name]=RELATED('WFS Metrics'[Full Name])&&'BAT Counts'[condition]="DCS-START"))

 

vlinhuizhmsft_0-1732174961053.png

 

 

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-linhuizh-msft
Community Support
Community Support

Thanks for the replies from Laxmanjatoth and lbendlin.

 

Hi @rschubs ,

 

It is recommended that you create relationships between the three table. The RELATED function can then be used:

 

Column = COUNTROWS(FILTER('BAT Counts',RELATED('ACS BAT'[Condition])="DCS-START"&&'BAT Counts'[Full Name]=RELATED('WFS Metrics'[Full Name]))
)

 

 

 The LOOKUPVALUE function can be used without creating a relationship, for example:

 

condition = LOOKUPVALUE('ACS BAT'[Condition],'ACS BAT'[Index],'BAT Counts'[Index])
Column = COUNTROWS(FILTER('BAT Counts','BAT Counts'[Full Name]=RELATED('WFS Metrics'[Full Name])&&'BAT Counts'[condition]="DCS-START"))

 

vlinhuizhmsft_0-1732174961053.png

 

 

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Laxmanjatoth
Resolver I
Resolver I

Matching Count =
CALCULATE(
COUNTROWS('BAT Counts'),
FILTER(
'BAT Counts',
'BAT Counts'[Full Name] = 'WFS Metrics'[Full Name] &&
'ACS BAT'[Condition] = "DCS-START"
)
)

let me know if you still help 

Best,
Laxman jatoth 

lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?  How are these three tables related?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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