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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Add column based on two parameters

Hello,

 

I would like to add a column to the table below (which in reality has thousands or rows and over 20 columns):

 

Date    |    Machine

6/1      |     EXA11

6/1      |     EXA11

6/1      |     EXA11

6/1      |     EXA21

6/1      |     EXA21

6/2      |     EXA11

6/2      |     EXA11

6/2      |     EXA21

 

That column should contain a Goal based on the table below (which has a unique pair of Date-Machine):

 

Date    |    Machine    |    Goal

6/1      |     EXA11      |    55%

6/1      |     EXA21      |    67%

6/2      |     EXA11      |    87%

6/2      |     EXA21      |    64%

 

This would be the equivalent in Excel of a VLOOKUP with two parameters. How can I acheive this in PowerBI ?

 

Thank you. 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

There are at least two ways of doing this one.

 

1.  Add a column in both tables that is the concatenate the Date and Machine, make a relationship between them, and use RELATED() to bring the Goal # to the other table (or better yet just write a measure that gets the Goal # for your calculation)

 

2. LOOKUPVALUE will search multiple columns.  In your case, something like this in your calculated column should do it

 

Goal = LOOKUPVALUE(Goal[Goal], Goal[Date], Table[Date], Goal[Machine], Table[Machine], 0) // 0 is the result to return if no value found

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

There are at least two ways of doing this one.

 

1.  Add a column in both tables that is the concatenate the Date and Machine, make a relationship between them, and use RELATED() to bring the Goal # to the other table (or better yet just write a measure that gets the Goal # for your calculation)

 

2. LOOKUPVALUE will search multiple columns.  In your case, something like this in your calculated column should do it

 

Goal = LOOKUPVALUE(Goal[Goal], Goal[Date], Table[Date], Goal[Machine], Table[Machine], 0) // 0 is the result to return if no value found

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

It worked ! Thanks.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.