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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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,

 

EmmaMay_0-1637847659327.png

Thanks

Emma

9 REPLIES 9
v-luwang-msft
Community Support
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
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

v-luwang-msft
Community Support
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.

vluwangmsft_0-1638348266178.png

 

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


Best Regards

Lucien

smpa01
Super User
Super User

@Anonymous  any chance you can provide some sample data?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
amitchandak
Super User
Super User

@Anonymous , I am assuming you are trying for a new column

 

Contract = if(MAxx(filter('Contract-Data','Contract-Data'[Vendor Id] =[Vendor]), 'Contract-Data'[Term Type]) = "Published","Yes","No")

 

if needed

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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"

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I can't work out how to attach an excel spreadsheet to share the data

@Anonymous  please upload in 1/g drive and share the link here and mention the desired end result too.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors