8 Replies Latest reply on Jan 23, 2018 6:57 AM by Jay Morehart

# Color measure values

Hi,

I am trying to accomplish something like this:-

Suppose I have these measures - Cost price , Profit, Sales price

Now I want to show a Tableau bar that says Sales price but is an amalgamation of cost price and sales and they are both

represented using different colors.

For eg:-

Something like this. But instead of Cost and Sales I would like to see Profit but use color to differentiate Cost and Profit. The color will show how much the total cost was and what was the total profit.

• ###### 1. Re: Color measure values

Bit Confusing, Can you attach a workbook and Explain what is needed.

Thanks

Deepak

• ###### 2. Re: Color measure values

Hi Deepak,

I have updated my question and attached a mock workbook. Please let me know if this helps.

• ###### 3. Re: Color measure values

are you wanting something like this:

you need to pivot the non-totals fields (you will not use the totals fields at all, you want to let tableau aggregate the data)

I then created a calc to group the items I wanted to total together:

Group =

if CONTAINS([Pivot Field Names],"Comm") then "Comm"

elseif CONTAINS([Pivot Field Names],"M") then "M"

else "Sales"

END

hope this helps

1 of 1 people found this helpful
• ###### 4. Re: Color measure values

Thanks Jay Could you please attach the workbook?

• ###### 5. Re: Color measure values

Hey Jay,

This is exactly what I was looking for. I couldn't figure out where you wrote the code for the group though.

If you have some time could you please attach the workbook that you made these changes in?

• ###### 6. Re: Color measure values

I am using 10.4, I saw that you were using 10.3, so I didn't attach the workbook, I posted the calculation in my response however:

Group =

if CONTAINS([Pivot Field Names],"Comm") then "Comm"

elseif CONTAINS([Pivot Field Names],"M") then "M"

else "Sales"

END

Hope this helps! if not, I think I still have 10.3 installed on my laptop, and I can try to re-create what I did.

• ###### 7. Re: Color measure values

Never mind I figured it out. Thanks

• ###### 8. Re: Color measure values

also the calculation is really more of a workaround. A better option would be to pivot the data before bringing it into tableau, and adding a "Group" column