cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

vlookup function in power bi

Hello,

 

 

QQ.pngI need to know how we can find the unique value in a table in order to generate a result in another table. Basically its like a Vlookup function in excel sheet. Hear with I attached the picture for more clarity. 

 

**(need to find relevent (month & material) unit price from the table-1 and calculate the total price in table-2)

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User III
Super User III

Re: vlookup function in power bi

You have to unpivot your Table 1: Check Month-column -> unpivot other columns

 

That will return an column "attribute" with the Material codes and a value-column with the prices.

 

Next merge this table with table 2 on Month- and Material-code columns (if you do it in the query editor).

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Frequent Visitor

Re: vlookup function in power bi

Hello, 

 

I recreated the tables and took the following steps in Query Editor:

1. Create a unique field in Table1. To do this you need to unpivot the data first (Select month then on the transform tab select "unpivot other columns"). Next add a custom column by concatenating [Month] & [Attribute]

2. Create a unique field in Table2. Add a custom column by concatenating [Month] & [Attribute]

3. Close and apply. (Relationship between the tables should be picked up automatically)

 

Next go to the data view to view the tables. 

1. Select Table2. On the modeling tab select "New Column" and lookup the Price using the unique fields - 

PriceLookup = LOOKUPVALUE( Table1[Value], Table1[Custom],Table2[Custom])
2. Add another column to calculate the cost. 
 
There might be more efficient solutions, but this one seemed to work.

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: vlookup function in power bi

You have to unpivot your Table 1: Check Month-column -> unpivot other columns

 

That will return an column "attribute" with the Material codes and a value-column with the prices.

 

Next merge this table with table 2 on Month- and Material-code columns (if you do it in the query editor).

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

Highlighted
Frequent Visitor

Re: vlookup function in power bi

Hello, 

 

I recreated the tables and took the following steps in Query Editor:

1. Create a unique field in Table1. To do this you need to unpivot the data first (Select month then on the transform tab select "unpivot other columns"). Next add a custom column by concatenating [Month] & [Attribute]

2. Create a unique field in Table2. Add a custom column by concatenating [Month] & [Attribute]

3. Close and apply. (Relationship between the tables should be picked up automatically)

 

Next go to the data view to view the tables. 

1. Select Table2. On the modeling tab select "New Column" and lookup the Price using the unique fields - 

PriceLookup = LOOKUPVALUE( Table1[Value], Table1[Custom],Table2[Custom])
2. Add another column to calculate the cost. 
 
There might be more efficient solutions, but this one seemed to work.

View solution in original post

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors