Amazon QuickSight
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

sumOver

sumOver calculates the sum of a measure partitioned by a list of dimensions.

sumOver is supported for use with analyses based on SPICE and direct query data sets.

Syntax

The brackets are required. To see which arguments are optional, see the following descriptions.

sumOver ( measure ,[ partition_field, ... ] ,calculation level )

Arguments

measure

The measure that you want to do the calculation for, for example sum({Sales Amt}). Use an aggregation if the calculation level is set to NULL or POST_AGG_FILTER. Don't use an aggregation if the calculation level is set to PRE_FILTER or PRE_AGG.

partition field

(Optional) One or more dimensions that you want to partition by, separated by commas.

Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets).

calculation level

(Optional) Specifies the calculation level to use:

  • PRE_FILTER – prefilter calculations are computed before the dataset filters.

  • PRE_AGG – preaggregate calculations are computed before applying aggregations and top and bottom N filters to the visuals.

  • POST_AGG_FILTER – (default) table calculations are computed when the visuals display.

This value defaults to POST_AGG_FILTER when blank. For more information, see Using Level-Aware Aggregations.

Example

The following example calculates the sum of sum(Sales), partitioned by City and State.

sumOver ( sum(Sales), [City, State] )

The following example sums Billed Amount over Customer Region. This example uses the revenue sample dataset, located in an Amazon S3 bucket. The fields in the table calculation are in the field wells of the visual.

sumOver ( sum({Billed Amount}), [{Customer Region}] )

The following screenshot shows the results of the example. With the addition of Customer Segment, the total amount billed for each is summed for the Customer Region, and displays in the calculated field.

On this page: