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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
phjz
Frequent Visitor

Forcing LOOKUPVALUE to return only one value

Hey guys,

 

I thought I had a good approach for a formula, but in some cases I get this error message "A table of multiple values was supplied where a single value was expected". Here's what I need:

 

There is a table with Product names like this:

Product nameStart Date
A101.01.2020
B101.07.2021
C101.08.2022
A201.09.2020

 

And another table with something like sales:

VOLProduct CategorySales Date
3A07.02.2020
1A08.02.2020
6A07.09.2020
3A09.02.2020
3A10.09.2020
4B01.07.2021

 

Please note: The tables are not directly connected, but through another table so that A1, A2, ... belong to A.

 

What I want Power BI to do is to look for the maximum VOL and return the sum for the following 6 days. But first, he has to check if the volume of product category A belongs to A1 or A2, which I did with DATESBETWEEN Min(Start Date) and Min(Start Date)+60 days.

 

I tried this formula:

VOL_max =
CALCULATE (
    SUM ( 'Sales'[VOL] ),
        DATESBETWEEN(Sales[Sales Date],LOOKUPVALUE(Sales[Sales Date],'Sales'[VOL],CALCULATE(max(Sales[VOL]),DATESBETWEEN(Sales[Sales Date],min('Products'[Start Date]),min('Products'[Start Date])+60))),LOOKUPVALUE(Sales[Sales Date],Sales[VOL],CALCULATE(max(Sales[VOL]),DATESBETWEEN(Sales[Sales Date],min('Products'[Start Date]),min('Products'[Start Date])+60)))+6))
 
As I said, this doesn't work when there is no unique maximum volume because LOOKUPVALUE returns this multiple values. For me, it would be perfect, when Power BI would go with the first maximum by date. Do you have any idea how to fix this?
0 REPLIES 0

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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