Forum Discussion
Error when using LOOKUPVALUE with 2 search values
I have two tables, without relationships, setup as shown below. I want to pull the corresponding data from Table 2, Col C into Table 1 (ideally with DAX), based on both ID 1 and 2—matching data shown in color below.
My code looks like this: LookupValue(Table 2[Col C], Table 2[ID 1], Table 1[ID 1], Table 2[ID 2], Table 1[ID 2])
I get this error: "A table of multiple values was supplied where a single value was expected."
Table 1
Table 2
- Anonymous6 years ago
Ended up finding the solution here: https://community.powerbi.com/t5/Desktop/lookupvalue-filtering-2-columns/m-p/359973#M162404
7 Replies
- AnonymousNot applicable
Hi Anonymous ,
Create one key column by concatenating ID1&ID2 in both table and then LOOKUPVALUE using the key column.Key = Table2[ID1]&Table2[ID2]
Best Regards,
Mail2inba4
If this post helps, then please consider Accept it as the solution to help the other members find easily. - VasTgMemorable Member
Anonymous
You have to create a new column in Table 1 as below.
New Column = CALCULATE(VALUES('Table 2'[COL C]),FILTER('Table 2','Table 1'[ID]='Table 2'[ID] && 'Table 1'[ID2]='Table 2'[ID 2]))If this helps, mark it as a solution.Kudos are nice too. - v-lid-msftCommunity Support
Hi Anonymous ,
We can create calculate column use following formula to meet your requirement if there are multi matched rows in Table 2:
Column = CALCULATE ( MAX ( 'Table 2'[COL C] ), FILTER ( 'Table 2', 'Table 1'[ID 1] = [ID 1] && 'Table 1'[ID 2] = [ID 2] ) )Or
Column = CALCULATE ( MIN ( 'Table 2'[COL C] ), FILTER ( 'Table 2', 'Table 1'[ID 1] = [ID 1] && 'Table 1'[ID 2] = [ID 2] ) )
BTW, pbix as attached.Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Thanks for the help. I'm trying to move the corresponding values from Table 2 Col C to a new column in Table 1 and this solution doesn't seem to work, nor does the one above. One challenge is that I cannot filter out duplicates for Table 2 Col C because all values are between 1 and 5 (so there are technically duplicates.
- v-lid-msftCommunity Support
Hi Anonymous ,
Could you please What the error occored in formula when you follow the suggestions mentioned in my original post?
Best regards,
- AnonymousNot applicable
Ended up finding the solution here: https://community.powerbi.com/t5/Desktop/lookupvalue-filtering-2-columns/m-p/359973#M162404