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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors