KNOWLEDGE BASE

Custom Color Palette Does Not Save with Ad-Hoc Calculation


Published: 30 Sep 2015
Last Modified Date: 20 Jul 2023

Issue

When using an ad-hoc calculation on the Colors card, selected colors might revert to the default palette when the workbook is saved.

Environment

Tableau Desktop

Resolution

Option 1

Create a calculation that generates explicit and fixed string values for color assignment.
  1. Navigate to Analysis > Create calculated field....
  2. Name the field as desired.
  3. Enter a formula similar to the following:
    IF SUM([Dollars HUB])/SUM([Dollars SB eligible])*100>MAX([Target PCT]) 
    THEN 'True'
    ELSE 'False'
    END
  4. Drag the newly created field to the Color card.
  5. Double-click the Color card and edit color assignments as preferred.

Option 2

In some cases, this issue can be resolved by dragging the calculation to the Measures or Dimensions pane, thus saving the ad-hoc calculation. Once saved, the field can be edited as desired, e.g. naming the calculation.

Cause

This behavior is related to the True/False condition not being explicitly defined from within the calculation. As a result, these values are generated each time the workbook is opened, and then assigned a default color palette, because there are no static string references on which to base a custom color palette.

Additional Information

In the example formula above, the condition SUM([Dollars HUB])/SUM([Dollars SB eligible])*100>MAX([Target PCT]) is recognized as a Boolean statement. As a result, Tableau Desktop automatically generates and applies True and False values when the calculation is dragged to Color.


Did this article resolve the issue?