SUMIF and SUMIFS in DAX
In Excel, you add up a customer’s amounts with SUMIF. In DAX, this function does not exist, and you will not need it. Here is what replaces it, and why it is simpler than it looks.
In Excel
Your sales sheet has the customer IDs in column C and the amounts in column G. For the total of customer C001, you write:
It returns 450,000. For the 7 customers, you need seven formulas, one per customer.
In DAX
In DAX, you write a single measure, with no condition, and you place it in a table by customer:
Placed in a table next to the customer names, it gives the total of each one, all at once:
| Name | Revenue |
|---|---|
| Orvane | 450,000 |
| Kumora | 300,000 |
| Talvio | 150,000 |
| Ribelia | 250,000 |
| Movara | 250,000 |
| Northel | 200,000 |
| Sam Lee | 100,000 |
| Total | 1,700,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The visual does the work of the condition. On the Orvane row, it lets only Orvane’s sales through, and SUM finds 450,000.
When the condition must be written in the formula, rather than chosen in the visual, CALCULATE carries it:
“I want the revenue, but only for customer C001.”
In a card, it returns 450,000, like SUMIF.
Several conditions, like SUMIFS
In Excel, the total of model A202 sold in 2025 is written with SUMIFS:
In DAX, you simply add a condition to CALCULATE:
“I want the revenue, but only for model A202 and the year 2025.”
Both return 400,000, the sales V007, V010 and V011.
What really changes
SUMIF points to ranges, G2:G13. CALCULATE points to no range. It sets a filter on a column of a table, Customers[Customer ID], and this filter follows the relationships down to the Sales table.
So you no longer copy the formula for each customer or each year. A single measure is enough, and the visuals, the slicers or CALCULATE decide which sales it sees.
The full lesson explains how CALCULATE replaces or adds a filter. What CALCULATE changes
Quiz
The questions often rely on the course tables. Keep them in view in their floating window, which you can move and enlarge.
Question 1
In Excel, =SUMIF(C2:C13,"C002",G2:G13) adds up the amounts of customer C002. What does the measure CALCULATE( [Revenue], Customers[Customer ID] = "C002" ) return in a card?
Question 2
What does the measure CALCULATE( [Revenue], Products[Product Code] = "A101", Calendar[Year] = 2025 ) return in a card?
Question 3
The measure CALCULATE( [Revenue], Customers[Customer ID] = "C001" ) points to no range of Sales. How does it find the amounts of customer C001?
- SUMIF does not exist in DAX. A SUM measure placed in a visual gives the total of each customer all at once.
- To write the condition in the formula, CALCULATE( [Revenue], <condition> ). Several conditions, as in SUMIFS, are added one after the other.