SUM_AGG function is used to summarize and add up data for the specified dimension (dragged into the analysis column). The calculation field will make dynamic adjustment automatically when you switch the analysis dimension.
It can only be used when you create a calculation field in a dashboard.
SUM_AGG is generally used for summation after detail filtering and division after summation. If you only need to sum up a single value, you can drag and drop the field to the indicator. It will automatically sum up.
If the dimension field in the lateral axis is Day, the value returned by the calculation field SUM_AGG(sales) in the vertical axis is the total sales for each day.
If the dimension field in the lateral axis is Month, the value returned by the calculation field SUM_AGG(sales) is the total sales for each month.
For example, you have obtained the contract amount and purchase quantity for each year from 2011 to 2017 through the group table. In addition, you want to calculate the average amount for each year.
Add a calculatdion field named SUM_AGG and input the formula SUM_AGG(contract amount)/SUM_AGG(purchase quantity) as follows:
Drag SUM_AGG field to Indicators.
Formula explanation:
Since the current analysis dimension is the Contract Signing Time (Year), the meaning of the formula is as follows:
Formula
Description
SUM_AGG(contract amount)
The returned value is the summation of annual contract amount.
SUM_AGG(purchase quantity)
The returned value is the summation of purchase quantity for each year.
SUM_AGG(contract amount)/SUM_AGG(purchase quantity)
It is the average amount per year.
For example, average amount in 2013 = 3887220/41.
The total contract amount for the year 2013 is 3,887,220 and the purchase quantity is 41.
Since the current analysis dimension is Contract Signing Time (Year), take the average amount of the contract in 2013 as an example. The formula meaning is shown as follows:
Calculation Order
contract amount/purchase quantity
Calculate the average value of each contract in 2013 and then summarize and sum up the average value of all contracts.
Summarize the contract amount and purchase quantity in 2013 and then divide the summation value of contracts in 2013 by the summation value of purchase quantity in 2013 to obtain the average value of contracts in 2013.
To help you better understand the SUM_AGG function, a comparison is made between not using it and using it in the same scenario.
Add a calculation field named Other Formula and directly use the formula contract amount/purchase quantity to calculate the average value.
Drag and drop Other Function field to Indicators and the result is shown as follows:
Obviously, the result obtained without using the SUM_AGG function is to divide the detailed data and then summarize and sum up it.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy