KNOWLEDGE BASE

How To Display Subtotal Only For Certain Rows


Published: 01 Sep 2020
Last Modified Date: 02 Sep 2020

Question

How to display subtotal only on certain rows. Example Showing Sales subtotal for all subcategories within Category except Furniture Category

Environment

  • Tableau Desktop

Answer

1. Drag Category and Subcategory on Rows
2. Create a calculated field called size with SIZE() as calculation. Drag this tool tip
3. Go to Analysis -> Total -> Add all subtotal
4. Check the value returned for size fro all subtotals. In this case its 3 
User-added image

5. Create a calculated field like below for the Sales measure

IF SIZE()=3 and ATTR([Category])= "Furniture" then NULL
ELSE
SUM([Sales])
end

This will give the subtotal for all except Furniture 
User-added image
Did this article resolve the issue?