Filters are meant to narrow what a reader sees, but some numbers should not move with them: each
customer’s share of the company’s total, or “3 of 4 customers”. QuickSight computes such values before
the filters with the PRE_FILTER calculation level.
Copy and paste
Total sales before any analysis filter:
sumOver({Sales}, [], PRE_FILTER)
Save it as {Total Before Filters}, then:
Share of the unfiltered total (format as a percentage):
sum({Sales}) / min({Total Before Filters})
All customers, before filters:
distinctCountOver({Customer}, [], PRE_FILTER)
“X of Y customers” as text:
concat(toString(distinct_count({Customer})), ' of ', toString(min({All Customers})), ' customers')
where {All Customers} is the previous field.
Example
The seven orders of the conditional logic guides by customer, first without filters, then with a filter that keeps Anna and Bruno:
| Customer | Sales | percentOfTotal, no filter | percentOfTotal, filtered | Share before filters |
|---|---|---|---|---|
| Anna | 1,200 | 48.0% | 77.4% | 48.0% |
| Bruno | 350 | 14.0% | 22.6% | 14.0% |
| Carla | 900 | 36.0% | ||
| Dario | 50 | 2.0% |
percentOfTotal re-bases on what is left: Anna and Bruno always add up to 100%. The share before
filters keeps dividing by 2,500, so Anna stays at 48%. Both are correct; they answer “share of the
selection” and “share of the company”.
Why min
sumOver(..., [], PRE_FILTER) puts the same number, 2,500, on every row of the dataset. In the visual
it needs an aggregation, and Sum would multiply it by the number of rows. Min (or Max, or Average)
returns it once. The empty brackets [] mean “no partition”: one total for everything. A partition such
as [{Region}] would give each row its region’s unfiltered total.
Keeping some filters
PRE_FILTER ignores every analysis filter, including the date range the reader selects, so “share of
the company” would compare this month’s sales with all-time sales. If the date filter should still
apply, move it into the formula: drive the date range with parameters instead of a plain filter, and use
them both in the visual’s filter and in the calculation:
sumOver(
ifelse({Order Date} >= ${StartDate} AND {Order Date} <= ${EndDate}, {Sales}, 0),
[], PRE_FILTER)
Category filters are then ignored by the total, and the dates are respected.
Dataset filters still apply
Filters set in the dataset, and row-level security, act before the analysis. A PRE_FILTER total is the
total of the rows the reader is allowed to see, not of the whole table. For a company-wide denominator
that must not depend on the reader, compute it in the source.
Checked against the Amazon Quick Sight documentation and the AWS Big Data Blog (October 2026). The example results were recomputed in DuckDB.