How to Fix a DAX Measure Doubling Totals in Power BI
Question details
The user needs to fix a DAX measure that incorrectly doubles the total in a visual due to filter context and nested iterations.

- Product
- Power BI
- Device & OS
- not provided
- Scenario
- Creating or updating a visual in Power BI using a DAX measure with nested SUMX expressions.
- Observed behavior
- The measure returns 18,030 instead of the expected 9,015, effectively doubling the correct total.
Review your data model relationships to ensure there are no unintended many-to-many connections that might inherently duplicate rows before modifying your DAX code.
Remove Variables and Reference Measures Directly in SUMX
Directly referencing the target measure inside nested SUMX iterations forces correct filter context evaluation for each row, preventing duplicated totals.
When using variables within nested iterators like SUMX, the variable is evaluated once in the context where it gets defined, not for each row of the iteration. This often causes totals to multiply or double unexpectedly when evaluated over calendar and data point dimensions.
Select the problematic measure in the Power BI fields pane so the DAX code appears in the top formula bar.
Delete the VAR declaration that calculates your target consumption initially outside the iterators.
Rewrite the nested SUMX to evaluate the conditional statement directly at the row level: =SUMX(Points, SUMX(Calendar_, IF(ISBLANK([Actual Units]), [Target consumption per day_1])))
Press Enter or click the checkmark icon to apply the updated DAX code, then check your table or visual to verify the total is now correct.
Verify Data Model Relationships
Incorrect totals can also stem from bidirectional cross-filtering or incorrect cardinality in relationships artificially inflating row counts.
Need to analyze data efficiently? Try WPS Office
While Power BI handles complex semantic models and DAX, many daily data reporting and analysis tasks are faster and easier in a spreadsheet environment. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Excel for seamless data manipulation.
- 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
- 2. Install and Launch: Follow the installation wizard instructions and open WPS Spreadsheets.
- 3. Open Your Data File: Import your CSV or Excel dataset to perform efficient and accurate data analysis.

Frequently Asked Questions
Why do variables in DAX SUMX cause incorrect totals?
Variables in DAX act as constants once defined. If you define a variable outside an iterator like SUMX, it captures the filter context at that exact moment. When used inside a nested SUMX, it does not recalculate per row, which often leads to duplicated or drastically inflated totals across different dimensions.
How does filter context affect nested iterators?
Nested iterators evaluate row-by-row. The inner iterator operates within the context of the outer iterator's current row. If you pass a previously calculated measure inside the iterator, a context transition takes place, ensuring the measure evaluates based on the specific row context rather than the overall table context.
What is an alternative to nested SUMX in Power BI?
Instead of deeply nesting SUMX functions, you can often use SUMMARIZE or ADDCOLUMNS to create a virtual table, and then apply a single SUMX over that virtual table. This approach can improve query performance and makes the filter context significantly easier to read and control.




