Amazon QuickSight – avgOver
The avgOver function in Amazon QuickSight is used to calculate the average of a specified measure over a set of partitions. The syntax of the function is as follows:
Syntax
#Start# avgOver ( measure ,[ partition_field, ... ] ,calculation level ) #End#
This function takes the following arguments:
- measure: This is the measure for which the average is to be calculated.
- partition_field: This is an optional parameter that allows you to specify one or more fields to partition the data by. The average will be calculated for each partition separately.
- calculation_level: This is an optional parameter that specifies the level at which the calculation is performed. The available options are “cell”, “row”, “column”, and “grand_total”. By default, the calculation is performed at the cell level.
Suppose you have a dataset containing sales data for a company. The dataset has the following fields: Date, Product, Region, and Sales. You want to calculate the average sales per product, partitioned by region. The formula would be:
Example
#Start# avgOver(Sales, [Region], "cell") #End#
This would give you the average sales for each product in each region.