How to Create a Custom Grand Total in Power Pivot
Question details
The user needs to correct a Power Pivot report where the Grand Total recalculates over the entire source table instead of summing the visible row-level results, and resolve errors caused by empty tables.

- Product
- Microsoft Excel (Power Pivot)
- Device & OS
- not provided
- Scenario
- Calculating custom totals in a Power Pivot report where default grand totals are incorrect due to row-level DAX calculations.
- Observed behavior
- The Power Pivot report calculates row-level differences correctly but returns an unexpected Grand Total. Calculation errors also occur when evaluating empty tables or blank rows.
Ensure your Data Model is properly established and that columns like Order Quantity and Available Qty are formatted as numeric data types before writing your DAX measures.
Use SUMX for Iterative DAX Calculations
Use the SUMX function to force Power Pivot to iterate over the visible dimension values instead of calculating the grand total in a single lump sum.
By default, Power Pivot evaluates the Grand Total by applying your DAX measure over the entire unfiltered dataset. The SUMX function forces the engine to calculate row-by-row and sum those individual results.
Select your Power Pivot table, navigate to the Power Pivot tab on the ribbon, and click on Measures to create a New Measure.
Create a new measure using the SUMX function to iterate over your table. For example, use SUMX(VALUES(Table1[Product]), [YourRowMeasure]) to evaluate each product individually.
Add this new measure to your Pivot Table's Values area. The Grand Total will now accurately reflect the sum of the individual row calculations.

Handle Empty Tables and Blank Rows in DAX
Prevent calculation errors in your measures when the source table is empty or contains blank product rows.
Try WPS Office for Streamlined Data Analysis
While advanced Data Modeling and complex DAX formulas are specific to Microsoft's Power Pivot, WPS Office provides a highly compatible, free alternative for standard spreadsheet tasks and conventional Pivot Tables, offering a seamless transition for daily data work.
- 1. Download and Install: Get WPS Office for free from the official website and install it on your device.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheets and open your existing .xlsx files directly.
- 3. Create Pivot Tables: Select your data range, go to the Insert tab, and click Pivot Table to start analyzing your data.

Frequently Asked Questions
Why does my Power Pivot Grand Total not match the sum of the rows?
By default, Power Pivot evaluates the Grand Total by applying your DAX measure over the entire unfiltered dataset, rather than mathematically summing the individual row results. Using an iterative function like SUMX forces the system to calculate the measure row-by-row and sum those results.
How do I ensure my quantity columns are treated as numbers in DAX?
You can force a column to be evaluated as a number by wrapping the column reference in the VALUE() function within your DAX formula, or by changing the data type directly to a Whole Number or Decimal in the Data Model column properties.
What is the difference between SUM and SUMX in DAX?
SUM aggregates a single column across the current filter context. SUMX is an iterative function that evaluates an expression row by row over a specified table or filtered dataset, and then sums the calculated results, making it ideal for custom grand totals.




