Playback starts YouTube’s embedded player (privacy-enhanced mode).
How to Correct Grand Totals and Subtotals When Using Table Calculations in Tableau
ChannelTableau SoftwareDescription from the creator
In this silent video you’ll learn how to correct grand totals and subtotals in Tableau when using table calculations.
Read the full article here: Grand Totals and Subtotals Do Not Show Expected Numbers With Table Calculations — kb.tableau.com/articles/issue/grand-totals-or-s…
- - - - - - - - - - - - - -
Step 1: Create a non-additive Calculation
1. Select Analysis - Create Calculated Field
2.In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Non-Additive Calc"
+enter the following formula:
SUM([Sales]) / SUM([Profit])
Step 2: Create a Table Calculation that relies on a non-additive field
1.Select Analysis - Create Calculated Field
2.In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Table Calculation"
+enter the following formula:
ZN([Non-Additive Calc]) - LOOKUP(ZN([Non-Additive Calc]), -1)
Step 3: Build the view
1.Drag "Category" to the Columns
2.Drag Measure names to Filter and Keep the newly created calculated fields.
3.CTRL + Drag Measure Names to Rows
4.Drag Order Date to Rows as well.
5.Drag Measure Names to the view
6.Right-click on Table Calculation and select Compute using - Table (down)
(Optional) Right-click Measure Values and select Format -Numbers section - Number (Custom) - Set Decimal to 1.
NOTE: In the view, it is expected that the Table calculation shows 27.8 + (-)1.3 + (-)3.3 = 23.2 for the year 2013. However it shows -2.14 which corresponds to: {this year's grand total} - {last year's grand total}
Step 4: (Optional) Duplicate the sheet
Right-click the sheet and select Duplicate sheet to compare the results.
Step 5: Fix the Grand Total for Table Calculation
1.Duplicate the Measure on which the data relies on, in this example: Category.
2.In the Dimension Data Pane, right-click the "Category" dimension and select Duplicate.
3.Add this duplicated dimension named "Category (copy)" to Details.
NOTE: This should cause all the values in the table to also appear in the Grand Total box, so that multiple numbers appear in one Grand Total cell in the view.
4.Create a calculated field:
Select Analysis - Create Calculated Field
In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Non-Additive Calc"
+Enter the following formula:
IF FIRST() = 0
THEN
WINDOW_SUM([Table Calculation])
END
5.Replace the original measure in the view, example [Table Calculation], with [Table Calculation GT Fix].
6.Right click on [Table Calculation GT Fix] in the view and choose Edit Table Calculation
7.Calculated Field selection is set to [Table Calculation Grand Total Fix], choose to set Compute Using: Category (copy).
NOTE: If the number is still not right, double check that when the Calculated Field drop down has [Table Calculation] selected, the Compute Using is set as needed (usually Table Across or Table Down, but never the dimension copy created earlier).
- - - - - - - - - - - - - -
Subscribe to the Tableau YouTube channel here: [link: youtube.com/subscription_center?add_user=tablea…
Free Trial of Tableau: [link: tableau.com/products/trial ]
Read the full article here: Grand Totals and Subtotals Do Not Show Expected Numbers With Table Calculations — kb.tableau.com/articles/issue/grand-totals-or-s…
- - - - - - - - - - - - - -
Step 1: Create a non-additive Calculation
1. Select Analysis - Create Calculated Field
2.In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Non-Additive Calc"
+enter the following formula:
SUM([Sales]) / SUM([Profit])
Step 2: Create a Table Calculation that relies on a non-additive field
1.Select Analysis - Create Calculated Field
2.In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Table Calculation"
+enter the following formula:
ZN([Non-Additive Calc]) - LOOKUP(ZN([Non-Additive Calc]), -1)
Step 3: Build the view
1.Drag "Category" to the Columns
2.Drag Measure names to Filter and Keep the newly created calculated fields.
3.CTRL + Drag Measure Names to Rows
4.Drag Order Date to Rows as well.
5.Drag Measure Names to the view
6.Right-click on Table Calculation and select Compute using - Table (down)
(Optional) Right-click Measure Values and select Format -Numbers section - Number (Custom) - Set Decimal to 1.
NOTE: In the view, it is expected that the Table calculation shows 27.8 + (-)1.3 + (-)3.3 = 23.2 for the year 2013. However it shows -2.14 which corresponds to: {this year's grand total} - {last year's grand total}
Step 4: (Optional) Duplicate the sheet
Right-click the sheet and select Duplicate sheet to compare the results.
Step 5: Fix the Grand Total for Table Calculation
1.Duplicate the Measure on which the data relies on, in this example: Category.
2.In the Dimension Data Pane, right-click the "Category" dimension and select Duplicate.
3.Add this duplicated dimension named "Category (copy)" to Details.
NOTE: This should cause all the values in the table to also appear in the Grand Total box, so that multiple numbers appear in one Grand Total cell in the view.
4.Create a calculated field:
Select Analysis - Create Calculated Field
In the Create Calculated Field dialog box, do the following and click OK:
+Name the field. In the example, this field is called "Non-Additive Calc"
+Enter the following formula:
IF FIRST() = 0
THEN
WINDOW_SUM([Table Calculation])
END
5.Replace the original measure in the view, example [Table Calculation], with [Table Calculation GT Fix].
6.Right click on [Table Calculation GT Fix] in the view and choose Edit Table Calculation
7.Calculated Field selection is set to [Table Calculation Grand Total Fix], choose to set Compute Using: Category (copy).
NOTE: If the number is still not right, double check that when the Calculated Field drop down has [Table Calculation] selected, the Compute Using is set as needed (usually Table Across or Table Down, but never the dimension copy created earlier).
- - - - - - - - - - - - - -
Subscribe to the Tableau YouTube channel here: [link: youtube.com/subscription_center?add_user=tablea…
Free Trial of Tableau: [link: tableau.com/products/trial ]
About this tutorial
Tableau Software published this 3:10 video tutorial on October 25, 2018. It has been watched 64,568 times on YouTube.
- Channel
- Tableau Software
- Category
- Science & Technology
- Duration
- 3:10
- Published
- October 25, 2018
- Views
- 64,568
- Likes
- 69
Tags
Share
This tutorial in other languages
- FRComment corriger Totaux et sous-totaux lors de l'utilisation de table calculs dans le Tableau
- ESCómo Corregir los totales generales y subtotales cuando se utiliza cálculos de tablas en Tableau
- PTComo totais gerais corretas e Subtotais Quando usar cálculos de tabela em Tableau
- ITCome Gran Totali e totali parziali quando si utilizza calcoli da tavola di Tableau corretti
- DEWie zu korrigieren Endsummen und Zwischenergebnisse bei der Verwendung von Tabellenkalkulationen in Tableau
- NLHoe Correct eindtotaalwaarden en subtotalen bij gebruik Tabel Berekeningen in Tableau
- RUКак исправить Грэнд общих и промежуточных итогов При использовании таблицы вычислений в Tableau
- PLJak skorygować sumy danych i sumy cząstkowe podczas korzystania Obliczenia stole w Tableau
- JAどのように正しいグランド合計と小計タブローで表計算を使用します
- ARكيفية المجاميع والمجاميع الفرعية عند استخدام الحسابات الجدول في تابلوه الكبرى تصحيح
- HIकैसे सही ग्रैंड योग और सबटोटल जब झांकी में टेबल गणनाओं का उपयोग करने के लिए
- IDCara Total Grand Benar dan Subtotal Ketika Menggunakan Tabel Perhitungan di Tableau