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.
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 🙂
Solved! Go to 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])))
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]))
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.
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>?
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.
Hello Stephen,
I first thought to use a measure to search the maximum of votes per region :
Max Voix = MAX('RegNuance'[Voix])
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])))
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]))
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.
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,
Hi everyone,
Can someone give me a hint ?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |