Hello,
I want to calculate the moving annual total for a data set.
The data is given by country, category, and date (month and year) and I need to calculate the Moving Annual Total by country and category for each month.
. Whenever the value for a certain entry is zero then the column is simply not reported, so I can't just sort the data by country&category&date and sum up the previous 11 month' values plus the current month's value.
I've tried this command, which doesn't work:
rangestat MAT_GBP=Value, interval(date -11 0) by(country category)
I want to calculate the moving annual total for a data set.
The data is given by country, category, and date (month and year) and I need to calculate the Moving Annual Total by country and category for each month.
. Whenever the value for a certain entry is zero then the column is simply not reported, so I can't just sort the data by country&category&date and sum up the previous 11 month' values plus the current month's value.
I've tried this command, which doesn't work:
rangestat MAT_GBP=Value, interval(date -11 0) by(country category)
Country | Category | Value | Year | Month | Date |
Austria | Cat_1 | 753157 | 2018 | January | January 2018 |
Austria | Cat_1 | 356991 | 2018 | March | March 2018 |
Austria | Cat_1 | 405159 | 2018 | September | September 2018 |
Austria | Cat_1 | 567725 | 2019 | May | May 2019 |
Austria | Cat_1 | 466591 | 2019 | November | November 2019 |
Austria | Cat_2 | 194156 | 2018 | February | February 2018 |
Austria | Cat_2 | 359657 | 2018 | March | March 2018 |
Austria | Cat_2 | 596758 | 2018 | November | November 2018 |
Austria | Cat_2 | 594976 | 2018 | December | December 2018 |
Austria | Cat_2 | 731195 | 2019 | January | January 2019 |
Austria | Cat_2 | 687740 | 2019 | June | June 2019 |
Austria | Cat_2 | 160119 | 2019 | September | September 2019 |
Austria | Cat_2 | 253241 | 2019 | November | November 2019 |
Austria | Cat_2 | 372132 | 2020 | January | January 2020 |
Comment