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

If, vlookup, match statements help

Hi,

I have one main table and two reference tables. I have created appropriate relationships between the reference tables and the main table.

I am trying to match a set of values (criterias) to the reference tables, if the set of values match on either reference tables then I want the output column to say "Pass" or "Fail" respective of the reference table. Please see example images below:

1) This is my main table

Goku100_0-1614892590807.png

2) These are the two "Pass" and "Fail" reference tables:

Goku100_1-1614892653640.png

Example

If the combination found in row 1 of the main table of 'Vendor', 'Company Code', and 'Product Code' exist in the "Pass" or "Fail" reference table then look at the 'Class/Unclass' column and assign "Pass" if classified or "Fail" if unclassified. 

Goku100_2-1614893077681.png

How can I create this "Pass/Fail" column in my main data table?

 

Thanks for the help/guidance!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create calculated column.

Pass/Fail =
IF(
    [Product Code] in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Product Code])&&
    [Product Code] in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Product Code])&&
    [Vendor] in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Vendor ID])&&
    [Vendor] in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Vendor ID])&&
    [Company Code]in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Company Code])&&
    [Company Code]in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Company Code]),
    IF(
        [Class/Unclass]="Classified","Pass","Fail"),
        "N/A")

2. Result:

v-yangliu-msft_1-1614936306566.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create calculated column.

Pass/Fail =
IF(
    [Product Code] in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Product Code])&&
    [Product Code] in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Product Code])&&
    [Vendor] in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Vendor ID])&&
    [Vendor] in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Vendor ID])&&
    [Company Code]in SELECTCOLUMNS(ALL('Pass Ref Table'),"1",[Company Code])&&
    [Company Code]in SELECTCOLUMNS(ALL('Fail Ref Table'),"1",[Company Code]),
    IF(
        [Class/Unclass]="Classified","Pass","Fail"),
        "N/A")

2. Result:

v-yangliu-msft_1-1614936306566.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous , Try a new column in main table like

 

new column =
var _pass = countx(filter(pass, pass[vendorId] = main[vendor] && pass[company Code] = main[company Code] && pass[ProductCode] = main[ProductCode]), pass[vendorId])
var _fail = countx(filter(fail, pass[vendorId] = main[vendor] && fail[company Code] = main[company Code] && fail[ProductCode] = main[ProductCode]), fail[vendorId])
return
Switch(true(),
not(isblank(_pass)) , "Pass",
not(isblank(_pass)) , "Fail",
blank()
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.