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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
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.