sumIf(measure, condition) adds up the measure on the rows where the condition is true. It puts a
filter inside a single measure, so one visual can show total sales next to SMB sales, or this year next
to last year, without filters that would apply to everything.
Copy and paste
Sales of one segment:
sumIf({Sales}, {Segment} = 'SMB')
Share of that segment (format as a percentage):
sumIf({Sales}, {Segment} = 'SMB') / sum({Sales})
Sales net of returns:
sumIf({Sales}, {Status} <> 'Returned')
Sales since the start of the year:
sumIf({Sales}, {Order Date} >= truncDate('YYYY', now()))
The same, written with ifelse:
sum(ifelse({Segment} = 'SMB', {Sales}, 0))
Example
On the seven orders of this section:
| Region | Sales | SMB sales | SMB share | Net of returns |
|---|---|---|---|---|
| North | 1,050 | 700 | 66.7% | 850 |
| South | 1,450 | 550 | 37.9% | 1,400 |
| Total | 2,500 | 1,250 | 50.0% | 2,250 |
The measure must be a field
The AWS reference says the first argument must be a field: literal values don’t work. If the amount is
a calculation, such as {Quantity} * {Unit Price}, create it as its own row-level calculated field
first, for example {Line Amount}, and pass that field to sumIf. The sum(ifelse(...)) form has no
such limit and accepts any row-level expression.
sumIf or a filter
A filter on Segment = SMB would change every measure in the visual, including the total that a share
needs as its denominator. sumIf changes only its own measure. That is why period comparisons such as
YTD against last year are built from
sumIf: both years have to survive the filters.
Filters still apply first. If the sheet is filtered to the North region, both sum and sumIf see only
North rows.
When no row matches
For a group where no row meets the condition, the result can be empty rather than 0, depending on the data source. Wrap it when a zero matters, for example in a difference or a growth rate:
coalesce(sumIf({Sales}, {Segment} = 'SMB'), 0)
Checked against the Amazon Quick Sight function reference (October 2026). The example results were recomputed in DuckDB.