You may need to calculate the data for a certain period, such as the sales of the previous three months.
Calculating the data for a certain period on a day-by-day or month-by-month basis is very helpful for timeliness analysis, seasonal analysis, and performance evaluation. This calculation method allows you to better understand business dynamics, supporting decision-making and strategic planning.
This document introduces how to calculate the sales of the previous three months on a month-by-month basis. As shown in the following figure, the targeted value corresponding to 2013-03 is the total sales from 2013-01 to 2013-03; the targeted value corresponding to 2013-07 is the total sales from 2013-05 to 2013-07.
Use the DEF and EARLIER functions.
Sample data: Supermarket Sales Data.xlsx
Create a subject and upload the sample data.
1. To sum up the monthly sales, click Group Summary and group sales by month to reduce data volume and facilitate calculation.
2. Since the EARLIER function is used for inter-row calculation in subsequent steps, adding a number column helps determine which is the previous or next row.
Click Summary Column and rank Order Date in ascending order.
3. Click Save and Update.
1. Select Group Table as the chart type. Drag Order Date (grouping method: Year-Month) into Dimension and drag Sales (value format: Thousand) into Indicator.
For easier understanding, you can copy the Number field, convert it to Dimension Number1, and drag Number1 (grouping method: Group Records with Same Value) into Dimension.
2. Calculate the sales of the previous three months. Add a calculation indicator named Sales of the Previous Three Months and enter the formula shown in the following figure.
SUM_AGG(Sales)
Sums up the total sales amount.
SUM_AGG
DEF_ADD(SUM_AGG(Sales), [])
Groups data by the current Dimension and sums up the sales of each group.
DEF_ADD
DEF_ADD(SUM_AGG(Sales),[],[Number<=EARLIER(),Number>=EARLIER(Number-2)])
Filters out the numbers corresponding to the previous three months.
Sums up the sales of the previous three months.
EARLIER — Getting Value of the Current Row
3. Drag Sales of the Previous Three Months into Indicator and change the Value Format to Thousand.
See section "Preview."
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy