How to show a different calculation for Subtotals and Grand Totals in Tableau. For example, showing SUM([Sales]) in cell, but SUM([Profit]) in Sub-totals & SUM([Quantity]) in Grand Totals.
Follow along with the Tableau attached packaged workbook to review the steps below. The workbook can be found at the bottom of the article in the Attachments section.
IF WINDOW_COUNT(ATTR([Category]))=0 THEN SUM([Quantity]) ELSEIF WINDOW_COUNT(ATTR([Category]))=3 THEN SUM([Profit]) ELSE SUM([Sales]) END
Important: The result of window_count depends on the data and the view, and such results will be effected by filters. We recommend using this workaround after sufficient testing.
001453768
2366 KB

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.