Forum Discussion
Anonymous
4 years agoNot applicable
alternative to lookupvalue function
Hi everyone, I'm trying to look up values using this sample formula in a measure : Max Category = LOOKUPVALUE (Table1[Col_to_lookup], Table1[col_num], Table1[Max(Table1[col_num])]) Then, I w...
PaulDBrown
Community Champion
4 years agoIf you want the maximum votes by region as a column, I recomend using this code (instead of the one you have which references a measure):
New Voix Gagnant by region =
VAR _MX =
CALCULATE (
MAX ( RegNuance[Voix] ),
FILTER (
RegNuance,
RegNuance[Code de la région] = EARLIER ( RegNuance[Code de la région] )
)
)
RETURN
IF ( RegNuance[Voix] = _MX, RegNuance[Voix] )
If more than one row has the same number of votes, the code will retun the corresponding value for all the affected rows.
Just beware that best practices recommend avoiding calculated columns were possible.
BTW I tried including the [sum voix] measure for the colour saturation and it also works, probably because you included the Code Nuance as the legend and set each colour individually.
Anonymous
4 years agoNot applicable
Hello Paul,
Indeed, putting the measure [Sum Voix] for the colour saturation also works.
I Thank you for the time you dedicated on my topic, it really helped me and I learnt a lot.