Forum Discussion
How to countif with multiple conditions across table
Hi,
Please help me find out the following
Here is my current DAX
EX1 = COUNTROWS(FILTER(Terminate,CONTAINS('Hire 2022','Hire 2022'[ID],Terminate[ID])))
But another condition that need to be filtered is count if the effective date of Terminate is after the effective date of Hire 2022
Please let me know if it needs data support.
Thank you!
- Anonymous3 years ago
Hi Anonymous ,
Please try:
Measure = COUNTROWS( FILTER( Terminate, CONTAINS('Hire 2022', 'Hire 2022'[ID], Terminate[ID]) && CALCULATE( MIN('Hire 2022'[Effective Date]), 'Hire 2022'[ID] = EARLIER(Terminate[ID]) ) < Terminate[Effective Date] ) )Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
3 Replies
- AnonymousNot applicable
To elaborate, in case it helps.
Here is what the data look like
The result from my DAX - COUNTROWS(FILTER(Terminate,CONTAINS('Hire 2022','Hire 2022'[ID],Terminate[ID])))
is 5
But I would like to add another filter, which will count when the effective date of Hire 2022 is before the effective date of Termination.
And the expected result is 3
Thank you in advance
- AnonymousNot applicable
Hi Anonymous ,
Please try:
Measure = COUNTROWS( FILTER( Terminate, CONTAINS('Hire 2022', 'Hire 2022'[ID], Terminate[ID]) && CALCULATE( MIN('Hire 2022'[Effective Date]), 'Hire 2022'[ID] = EARLIER(Terminate[ID]) ) < Terminate[Effective Date] ) )Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- AnonymousNot applicable
It works.
Thank you!