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
Anonymous
Not applicable

LOOKUPVALUE with IF statements

Hi All, 

 

I have two tables;

TABLE 1 contains a list of items, 

 

In TABLE 2, I want to result a "YES" IF,

Column 'SUB' = "ABC", 

and IF

Column 'ITEM' matches data in TABLE 1, Column 'ITEM'

 

If the 'SUB' column in TABLE 1 does not match "ABC", I want the cell to remain blank. 

 

Thanks in advance for your help.

T

 

TABLE 1
ITEM
a
b
d
e

 

TABLE 2
subitemmatch
abcayes
abcbyes
abccno
abcdyes
abceyes
efga 
efgb 
efgc 
efgd 
efge 
1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this column

 

Column =
SWITCH (
    TRUE (),
    [sub] <> "abc", BLANK (),
    [sub] = "abc"
        && COUNTROWS ( INTERSECT ( { [item] }, VALUES ( Table1[ITEM] ) ) ) > 0, "yes",
    "No"
)

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this column

 

Column =
SWITCH (
    TRUE (),
    [sub] <> "abc", BLANK (),
    [sub] = "abc"
        && COUNTROWS ( INTERSECT ( { [item] }, VALUES ( Table1[ITEM] ) ) ) > 0, "yes",
    "No"
)

Regards
Zubair

Please try my custom visuals

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.