/    /  Amazon QuickSight – percentOfTotal

Amazon QuickSight – percentOfTotal

 

The percentOfTotal function in Amazon QuickSight is used to calculate the percentage of a measure’s value relative to the total value of the measure. This function is useful when you want to see the contribution of a specific value to the overall total value.

 

Syntax

#Start#
percentOfTotal (
    measure, 
    [partition_field, ...]
)
#End#

 

This function takes the following arguments:

 

  • measure: This is the measure that you want to calculate the percentage of total for. It must be a numeric field in your data source.
  • partition_field: (Optional) This is one or more dimensions that you want to partition the data by. If you specify more than one field, they should be separated by commas. Each field name should be enclosed in curly braces. This parameter is used to calculate the percentage of the total within each partition.

 

 

Suppose you have a dataset containing sales data for different products, and you want to see the percentage of total sales for each product. You can use the percentOfTotal function to achieve this as follows:

 

Example

#Start#
percentOfTotal(sales, {product})
#End#

 

This will calculate the percentage of total sales for each product, partitioned by product. The result will be displayed as a percentage value in a table or visualization.