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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Adding column based on value from other table

I am attempting to essentially do a VLOOKUP in Power BI. I am trying to create a column that adds a supplier's name. The tables that I am using for this do not have the information required in the current tables. I have tried to connect other tables as well, but nothing seems to give the results I need.

 

I essentially need a column up top that has the supplier name. I was thinking if there is a way to match the p21_view_invoice_line[supplier_id] to the p21_item_view[supplier_id] column, then maybe there is a way to return the p21_item_view[supplier_name] column to the associated supplier_id. 

 

This may be an easy fix, I am new to Power BI, so any other tips or tricks are welcomed too.

 

Supplier Help.png

1 ACCEPTED SOLUTION

What I suggested should work for calculated columns but with a measure, it doesn't automatically know which id value you want to look up (since there isn't the same row context that exists for a calculated column).

 

Try adding an aggregation as the error message indicates:

LOOKUPVALUE (
    item[supplier_name],
    item[supplier_id], SELECTEDVALUE ( invoice[supplier_id] )
)

View solution in original post

8 REPLIES 8
AlexisOlson
Super User
Super User

The LOOKUPVALUE function works pretty similarly to VLOOKUP.

 

Try something along these lines:

LOOKUPVALUE (
    item[supplier_name],
    item[supplier_id], invoice[supplier_id]
)
Anonymous
Not applicable

When I atempt to use that function, I am getting this error. Do you know what could be causing this? supplier help 2.png

What I suggested should work for calculated columns but with a measure, it doesn't automatically know which id value you want to look up (since there isn't the same row context that exists for a calculated column).

 

Try adding an aggregation as the error message indicates:

LOOKUPVALUE (
    item[supplier_name],
    item[supplier_id], SELECTEDVALUE ( invoice[supplier_id] )
)
Anonymous
Not applicable

Can I use this formula but add a true and false / IF THEN statement. Basically sating if this column equals "0" then pull the data from another column. If it is possible, how would it look? 

I don't know what columns you're referencing, so you'll need to fill in the blanks.

VAR Result1 = LOOKUPVALUE ( [...] )
VAR Result2 = [...]
VAR ThisCol = SELECTEDVALUE ( [...] )
RETURN
	IF ( ThisCol = 0, Result2, Result1 )
Anonymous
Not applicable

Here is the formula I am trying to use. Basically what I am attempting is to pull a rebate cost from the other_cost culumn, but if the cost is $0 (non rebate) I want it to pull from the cogs_amount. I beleive this is a simple formula, I just cannot figure it out.

 

Rebated Cost.png

Sorry. I'm sure it is a simple adjustment but I just can't tell how things are related well enough to help since you're talking about different columns I don't have any context for.

 

Example input and expected output would help greatly.

Anonymous
Not applicable

The error message I am getting is that too few arguments were passed through the lookupvalue function. Ignore the error message from the picture above, I just accidently deleted the () around the Result2 argument.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors