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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
Super User
Super User

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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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