Last Modified Date: 10 Dec 2019
Option 1: Manually hide the blank column
- Right-click the blank column header.
- Select Hide.
Option 2: Use an INDEX() filter
- Select Analysis > Create Calculated Field to create a calculated field.
- In the Calculated Field dialog box, type a name and the following formula, and then click OK:
- Drag one copy of the newly created calculated field to Detail on the Marks card and a second copy to the Filters shelf.
- In the Filter dialog box, select True, and then click OK.
Option 3: Create a calculation for each column in the view
The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
- 1. Create a calculated field with a name like "Consumer Profit" with a calculation similar to the following:
IF [Segment] = "Consumer" THEN [Profit] END
- Repeat step 1 for "Corporate Profit", "Home Office Profit", "Consumer Sales", "Corporate Sales", and "Home Office Sales"
- Create a calculated field with a name like "Corporate Sales Difference" with a calculation similar to the following:
WINDOW_MIN( SUM([Corporate Sales ])) - WINDOW_MIN( SUM([Consumer Sales]))
- Repeat step 3 for "Home Office Sales Difference"
- Remove [Sales] and [Profit] from the original view
- Drag [Consumer Profit] to Text on the marks card
- In the data pane, double-click [Corporate Profit], [Corporate Sales Difference], [Home Office Profit], and [Home Office Sales Difference] to add all of the calculated fields to the view.
- Right-click [Corporate Sales Difference] and select Compute Using > Cell
- Repeat step 8 for [Home Office Sales Difference].
Option 4: Pivot Measure Values
Pivot Measure Values in Tableau Prep. Note: Calculated fields cannot be pivoted in Tableau Desktop, so the pivoting must be done in Tableau Prep.
- Connect to the "Orders" table
- Click the plus on Orders, and select Add Step
- In Clean 1, create a calculated field named [Dummy Measure] with the formula: 1
- Click the plus on Clean 1, and select Add Pivot
- In Pivot 1, add [Dummy Measure] and [Sales] to the pivot
- Click the plus on Pivot 1, and select Add Output
Create the View in Tableau Desktop
- Select Analysis > Create Calculated Field
- In the Calculated Field dialog box that opens, do the following, and then click OK:
- Name the calculated field. In this example, the calculated field is named "New Measure Values"
- In the formula field, create a calculation similar to the following:
IF MIN([Pivot1 Names]) = 'Sales' THEN SUM([Sales]) ELSEIF MIN([Pivot1 Names]) = 'Dummy Measure' THEN ZN(LOOKUP(SUM([Sales]),-1)) - (LOOKUP(SUM([Sales]),-3)) END
- Create a calculated field with a name like "Color Values" with a calculation similar to the following:
IF MIN([Pivot1 Names]) = 'Dummy Measure' THEN [New Measure Values] END
- Drag [Order Date] and [Pivot1 Names] to the Columns shelf
- Drag [Category] and [Sub-Category] to the Rows shelf
- Drag [New Measure Values] to Text
- Drag [Color Values] to Color on the Marks card
- On the Marks card, select Square in the dropdown menu
- Click Color and click Edit Colors…
- In the Edit Colors dialog, select Orange-Blue-White Diverging from the Palette dropdown, and click OK
Additional InformationBy design Tableau Desktop will show a blank column when there is not enough data to compute the Difference. This helps the user understand the direction and scope of the difference.
If the view contains multiple measure, then only options 3 and 4 will provide the desired results. If the view is connected to a cube data source, then options 1 or 2 will work.
Table calculations may be wrong if the Compute using settings are incorrect. For more information, see Transform Values with Table Calculations
To voice your support for the inclusion of this feature in a future release, vote on the Simple Textual Formatting Abilities idea on the Tableau Community Forum.
Discuss this article...