Forum Discussion

nbrandborg's avatar
nbrandborg
Helper II
5 years ago
Solved

Lookup function returns Error

Hi all,

I have a problem to make a Lookup function work in my report. I get the error "A table of multiple values was supplied where a single value was expected". I have tried to use the classic LOOKUPVALUE, but it returns the error mentioned. As far as I can understand it's do to the many dublicating values?

 

My tables are looking like this:

Products table:

MaterialClass
156135A1
156834D4
156749A1
174625B2
982496C3
447813A1
176317B2
489137D4
478137E5

 

The table from which I want to look up in looks like this:

ClassQty
A13
B23
C39
D46
E56

 

I expect my Products table to look like this after the Lookup

MaterialClassQty
156135A13
156834D46
156749A13
174625B23
982496C39
447813A13
176317B23
489137D46
478137E56

 

So all the Materials are unique, but the Classes and it related QTY can be similar.

Any idea which formula I could use to make it work, and what relationship should the two tables have?

Best regards!

4 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi nbrandborg

    This should work as a calcualted column in your products table

    Qty = LOOKUPVALUE(LookUpT[Qty], LookUpT[Class], ProductsT[Class]) 

     You can also do all  this in PQ though a simple merge. Probably best

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nbrandborg .

    The best possible solution would be to do the same using Merge in Power Query.

     

    Regards,

    Sanket Bhagwat