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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
vnqt
Helper V
Helper V

Vlookup in 2 columns (OR)

Hi,

 

I would like to use vlookup to compare ColumnA of TableA to 2  columns (B1 and B2) in TableB:

 

if(ISBLANK(LOOKUPVALUE(TableA[ColumnA],TableA[ColumnA],TableB[ColumnB1])),"No","Yes")
 
if(ISBLANK(LOOKUPVALUE(TableA[ColumnA],TableA[ColumnA],TableB[ColumnB2])),"No","Yes")
 
I would like to group the 2 DAX, it means IF TableA[ColumnA] exists in TableB[ColumnB1] OR TableB[ColumnB2] , YES, NO
 
Thank you in advance for your help
Tg
1 ACCEPTED SOLUTION
Barthel
Solution Sage
Solution Sage

Hey @vnqt,

Give this a try:

 

Column = 
IF (
    OR (
        CALCULATE (
            NOT ISEMPTY ( 'TableB' ),
            TREATAS ( { TableA[ColomnA] }, 'TableB'[ColumnB1] )
        ),
        CALCULATE (
            NOT ISEMPTY ( 'TableB' ),
            TREATAS ( { TableA[ColomnA] }, 'TableB'[ColumnB2] )
        )
    ),
    "YES",
    "NO"
)

 

View solution in original post

3 REPLIES 3
Nathaniel_C
Community Champion
Community Champion

Hi @vnqt ,
Please give us a visual example of the tables and expected outcome.


If you would share your pbix, or dummy up some values in Excel both for current and expected data. Please copy and paste them into your post, rather than doing a picture, we may be able to help you. 

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Barthel
Solution Sage
Solution Sage

Hey @vnqt,

Give this a try:

 

Column = 
IF (
    OR (
        CALCULATE (
            NOT ISEMPTY ( 'TableB' ),
            TREATAS ( { TableA[ColomnA] }, 'TableB'[ColumnB1] )
        ),
        CALCULATE (
            NOT ISEMPTY ( 'TableB' ),
            TREATAS ( { TableA[ColomnA] }, 'TableB'[ColumnB2] )
        )
    ),
    "YES",
    "NO"
)

 

Thank you for your help

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.