Others

How to Fix a DAX Measure Doubling Totals in Power BI

John WilsonJohn Wilson Nov 10, 2026 870 views

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.

How to Fix a DAX Measure Doubling Totals in Power BI
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the DAX Formula Bar

Select the problematic measure in the Power BI fields pane so the DAX code appears in the top formula bar.

2
Remove the Variable Assignment

Delete the VAR declaration that calculates your target consumption initially outside the iterators.

3
Update the Nested SUMX

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])))

4
Commit the Changes

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.

Context Evaluation Corrected: By removing the variable, Power BI correctly triggers a context transition and recalculates the [Target consumption per day_1] measure for every day and point combination accurately.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
  2. 2. Install and Launch: Follow the installation wizard instructions and open WPS Spreadsheets.
  3. 3. Open Your Data File: Import your CSV or Excel dataset to perform efficient and accurate data analysis.
100% compatible with Microsoft Excel (.xlsx, .csv) file formatsAdvanced pivot tables and data visualization charts built-inLightweight software that runs smoothly on older hardwareFamiliar user interface with zero learning curve for Excel users
microsoft office alternative - wps office

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.