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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

LOOKUPVALUE Question

 

Hello,

 

The below code looks for an ID from Table1, in Table2. If it finds a matching ID, it returns a value for the ID from Table2 that I'm using in a line graph.

 

What I want to do is have the code look both ways; so look for an ID from Table2, in Table1, and if it finds a matching ID, return the value for that ID as well. I believe the code, as it stands, is a left outer join, where I need a full outer join.

 

Any ideas on how to modify the code to achieve a full outer join?

 

Thanks in advance to anyone who can help!

 

Approved Amount =
IF(ISBLANK(LOOKUPVALUE('Table1 '[Table1 - Value],'Table1'[_ID],
'Table2'[_ID])),0,LOOKUPVALUE('Table1'[Table1 - Value],'Table1'[_ID],'Table2'[_ID]))
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

I don’t know if I understand you correctly. I made a demo, I hope it will be helpful to you.

I create  a calculated table by using two tables:

Table1+2 = DISTINCT(UNION(SELECTCOLUMNS(Table1,"ID",Table1[_ID]),SELECTCOLUMNS(Table2,"ID",Table2[_ID])))

Then add two  calculated column into the table:

Table 2 - value = IF(ISBLANK(RELATED(Table2[Table2  Value])),0,RELATED(Table2[Table2  Value]))
Table 2 - value = IF(ISBLANK(RELATED(Table2[Table2  Value])),0,RELATED(Table2[Table2  Value]))

it shows as below:

12.png

 

Pbix attach 

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

I don’t know if I understand you correctly. I made a demo, I hope it will be helpful to you.

I create  a calculated table by using two tables:

Table1+2 = DISTINCT(UNION(SELECTCOLUMNS(Table1,"ID",Table1[_ID]),SELECTCOLUMNS(Table2,"ID",Table2[_ID])))

Then add two  calculated column into the table:

Table 2 - value = IF(ISBLANK(RELATED(Table2[Table2  Value])),0,RELATED(Table2[Table2  Value]))
Table 2 - value = IF(ISBLANK(RELATED(Table2[Table2  Value])),0,RELATED(Table2[Table2  Value]))

it shows as below:

12.png

 

Pbix attach 

 

Best Regards,
Community Support Team _ Eason

Anonymous
Not applicable

@v-easonf-msft  Thank you! This gets me where I want to be; bringing in the values for each project ID from table 1 in to a line and clustered column chart, and all values for each project from table 2 as a separate line, whether or not the projects from table 2 exist in table 1. There are additional fields being brought in to this visualization and some nuances that I haven't explained, but suffice it to say that this works.

Greg_Deckler
Community Champion
Community Champion

Wait, what? Can you provide simple sample data and expected result. There are quite a few joining functions in Power BI including INTERSECT, EXCEPT, NATURALINNERJOIN, etc. you may not have to reinvent the wheel.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.