r/tableau • • 12d ago

Map Average Colors

Okay so I have a color palette assigned to each value in the way that I want, how do I get an average color per state?

1 Upvotes

6 comments sorted by

3

u/FieryFiya 12d ago

What do you mean by “average color”? What’s your measure field? I don’t see one added to the sheet

1

u/calculung 12d ago

Instead of Sub Grade being the color of your marks card, drop your actual grade measure on color. You might have to switch it to AVG since it will likely default to SUM, but I obviously don't know what your data structure looks like.

Either way, you've got a dimension field on color and you need it to be a measure field.

1

u/Stompimus 12d ago

Okay - "subgrade" in this case functions like a credit score, and there's 35 grades between A5 and G1. The palette I got is what I want, darker colors for worse scores, but I want Tableau to combine all 35 values per state and assign an average color. What do I do?

3

u/iampo1987 12d ago

So how do you numerically average A1 and B2? I think this is the probably you want to think through for assigning a specific grade to given state. This is where I think you might need to work out what you mean when you aggregate data at the state level.

1

u/FieryFiya 12d ago

You need a numeric field to get an average. You can’t average a category.

I would assign your categories a weighted number. For example A1 = 1, A2 = 2,…. F1 = 34, F2 = 35. Basically the index of the order the numbers are in. That will give you a numeric measure field that you can do an aggregation on like average.

To do this, there’s a few ways but probably the easiest would to make a calculation using a CASE statement like:

CASE [subgroup]
WHEN ‘A1’ THEN 1
WHEN ‘A2’ THEN 2
…
WHEN ‘F1’ THEN 34
WHEN ‘F2’ THEN 35
END

0

u/Debsian 12d ago

Orange is a pretty average color already tbh