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:

=SUMIF(C2:C13,"C001",G2:G13)

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:

Revenue = SUM( Sales[Amount] )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table

Placed in a table next to the customer names, it gives the total of each one, all at once:

Table visual, The “Revenue” measure by customer
NameRevenue
Orvane450,000
Kumora300,000
Talvio150,000
Ribelia250,000
Movara250,000
Northel200,000
Sam Lee100,000
Total1,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:

C001 Revenue = CALCULATE( [Revenue], Customers[Customer ID] = "C001" )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“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:

=SUMIFS(G2:G13,D2:D13,"A202",B2:B13,">="&DATE(2025,1,1))

In DAX, you simply add a condition to CALCULATE:

A202 Revenue in 2025 = CALCULATE( [Revenue], Products[Product Code] = "A202", Calendar[Year] = 2025 )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“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?

Key takeaways
  • 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.