1 Reply Latest reply on Mar 20, 2017 12:13 PM by Jamieson Christian

# Conditional Formatting for Crosstab-attempted multiple solutions

Hello community-

I have sales data for the last several years and I would like to compare each dealers sales year to year with each other rather than comparing all (sum all sales on color currently).  My first attempt:

I would like my end results to display this:

Sales person A:

2014        2015      2016

\$500        \$1000     \$700

(green)    (green)    (yellow or red)

I'd prefer to show yellow for a decline and red for zero if possible, but do not want to over complicate what I'm already struggling with.  I have tried this custom calculation with limited success,

IF SUM([1314  \$])>0 THEN "100"

ELSEIF SUM([1314  \$]) <=0 THEN "1"

ELSEIF sum([1415  \$])< sum([1314 C&B \$]) THEN "1"

ELSEIF sum([1415  \$])> sum([1314 C&B \$]) THEN "100"

ELSEIF sum([1516  \$])< sum([1415 C&B \$]) THEN "1"

ELSEIF sum([1516  \$])> sum([1415 C&B \$]) THEN "100"

ELSEIF sum([1617  \$])< SUM([1516 C&B \$]) THEN "1"

ELSEIF sum([1617  \$])> SUM([1516 C&B \$]) THEN "100"

END

I dropped this on the color marks card hoping to create a color scale based on the 1,100.  Using this calculation my results looked like this:

I have tried this method (placeholder) with no success, it gives me the same results as my custom calculation (compares down column instead of across)

Conditionally Format the Color of Individual Columns in a Crosstab View | Tableau Software

I'd greatly appreciate any ideas, I'm the only Tableau person at my company and do not have anyone to bounce ideas off of.

Thanks!

Jason

• ###### 1. Re: Conditional Formatting for Crosstab-attempted multiple solutions

Jason,

You will not be able to accomplish this while each year's sales are in separate columns. You need to pivot your data so that each year's sales appear in their own row. Then, you will be able to leverage table calculations to do year-over-year comparisons to drive your color legend.

For more information about pivoting data, please see this Tableau help article: Pivot Data from Columns to Rows