8 Replies Latest reply on May 24, 2017 2:48 PM by Chris McClellan

# Color Coding

I have two set of categories in which each category have around 11 different codes and in the second category it would be the same. I would like to assign one color for one category where all the 11 different codes use same color and for the second category all the codes which belong to it resembles one color assigned for that particular category. Is there any formula where we can assign color or anything which we can do in color.

example:

CPT Code

These codes below to established

101

102

103

104

105

106

...

These codes belong to new

201

202

203

204

205

....

We just have CPT codes but not categories which belong to new and established. Based on CPT codes we have differentiate. Is there any solution for this. Thanks in advance

Attached excel file which has fields used

• ###### 1. Re: Color Coding

You could create a set or a calculated field to do that, but what makes it new vs established ? ... that's the logic you would put in the set or calculated field and then use that on Color.

• ###### 2. Re: Color Coding

So, that new vs established would represent new patients and already existing patients. SO that's something related to the codes.

• ###### 3. Re: Color Coding

No data in the XLS so I'm just guessing but try :

if left(str([CPT Code]),1) = "1" then "Established" else "New" end

but you might want to do

if left(str([CPT Code]),1) = "1" then "Established" elseif left(str([CPT Code]),1) = "2" then  "New" end

I'm assuming [CPT Code] is a number in Tableau.

• ###### 4. Re: Color Coding

Yes CPT Code is a number

• ###### 5. Re: Color Coding

Chris,

I understood the logic you sent me. But in my case I have only CPT codes in the excel sheet. We do not have which is new or established. There are around 20 CPT codes which are new and established. So how do I write the logic using the CPT codes.

Ex:

These codes below to established

101

102

103

104

105

106

...

These codes belong to new

201

202

203

204

205

So here I do have CPT codes. I know which codes are for new patients and which codes are for established patients but we do not have the new and established information in the data sorce. So here. I would like to assign One color for new patients which contain all the CPT codes for new and other color for Established patients which contain CPT codes related to that category. So the report should look like this,

It's dr names down and % indicated service units.

• ###### 6. Re: Color Coding

Anjal S wrote:

Chris,

I understood the logic you sent me. But in my case I have only CPT codes in the excel sheet. We do not have which is new or established. There are around 20 CPT codes which are new and established. So how do I write the logic using the CPT codes.

The syntax I gave you was for a calculated field in Tableau that would create the new/established value because it's not in Excel.

• ###### 7. Re: Color Coding

Chris,

It did had a an option of filter. But what does 1 & 2 indiacte for in the code given.

if left(str([CPT Code]),1) = "1" then "Established" elseif left(str([CPT Code]),1) = "2" then  "New" end

Can You please explain me this syntax. Because When I'm trying to pull the calculated field to the color , it isn't showing me any data as, there is no data linked to it.

• ###### 8. Re: Color Coding

It might be best to send some dummy data, because I'm having to guess a lot about your configuration.

The code I provided takes the first character/letter from CPT Code and flags the 1's as Established and the 2's as New.

You would put this on Color if you have the rest of the graph looking the way you want, but needed to colour the new and existing values differently.

If you created some dummy data that you understood, it will be easier to explain from there