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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
markefrody
Post Patron
Post Patron

IF Statement Using Lookup Table

Hi,

 

I need some assistance in creating an IF statement in DAX using a lookup table.

 

Here is a sample of the main table: 

markefrody_0-1658532288264.png


Here is a sample of the lookup table:

markefrody_1-1658532341293.png


Here is the output that I need. Column "Origin Check" will check whether any of the places matches with the "Lookup". It will return "Yes" if it matches, "No" if it does not match. 
Same logic as "Origin Check" also goes for column "Destination Check".  Return "Yes" if it matches, "No" if it does not match using the "Lookup" table.  
markefrody_2-1658532396402.png


Appreciate your kind assistance.

Thanks and best regards,
Mark V

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Use these calculated column formulas in the Main table.  They will work even without a relationship between the 2 tables:

Origin check = if(isblank(lookupvalue('Table2'[lookup],'Table2'[lookup],'Table1'[Origin])),"No","Yes")

Destination check = if(isblank(lookupvalue('Table2'[lookup],'Table2'[lookup],'Table1'[Destination])),"No","Yes")

Hope this helps.


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

View solution in original post

4 REPLIES 4
markefrody
Post Patron
Post Patron

Thank you for the help guys! 

Ashish_Mathur
Super User
Super User

Hi,

Use these calculated column formulas in the Main table.  They will work even without a relationship between the 2 tables:

Origin check = if(isblank(lookupvalue('Table2'[lookup],'Table2'[lookup],'Table1'[Origin])),"No","Yes")

Destination check = if(isblank(lookupvalue('Table2'[lookup],'Table2'[lookup],'Table1'[Destination])),"No","Yes")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
tamerj1
Community Champion
Community Champion

Hi @markefrody 
Assuming no relationships, you create a calculated column in the 'Main Table'

Origin Check =
IF ( 'Main Table'[Origin] IN VALUES ( 'Lookup Table'[Lookup] ), "Yes", "No" )

 

NilR
Post Patron
Post Patron

Calc column = IF(RELATED('main table'[Destination])='Dim Table'[Destination]),"Yes","No") 

you also need to create relationship between tables.

 

https://www.wallstreetmojo.com/power-bi-related/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.