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
analyst31233
New Member

How do I create an IF > Countif calculation in DAX?

I have a very useful excel formula I use to check if a Company ID exists in another sheet with a value of "Yes", and if so, to return "Yes", but if not, to return "No". How can I create this exact same calculation in DAX?

 

The objective is to check if there is a Company ID, AND that the "Response" column is "Yes", because there can be multiple CompanyID

 

 

=IF(COUNTIFS(Vendor_List, [@[Company_ID]], Email_List, "Yes")>0,"Yes","No")

 

 

Company_Table:

 

 

Company_IDResponse of Yes?
123=IF(COUNTIFS(Vendor_List, [@[Company_ID]], Email_List, "Yes")>0,"Yes","No")

124

=IF(COUNTIFS(Vendor_List, [@[Company_ID]], Email_List, "Yes")>0,"Yes","No")

 

 

Email_Table:

 

EmailCompany_IDResponse
123@aol.com123No
123@aol.com123Yes
124@aol.com124No
124@aol.com124No
124@aol.com124Yes
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = if(CALCULATE(COUNTROWS(Company),FILTER(Email,Email[Company_ID]=EARLIER(Company[Company_ID])&&Email[Response]="Yes"))>0,"Yes","No")

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@analyst31233 

is this what you want?

Column = 
IF(MAXX(FILTER(Email,'Email'[Company_ID]='Table (2)'[Company ID]&&'Email'[Response]="Yes"),'Email'[Response])="","No","Yes")

1.PNG

pls see the attachment below

 





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.