9 Replies Latest reply on Jan 16, 2019 4:10 AM by Jim Dehner

How to show maximums value from groups of variables

Hi,

I am mapping senate election data, and I am trying to color each province by the winning party (the one that received the most votes). I created a calculated value to determine the max votes, and I am able to color the provinces by the maximum number of votes. However, I want to color it by the party that had the maximum number of votes for each province (for example, all provinces where Pais 1 won would be blue, etc). How can I link output the party instead of the number of votes? I attached my workbook below for reference (I apologize, some of the words are in Spanish but as a quick reference, Distrito = Province, Partido= political party, Votos = votes)

Thank you!

• 1. Re: How to show maximums value from groups of variables

See attached.

I made some changes. I went with FIXED LODs at the level of District and Cargo.

I used Sheet 3 to figure out the right setup, and then I made a copy of your sheet 2 and colored by Calculation1 (which tells me the top party.)

2 of 2 people found this helpful
• 2. Re: How to show maximums value from groups of variables

Please see the attached and excuse my lack of language skills

I had to take it in parts -

this is the votes in ditrict/party

this is the max vote in the district

and this is the winner and color code - it returns as a measure then you right click it and convert to dimension and add to color

(You must use Fixed to convert to dimension)

it returns this

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• 3. Re: How to show maximums value from groups of variables

Thank you so much, this helps immensely!

• 4. Re: How to show maximums value from groups of variables

Jim, one question. I'm a little confused what you did, why did you sum the votes in the fist step? I'm not trying to add them, I'm just trying to output the one with the largest number. Why did you need to make a separate party-district votes section? Also, what does FIXED[] do?

• 5. Re: How to show maximums value from groups of variables

I'm not really sure what the correct values should be.  Can you test out the solution with various Cargo values and tell me if they come up with the right parties?

• 6. Re: How to show maximums value from groups of variables

Yes, yours output the correct values. One question though, when I made the Calculation 1 variable like you did, mine automatically assigns it as a count variable. I changed it to max and it worked, but yours doesn't have anything. Does this matter?

• 7. Re: How to show maximums value from groups of variables

I had to swap in my Max Votes (copy) calc for your Max Votes.  Mine is a FIXED calc, which means it can be a dimension.  The Exclude LOD has to be a measure by definition, and therefore the ABC calc that uses it has to be a measure too.  But by using a FIXED for Max Votes, it lets me have a dimension as the output of Calculation1.

But when you have a (count) on an ABC calc that ends up being a dimension, you can often used it as ATTR([Calculation1]) and still get the right value and format.  Sometimes not.  Depends on what's going on in it.

1 of 1 people found this helpful
• 8. Re: How to show maximums value from groups of variables

I see thank you for your help!

• 9. Re: How to show maximums value from groups of variables

Fixed is an lod expression that is used to compute the value at a higher level than the granular level (record) and hold it constant for use in other calculations or in the viz -

it must be aggregated so I chose sum() (all that means is for the district level sum  the total votes by party - if there is only one record it will return that value)

Jim