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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

table of multiple values was supplied in a shape map

Hello,

 

As a beginner in Power BI, I try to handle a shape map I've created, showing the results of last French elections.

 

The issue occurs when selecting some bars in the bar chart or with the slicer (ex. "NUP" or "LP") and Power BI gives me the error "A table of multiple values was supplied where a single value was expected". If I select "ENS" or "RN", I have no problem.

 

Would you please help me to solve it ?

 

Here is the link : elections 

 

Thanks a lot 🙂

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Your [Max Voix] measure might be modifioed as 

Max Voix = CALCULATE(MAX('RegNuance'[Voix]),FILTER(ALL('RegNuance'),[Code de la région]=MAX('RegNuance'[Code de la région])))

 

vstephenmsft_0-1657097293203.png

And your [Couleur Max Region] measure is as follows

Couleur Max Region = CALCULATE(MAX('RegNuance'[Couleur Nuance]),FILTER(ALLSELECTED('RegNuance'),[Code de la région]=MAX('RegNuance'[Code de la région])&&[Voix]=[Max Voix]))

 

vstephenmsft_2-1657097455929.png

vstephenmsft_3-1657097464780.pngvstephenmsft_4-1657097471963.png

 

Best Regards,

Stephen Tao

 

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

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

The error is due to the [Couleur Max Region] measure.

LOOKUPVALUE(
    <result_columnName>,
    <search_columnName>,
    <search_value>
    [, <search2_columnName>, <search2_value>]…
    [, <alternateResult>]
)

What value do you want to put in your <search_value>?

vstephenmsft_1-1657006911766.png

 

 

Best Regards,

Stephen Tao

 

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

 

 

Anonymous
Not applicable

Hello Stephen,

I first thought to use a measure to search the maximum of votes per region :

Max Voix = MAX('RegNuance'[Voix])

Then I would retrieve the code of the color [Couleur Nuance] to color the shape map by the party winner.
The values I need for the first two regions :
lookup_max_region.png
There should be other ways to do so, maybe simpler
 

Regards,

Hi @Anonymous ,

 

Your [Max Voix] measure might be modifioed as 

Max Voix = CALCULATE(MAX('RegNuance'[Voix]),FILTER(ALL('RegNuance'),[Code de la région]=MAX('RegNuance'[Code de la région])))

 

vstephenmsft_0-1657097293203.png

And your [Couleur Max Region] measure is as follows

Couleur Max Region = CALCULATE(MAX('RegNuance'[Couleur Nuance]),FILTER(ALLSELECTED('RegNuance'),[Code de la région]=MAX('RegNuance'[Code de la région])&&[Voix]=[Max Voix]))

 

vstephenmsft_2-1657097455929.png

vstephenmsft_3-1657097464780.pngvstephenmsft_4-1657097471963.png

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

Many thanks Stephen, it seems to work !

If I understand well, the new formula for Max Voix you wrote

 

 

Max Voix = CALCULATE(MAX('RegNuance'[Voix]),FILTER(ALL('RegNuance'),[Code de la région]=MAX('RegNuance'[Code de la région])))

 

 

keeps only one context of filter : the filter by [Code de la région].

 

 

FILTER(<table>,<filter>) 

 

 

The <filter> you provide [Code de la région]=MAX('RegNuance'[Code de la région])

confuses me a bit. Whereas in a measure MAX('RegNuance'[Code de la région]) would give the maximum with no filter context (here it gives "94"), what is it supposed to return in a filter context ?

I have tried :

 

 

Max Voix = CALCULATE(MAX('RegNuance'[Voix]),FILTER(ALL('RegNuance'),[Code de la région]=[Code de la région]))

 

 

which doesn't work, you absolutely needs an agregate in this case, right ?

So if I change MAX by MIN in the <filter> like it :

 

 

Max Voix = CALCULATE(MAX('RegNuance'[Voix]),FILTER(ALL('RegNuance'),[Code de la région]=MIN([Code de la région])))

 

 

This formula seems to do the job as well. Could you please give me some explanation ?

Best Regards,

Anonymous
Not applicable

Hi everyone,

Can someone give me a hint ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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