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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Matthew_Theis
Advocate II
Advocate II

Problems with LookupValue

Hello Everyone,

 

Thanks for the help in advance.  I'm trying to utilize LOOKUPVALUE to provide me with the previous weeks' price for any given PartNumber and Distributor.  I don't want to hardcode in a distributor name, as I have done here, but if I leave the line as follows:
'Octopus FindChipsExport'[Distributor],'Octopus FindChipsExport'[Distributor],

"I get an error "a table of multiple values was supplied where a single value was expected."

Below is what I can get returned when I hardcode TTI in as a distributor...it provides the previous weeks' price for both distributors.

image.png

 

I am hoping to be able to achieve a column that can read the Distributor and PartNumber and provide me the previous weeks' price.  For example, on 18/08/09 Arrow Electronics Previous Weeks Price should read $0.2791 while TTI would read $0.0000.

Also, if you can help me understand what DAX is doing that would be great.

 

Thanks,

Matthew

 

 

1 ACCEPTED SOLUTION

I was able to come up with a solution to my problem.  Here is the query that I used...

Previous Price =
CALCULATE(
SUM('Octopus FindChipsExport'[Price]),
FILTER(
ALLSELECTED('Octopus FindChipsExport'),
'Octopus FindChipsExport'[DateOfImport] = SELECTEDVALUE('Octopus FindChipsExport'[DateOfImport]) - 7
&& 'Octopus FindChipsExport'[Distributor] = SELECTEDVALUE('Octopus FindChipsExport'[Distributor])
&& 'Octopus FindChipsExport'[PartNumber] = SELECTEDVALUE('Octopus FindChipsExport'[PartNumber])
)
)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Matthew_Theis,

 

>>a table of multiple values was supplied where a single value was expected

This error will appear when your formula return multiple values on one row. Please use calculate function to filter table and summary result.

Preview price =
CALCULATE (
    SUM ( Table[Price] ),
    FILTER (
        ALL ( Table ),
        Table[PartNumber] = EARLIER ( [PartNumber] )
            && Table[Distributor] = EARLIER ( [Distributor] )
            && Table[DateOfImport]
                = EARLIER ( [DateOfImport] ) - 7
    )
)

 

Regards,
Xiaoxin Sheng

image.png

 

Hi @Anonymous thanks for the reply.  I tried your DAX and it appears that EARLIER isn't able to identify the previous row context, as can be seen by the error above.  

 

I did come up with something else that may work, much simplier.  

 

Prior Price =
CALCULATE(
           MAX('Octopus FindChipsExport'[Price]),
           'Octopus FindChipsExport'[DateOfImport]-7
)

Ideally I would be able to have this return blank for prices of 18/08/02 as there is no data to compare to prior to that date.  Are they downsides to this equation, should we be unable to get the one with EARLIER to work properly?

 

Thank you!

 

Matthew

I was able to come up with a solution to my problem.  Here is the query that I used...

Previous Price =
CALCULATE(
SUM('Octopus FindChipsExport'[Price]),
FILTER(
ALLSELECTED('Octopus FindChipsExport'),
'Octopus FindChipsExport'[DateOfImport] = SELECTEDVALUE('Octopus FindChipsExport'[DateOfImport]) - 7
&& 'Octopus FindChipsExport'[Distributor] = SELECTEDVALUE('Octopus FindChipsExport'[Distributor])
&& 'Octopus FindChipsExport'[PartNumber] = SELECTEDVALUE('Octopus FindChipsExport'[PartNumber])
)
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors