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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
HEHuggins
New Member

Receiving Error with DAX formula

Hello Folks,  I am brand new to Power bi and am trying to get through learning it.  I wrote the following DAX formula - "Customer Order Amount = LOOKUPVALUE('Stock Inventory'[Unit Price],'Stock Inventory'[SKU ID],'Weekly Demand Sheet'[SKU ID])*'Weekly Demand Sheet'[Weeks Demand]) - I receive the following error - "A table of multiple values was supplied where a single value was expected" - 

 

I am so frustrated (NOOBITIS) - I can't figure out how to fix this, so I can create my forecasting - can anyone help?  I will be most grateful

 

Helen

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @HEHuggins 

According to your description, when you use the LOOKUPVALUE() function, an error is reported. Right?

For this function, if we use the associated field to match multiple values, it will report an error, and I reproduced this error through test data.

My test data is this:

vyueyunzhmsft_0-1665451640597.pngvyueyunzhmsft_1-1665451665967.png

Since we want to get the [Unit Price] field in the Stock Inventory table, but we have two values [SKU ID]=4 in the table, the engine cannot tell which value needs to be obtained, resulting in an error:

vyueyunzhmsft_2-1665451746221.png

 

For the case of duplicate values, we need to choose the maximum or minimum value according to the actual needs, and we can use the following measures to solve this problem:

Column = var _cuurent_id = 'Weekly Demand Sheet'[SKU ID] 
var _t= FILTER('Stock Inventory','Stock Inventory'[SKU ID]= _cuurent_id)
var _unit_price = MAXX(_t ,[Unit Price])
return 
_unit_price

 

The result is as follows:

vyueyunzhmsft_3-1665451877795.png

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @HEHuggins 

According to your description, when you use the LOOKUPVALUE() function, an error is reported. Right?

For this function, if we use the associated field to match multiple values, it will report an error, and I reproduced this error through test data.

My test data is this:

vyueyunzhmsft_0-1665451640597.pngvyueyunzhmsft_1-1665451665967.png

Since we want to get the [Unit Price] field in the Stock Inventory table, but we have two values [SKU ID]=4 in the table, the engine cannot tell which value needs to be obtained, resulting in an error:

vyueyunzhmsft_2-1665451746221.png

 

For the case of duplicate values, we need to choose the maximum or minimum value according to the actual needs, and we can use the following measures to solve this problem:

Column = var _cuurent_id = 'Weekly Demand Sheet'[SKU ID] 
var _t= FILTER('Stock Inventory','Stock Inventory'[SKU ID]= _cuurent_id)
var _unit_price = MAXX(_t ,[Unit Price])
return 
_unit_price

 

The result is as follows:

vyueyunzhmsft_3-1665451877795.png

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I was wanting it to caluculate the demand - so weeks demand x unit price = 

 

but I used this and then just added another column multiplying the two - so thank you 😄

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.