Function Problems

How to Combine DAX Measures into One Measure with SUMX

Algirdas JasaitisAlgirdas Jasaitis Nov 10, 2026 870 views

Question details

The user needs to combine a target-cost calculation and an Accruals total into a single DAX measure.

How to Combine DAX Measures into One Measure with SUMX
Product
Excel Power Pivot / Power BI
Device & OS
not provided
Scenario
Creating advanced data models where multiple intermediate measures need to be consolidated to simplify the model or correct grand-total behavior.
Observed behavior
The user currently has separate measures and wants a unified formula using SUMX that preserves proper filter context at both the row and grand-total levels.
Before you start

Ensure you have a clear understanding of your data model's relationships and identify which core table (like 'Accruals') should be iterated over by the SUMX function.

Solution 1Recommended

Use SUMX and Variables (VAR) to Combine Measures

Use the SUMX iterator function along with DAX variables to consolidate calculations while preserving row-by-row filter context and ensuring correct grand totals.

Combining DAX measures simplifies your data model by reducing the number of standalone measures. Using variables (VAR) inside the SUMX function stores intermediate results in memory, helping you avoid circular references and redundant calculations.

1
Define the iteration table

In your DAX formula bar, start the new measure by typing =SUMX( followed by the name of the table you want to iterate over, such as Accruals.

2
Declare intermediate variables

Inside the SUMX function, use the VAR keyword to define your intermediate calculations. For example, type VAR TargetValue = [Target Cost Measure] and VAR DaysValue = [Days Measure].

3
Return the final calculation

Use the RETURN keyword to output the final mathematical expression involving your variables, such as RETURN TargetValue * DaysValue), and press Enter.

4
Test filter context and totals

Add your newly combined measure to a Matrix or Table visual in your report to verify that both the row-level values and the grand total calculate as expected.

Use SUMX and Variables (VAR) to Combine Measures
Optimization Tip: Defining variables for complex intermediate calculations inside an iterator like SUMX ensures the expression is evaluated efficiently without calculating the same metric multiple times.
Free Microsoft Office alternative

Use WPS Office for Powerful and Accessible Data Analysis

While DAX and Power Pivot are exclusive to Microsoft's ecosystem, WPS Office provides a free, highly compatible alternative for standard data analysis. Enjoy familiar spreadsheet interfaces, robust built-in Pivot Tables, and seamless performance without the heavy subscription costs.

  1. 1. Download the software: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Open your data files: Launch WPS Spreadsheet and open your existing .xlsx or .csv data files with perfect formatting preservation.
  3. 3. Analyze without code: Select your dataset, navigate to the Insert tab, and click Pivot Table to start aggregating and summarizing your data visually.
Free and lightweight Office suite with lightning-fast performanceFully compatible with Microsoft Excel file formats (.xlsx, .csv)Advanced built-in Pivot Tables for seamless data aggregationIntuitive interface requiring no learning curve for Excel users
microsoft office alternative - wps office

Frequently Asked Questions

Why do my grand totals look wrong when I don't use SUMX?

Simple measure addition or multiplication happens at the aggregated grand-total level, rather than row-by-row. SUMX forces the calculation engine to evaluate the expression row-by-row first, then sum them up, producing accurate totals.

Can I use multiple variables (VAR) inside a SUMX function?

Yes, you can declare as many variables as needed within the SUMX expression before the RETURN statement to keep your formula organized and optimize performance.

Does combining DAX measures improve performance?

It depends. Storing intermediate results in variables can prevent redundant calculations, potentially improving performance and preventing circular-reference issues in complex models.