9 Replies Latest reply on Feb 7, 2016 9:41 PM by hema latha

# ADDING color coding in views using calculated field

Hi

Iam Ploting graph on sum sales over the continents and i want to show the every continent's sum sales in different color by using calculated field condition.please help me with this scenario

• ###### 1. Re: ADDING color coding in views using calculated field

Hi Sudheer,

What's the logic behind the calculation. Are you trying color the sales, if it > X or X< or =X?

Just trying to put a simple example in the attachment.

Please let me know if it helps.

Thanks,

Venu

1 of 1 people found this helpful
• ###### 2. Re: ADDING color coding in views using calculated field

Hi Venu

I Just want add color every bar in the view with different color

• ###### 3. Re: ADDING color coding in views using calculated field

Sudheer!

Drag continent to color.

• ###### 4. Re: ADDING color coding in views using calculated field

Pooja

I want achive this by using calculated field

• ###### 5. Re: ADDING color coding in views using calculated field

What's the formula for your calculated field? Can you type the formula here? Something seems off in the calc.

• ###### 6. Re: ADDING color coding in views using calculated field

If sum([Sales]) <1500 then "GREEN"

elseif  sum([Sales]) >=1500000 and sum([Sales]) <2500000 then "RED"

elseif  sum([Sales]) >=250000 and sum([Sales]) <5000000 then "Yellow"

else "BLUE" end

• ###### 7. Re: ADDING color coding in views using calculated field

It looks like it is correct, I am not sure why that wouldn't work on color. It looks like you are just using the superstore dataset. Maybe you just want to attach your workbook? Which version of Tableau are you using? The formula you wrote doesn't match your screenshot that says 'true' and 'false' on color? I would recommend posting the workbook.

• ###### 8. Re: ADDING color coding in views using calculated field

Sudheer,

The example that I have provided should be work?

Did you look at the workbook that I have attached (Tableau 9.1 version)

Thanks,

Venu

On Feb 7, 2016 11:14 AM, "Pooja Gandhi" <tableaucommunity@tableau.com>

• ###### 9. Re: ADDING color coding in views using calculated field

Hi,

Try like this:

1. create one calculated field,

IF SUM([Sales]) < 100 THEN "RED"

ELSEIF SUM([Sales]) > 100 AND SUM([Sales])<300 THEN "Blue"

ELSE "Green"

END

2. Drag this calculated field in  Colours box.

3. If you want you can change/ Edit the colors according to your requirement.

1 of 1 people found this helpful