Forum Discussion
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.
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] ) )
8 Replies
- AlexisOlsonSuper User
The LOOKUPVALUE function works pretty similarly to VLOOKUP.
Try something along these lines:
LOOKUPVALUE ( item[supplier_name], item[supplier_id], invoice[supplier_id] )- AnonymousNot applicable
When I atempt to use that function, I am getting this error. Do you know what could be causing this?
- AlexisOlsonSuper User
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] ) )