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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

vlookup or merge 2 tables bases on 2 columns -OR

I have 2 tables :

2020

SOLDTOSOLDTO_NAME
199 C A GROUP
379MG Group
680RK Group

 

2018

SOLDTOSOLDTO_NAMEActive
199C A GROUPNo
370MG GroupYes
123Dunder GroupYes

 

I want to add the Active column from the 2018 table to the 2020 table based on SOLDTO  or SOLDTO_NAME 

for example, if SOLDTO  doesn't match it should check for SOLDTO_NAME

 

2020 COmbined

SOLDTOSOLDTO_NAMEActive
199 C A GROUPNo
379MG GroupYes
680RK Group 

 It should get the Active column values for "MG Group" using the SOLDTO_NAME

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hello @AakashLoya ,

We can create a calculation column to meet your needs.

Column = 
var _x = CALCULATE(MAX('2018'[Active]),FILTER('2018','2018'[SOLDTO]='2020'[SOLDTO]))
var _y = CALCULATE(MAX('2018'[Active]),FILTER('2018','2018'[SOLDTO_NAME]='2020'[SOLDTO_NAME]))
return
IF(
    ISBLANK(_x),_y,_x)

vlookup1.jpg

If you don't meet your requirements, could you show the exact expected result based on the table you shared?

Best regards

Community support team _ zhenbw

If this post helps,then consider Accepting it as the solution to help other members find it faster.

BTW, pbix as an attachment.

View solution in original post

3 REPLIES 3
v-zhenbw-msft
Community Support
Community Support

Hello @AakashLoya ,

We can create a calculation column to meet your needs.

Column = 
var _x = CALCULATE(MAX('2018'[Active]),FILTER('2018','2018'[SOLDTO]='2020'[SOLDTO]))
var _y = CALCULATE(MAX('2018'[Active]),FILTER('2018','2018'[SOLDTO_NAME]='2020'[SOLDTO_NAME]))
return
IF(
    ISBLANK(_x),_y,_x)

vlookup1.jpg

If you don't meet your requirements, could you show the exact expected result based on the table you shared?

Best regards

Community support team _ zhenbw

If this post helps,then consider Accepting it as the solution to help other members find it faster.

BTW, pbix as an attachment.

amitchandak
Super User
Super User

@Anonymous , the merge is a power query can help left join on first table

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

refer my video if needed -https://www.youtube.com/watch?v=zNrmbagO0Oo

Anonymous
Not applicable

Hi Amit, Thanks for your reply, but my question is different, I want to merge the tables bases on the 2 values, that if 1st doesn't match then that case check for the second value

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.