9 Replies Latest reply on Mar 22, 2014 6:36 PM by Baptiste Clark

# Help with Changing Scale for Map Legend

Could someone help me with this? I am working on a US heat map and trying to change the map legend. Right now, its just one bar that shows 0-750,167. I want it to have four different classification: More than 50,000, 50,001-100,000, 100,000-300,000 and 300,000+. It would be great if someone could show me how to create that. Thanks! • ###### 1. Re: Help with Changing Scale for Map Legend

I'm not sure what the [Ttl Commerical] field represents--is this a calculated field or table calculation--or simply a field in your data?

You should be able to write a calculated field but your ranges don't make sense to me--more than 50,000 would include all of the other categories you've listed, so everything would fall into "More than 50,000".

If that should be "<= 50,000" than you may be able to write a calculated field which can be used as a dimension to color your ranges:

IF sum(Ttl Commercial) <= 50000 then "Less than or equal to 50,000"

elseif sum(Ttl Commercial) <=100000 "50,001-100,000"

elseif sum(Ttl Commercial) <=300000 "100,001-300,000"

else "300,001+"

(or something similar to this--there are other ways to write this calculation, for sure)

This assumes Ttl Commerical is a field in your data source, not a calculation.

Please clarify what [Ttl Commerical] represents and what ranges you want to use.  Thanks!

• ###### 2. Re: Help with Changing Scale for Map Legend

Sorry, it was a typo! My ranges would be: Less than 50,000, 50,001-100,000, 100,000-300,000 and 300,000+.

And  [Ttl Commerical] is simply a field in my data. Thanks so much!

• ###### 3. Re: Help with Changing Scale for Map Legend

Hi Prachi,

Create a calculated field like the below & put this in color section. Change this calculation according to your requirement. Hope this may help!

if sum([Sales])  < 50000 then 'a' else if sum([Sales])  >= 50000 and sum([Sales])< 100000

then 'b' else if sum([Sales])>=100000 and sum([Sales])<= 300000 then 'c' else if sum([Sales])> 300000  then 'd' end end end end

Warm Regards,

Prashant Sharma - India | LinkedIn

1 of 1 people found this helpful
• ###### 4. Re: Help with Changing Scale for Map Legend

Great!  Your ranges still don't make sense, though.

You'll want:

Less than 50,000

50,001-100,000

100,001-300,000

300,001+

OR something similar--depending on where you want the ranges to start and end.  Just be sure the ranges don't ever include the same numbers...

Cheers.  Also, Prashant's solution will work, but you only need the one side of the range in your calculation of the ranges, since these statements are mutually exclusive.

1 of 1 people found this helpful
• ###### 5. Re: Help with Changing Scale for Map Legend

yes, I changed it to

Less than 50,000

50,001-100,000

100,001-300,000

300,001+. It worked. Thanks so much!

• ###### 6. Re: Help with Changing Scale for Map Legend

Great, best of luck!

• ###### 7. Re: Help with Changing Scale for Map Legend

Prachi,

If I understand your question, you want to have the colored with one of four colors, depending upon the value of the [Ttl Commerical] field. I'm assuming that using each State's sum of [Ttl Commerical] will be used.

In your example you have Tableau coloring the States by the sum of [Ttl Commerical], and Tableau is obliging by providing a spectrum coloring, which is exactly appropriate for coloring using (potentially) continuous value. Tableau assumes that the minimum value is zero (0), and the maximum value is the max of sum of [Ttl Commerical] in the data it's presenting.

There are several things involved in getting the effect you're after.

First, you must ask Tableau to color the States using a field that Tableau recognizes as having four and only four discrete values, i.e. a discrete field. When you use such a field Tableau will use a palette of four discrete colors for coloring the individual maps.

Second, unless there's a field in your data that maps the States' [Ttl Commerical] values to one of four discrete values, you need to create one as a calculated field. Here's an expression that matches (I believe) your requirements:

Using this field to color your map should give you the result you're looking for.

 if sum([Ttl Commercial]) <   50000 then '< 50K'

elseif sum([Ttl Commercial]) <= 100000 then '<= 100K'

elseif sum([Ttl Commercial]) <= 300000 then '<= 300K'

 else '> 300K'

end

Third, you -can- configure the colors Tableau uses for each of the discrete values.

I'm attaching a packaged workbook with this implemented. It has three maps:

• one like yours with the States colored with the continuous sum of [Ttl Commerical]
• one colored with the discrete field calculated as above
• one colored with a version of the above calculation with to-from labels and a different colors.

It should get you started.

1 of 1 people found this helpful
• ###### 8. Re: Help with Changing Scale for Map Legend

Thanks for the detailed explanation Chris, this is very helpful!

• ###### 9. Re: Help with Changing Scale for Map Legend

Hello,

I have tried to do something similar but I used 12 intervals and it does not work. It only shows a max. of 5  intervals randomly.

Any ideas?