How to Fix an Incorrect DAX Measure Total in Power BI
Question details
The user needs to correct a DAX measure in Power BI that displays accurate row-level values but calculates an incorrect grand total.

- Product
- Power BI
- Device & OS
- not provided
- Scenario
- Creating or troubleshooting financial, sales, or operational reports with aggregated DAX measures in Power BI.
- Observed behavior
- The DAX measure calculates correctly at the individual row level but shows an incorrect aggregation at the grand total level because it evaluates within a different filter context.
Ensure you have access to the underlying data model in Power BI Desktop and a basic understanding of your table relationships and how filter contexts affect measures.
Replace Direct Aggregation with the SUMX Iterator Function
Use the SUMX function to force Power BI to iterate over each row in a specified table before summing the results for the grand total.
Grand totals in Power BI are not simply a sum of the rows above them; they are evaluated in their own filter context. By using an iterator like SUMX, you instruct the DAX engine to calculate the measure row by row at a specific granularity before summing it up.
Locate and select the incorrect DAX measure in your Power BI Fields pane to open the formula bar.
Modify the DAX formula to use the SUMX and VALUES functions. For example: CorrectTotal = SUMX(VALUES('Table'[KeyColumn]), [YourRowLevelMeasure]).
Replace 'Table'[KeyColumn] with the specific column that defines the granularity of your visual's rows (e.g., CustomerID or ProductID).
Press Enter to commit the formula, then add the new measure to your table visual alongside the old one to verify the grand total is now accurate.

Use HASONEVALUE to Handle Totals Differently
Apply the IF and HASONEVALUE functions to explicitly dictate how the measure calculates at the row level versus the total level.
Analyze Data Seamlessly with WPS Office
While Power BI is excellent for advanced DAX modeling, sometimes you just need a straightforward, powerful spreadsheet tool to analyze and visualize your data. WPS Spreadsheet offers comprehensive pivot tables, advanced formulas, and seamless compatibility with Microsoft Excel files, allowing you to build accurate totals and reports without complex DAX coding.
- 1. Open Your Data: Launch WPS Spreadsheet and open your existing data file or export your Power BI data to a CSV/XLSX and open it.
- 2. Insert a PivotTable: Go to the Insert tab on the top ribbon and select 'PivotTable' to start summarizing your dataset.
- 3. Calculate Totals Easily: Drag and drop your fields into the Rows and Values areas. WPS Spreadsheet will automatically calculate 100% accurate subtotals and grand totals.

Frequently Asked Questions
Why does my DAX measure work for rows but fail on the grand total?
Power BI calculates grand totals by evaluating the measure in the context of the entire dataset (or the current external filters) rather than summing the individual rows displayed in the visual. If your formula uses averages, complex ratios, or distinct counts, this broader filter context often yields an unexpected total.
What is the difference between SUM and SUMX in DAX?
SUM aggregates a single column across the current filter context. SUMX is an iterator function; it steps through a specified table row by row, evaluates an expression for each row, and then sums the results. This makes SUMX ideal for fixing grand total issues where row-level granularity must be respected.
Can I hide the grand total if I cannot fix the DAX measure?
Yes. You can turn off totals for specific visuals. Select your table or matrix visual, navigate to the Format pane, expand the 'Totals' or 'Subtotals' section, and toggle the setting to 'Off'. However, correcting the measure using an iterator is recommended for accurate and reliable reporting.




