Please find the workbook attached.
You can either drop in your Colourcode calculate field and measurenames together on to colour mark and then set up the colours you want.
Or use a dummy 0 value measure on the columns to have the option of assigning colour to each measure independently.
Test_Colour.twbx 38.0 KB
Thanks for your reply. This is working only when there is only one growth measure. I have multiple growth measures. Can you please provide a solution for this? I tried converting the color field to table calculation but I'm not able to generate a single color value for each measure cell. Can you please help?
The alternate option using dummy 0 has its own issues like headers will need to add separately because of incorrect alignment and so. I have horizontal scroll for measures so i'm not able to use separate header sheet also.
Waiting for your response.
PS - I have updated screenshot in my original question.
There are two ways to approach this:
1) transpose/pivot your data so instead of the measures being measure names/values there are columns for the measure name and value. Depending on how your measures are computed this may take additional work.
Then you'll have a dimension and can do something like:
IF ATTR([ID]) = 'Restricted' THEN "Blue"
IF ATTR([Measure]) = "Sales Growth" OR ATTR([Measure]) = "Profit Growth" THEN
IF SUM([Value]) > 0 THEN
ELSEIF SUM([Value]) < 0 THEN
2) Create a data source with a row for every ID & measure combination and use that to build the crosstab, then using a Tableau data blend to add in a secondary source of your raw data on the ID field with a Value calculated field of the form:
WHEN "Sales" THEN SUM([raw source].[Sales])
WHEN "Sales Growth" THEN SUM([raw source].[Sales Growth])
Then you can set the colors using a calculated field like the one in #1 above.
Again there might be complications with this depending on how the measures are computed.
If this is not able to get you far enough then please post a Tableau packaged workbook with sample data and your work so far.