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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
admin_xlsior
Post Prodigy
Post Prodigy

LOOKUPVALUE : "a table wuith multiple value was supplied where a single value was expected

Hi Guys,

 

So I have this master table (Rate table)

YearRegionBranchTarget rate
2018A09880.00 %
2018A09980.00 %
2018B10080.00 %
2019A09895.00 %
2019A09995.00 %
2019B10095.00 %

I intent to use a lookup based on the Year and Branch, to get my rate for my Fact table. 

 

So I create this measure :

Target rate related = LOOKUPVALUE('Target'[Target rate], 'Target'[Branch],DISTINCT('Region Branch'[Branch]), 'Target'[Year], VALUES('Date'[Year]))
 
The table RegionBranch is my Dimension Table connected to my FactTable, so in that formula, we didin't see my fact table it self. I supposed this is normal, right ?
 
However the measure I created, returns error :  "Calculation error in measure Target [Target  rate related]; A table with multiple value was supplied where a single value was expected"
 
Can advice on which data it says multiple value ? Coz, in my target, I'm positive if it filtered based on Year, there will be only one branch.
 
Thanks in advance.
 
 
 
 
 
 
 
 

 

 

 

 

1 ACCEPTED SOLUTION

@admin_xlsior 

 

Could you share your file?

Give this measure a shot

 

Target Work rate =
VAR myyear =
    MAX ( 'Date'[Year] )
VAR mybranch =
    VALUES ( 'Region Branch'[Branch] )
RETURN
    CALCULATE (
        AVERAGE ( 'Target'[Target rate] ),
        'Target'[Branch] IN mybranch,
        'Target'[Year] = myyear
    )

 


Regards
Zubair

Please try my custom visuals

View solution in original post

9 REPLIES 9
Zubair_Muhammad
Community Champion
Community Champion

@admin_xlsior 

 

Try replacing VALUES with MAX

 

Target rate related =
LOOKUPVALUE (
    'Target'[Target rate],
    'Target'[Branch], MAX ( 'Region Branch'[Branch] ),
    'Target'[Year], MAX ( 'Date'[Year] )
)

Regards
Zubair

Please try my custom visuals

To perry,

 

The diagram is something like below :

image.png

It has some duplication on Region, but for some reason we need that, and it's not the issue here 🙂

But for the branch, I can assured there is only one per year on my target table.

 

 

To Zubair,

Thanks, it's worked... Although I don;t understand why DISTINCT or VALUES not applied here ? I thought it will also make sure it elliminate duplicate ? DISTINCT with blank and VALUES with no blank, right ? 

 

By using MAX, how it's relate with Branch or year ? that function is to return the maximum of a value right ?

 

Kindly enlighten me 🙂

 

Thanks,

 

 

 

 

 

 

 

 

 

 

 

@admin_xlsior 

 

VALUES function causes problem at the total row/Column. Because at the Total Row/Column, we have multiple values so it throws that error.

 

That's why we should use alternatives like Max/Min/SelectedValue etc


Regards
Zubair

Please try my custom visuals

H Zubair,

 

Many thanks for your explanation.

 

Mind if I extend a bit since now I'm using MAX function. And the interesting part is, if somehow in my report, I don't display Branch, why it is shows the minimum of my Rate percentage value ? Actually I'm hoping it will be average, but before I do anything with my measure, currently it show the minimum value (while we using MAX instead)

 

My measure now is same like your advice (and it works for the lookup when I display Branch)

Target Work rate = LOOKUPVALUE('Target'[Target rate], 'Target'[Branch],MAX('Region Branch'[Branch]), 'Target'[Year], MAX('Date'[Year]))

 

I've changed my Target table value to be like like this :

YearRegionBranchTarget rate
2018A09880.00 %
2018A09980.00 %
2018B10065.00 %
2018B10270.00 %
2019A09895.00 %
2019A09995.00 %
2019B10080.00 %
2019B10280.00 %

 

Currently it shows 65% in the year of 2018, while branch not in the report.

 

Thanks in advance,

 

 

 

@admin_xlsior 

 

Without the Branch Field, it should take the Branch 102 i.e. max of all brannches for 2018 and return the value 70%

 

Year Region Branch Target rate
2018 A 098 80.00 %
2018 A 099 80.00 %
2018 B 100 65.00 %
2018 B 102 70.00 %
2019 A 098 95.00 %
2019 A 099 95.00 %
2019 B 100 80.00 %
2019 B 102 80.00 %

Regards
Zubair

Please try my custom visuals

Hi Zubair,

 

Yes, that was my 1st thought as well, but the actual is, it did shows the minimum value instead, which is I understand it is weird. 

 

Anyhow, is it possible for the measure to show the average of it? So with my data ->

YearRegionBranchTarget rate
2018A09880.00 %
2018A09980.00 %
2018B10065.00 %
2018B10270.00 %

In average it will shows 73.75%

 

Thanks,

 

 

@admin_xlsior 

 

Could you share your file?

Give this measure a shot

 

Target Work rate =
VAR myyear =
    MAX ( 'Date'[Year] )
VAR mybranch =
    VALUES ( 'Region Branch'[Branch] )
RETURN
    CALCULATE (
        AVERAGE ( 'Target'[Target rate] ),
        'Target'[Branch] IN mybranch,
        'Target'[Year] = myyear
    )

 


Regards
Zubair

Please try my custom visuals

Hi Zubair,

 

It worked. Many thanks for your help. 🙂

parry2k
Super User
Super User

@admin_xlsior can you share relationship diagram and in which table you want rate from rate table.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.