Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

IF and LOOKUP for multiple values

Hi,

I have two tables, spend table and contract table similar to the below normalised data

 

I have linked the two tables by Vendor ID and have a dim-date (calendar) table.

This may be two issues, but I can't sort out how to sumarise the spend for each year and compare this year and last year spend by supplier but also, to be able to add whether or not there is a published contract, when I try to add the contract info, it duplicates the lines and similarily if i load up the contract info and try to add the spend, it duplicated the spend.

 

I tried 

Contract = if(LOOKUPVALUE('Contract-Data'[Term Type],'Contract-Data'[Vendor Id],[Vendor])= "Published","Yes","No") but the error message I get is "a table of multiple values was supplied where a single value was expected"
 
I tried a couple of ways of getting the spend by supplier by year in a new table, but I have deleted as it doesn't work,

 

Thanks

Emma

9 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi, thanks, that has got rid of the error, but all the responses are "no" when there definately should be some "yes"

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , Can you share sample data and sample output in table format?

  • smpa01's avatar
    smpa01
    Community Champion

    Anonymous  any chance you can provide some sample data?

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi Anonymous ,

    The reason for your problem is that your contract table has duplicate data and returns multiple statuses when vendor id=173153. As shown in the red line below, eliminating the duplicate data from the table will resolve the error.

     

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi Anonymous ,


    Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

    Best Regards
    Lucien

    • Anonymous's avatar
      Anonymous
      Not applicable

      unfortunately not, but as my work won't let me use google drive, i can't upload the files, only a picture of the tables included below