I am working on a sales forecast table, which is based on the following logic: We have a complete sales table from 2019, where the products are categorized in clusters and if needed in subcategories inside the clusters for every country. (LUT_Sales19) We have another Excel table for every country and subcategory with yearly expected growth rates up until 2025. (I_Growth)
I want to calculate the expected sales amount for year x and category y by multiplying the respective sales figure from 2019 with the compounded growth rate. (E.g. if we have a sales number x for UK, for category 1 in 2019 and growth rates of 1%, 2% and 3% for 2020, 2021 and 2022 respectively, than the expected sales for 2022 is x * (1+1%) * (1+2%) * (1+3%).)
All the calculation should happen in PowerPivot with measures. So far I was able to get the 2019 sales figures as a base for the calculation for every year:
VAR Sales2019 =
CALCULATE(SUM(LUT_Sales19[Net_Sales]), ALL(LUT_date_year[Year]))
And I could get the compound growth rates as well:
VAR CumGrowth =
CALCULATE(PRODUCTX(I_Growth, 1+I_Growth[Growth]),
FILTER (ALL ( LUT_date_year ) ,LUT_date_year[Year] +1<= MAX ( LUT_date_year[Year])))
The resulting pivot table is correct for the categories but the sum for the clusters and the grand total is off for every year other than 2019. This is the measure I use:
IF(MAX(LUT_date_year[Year])=2019,
Sales2019,
CALCULATE(SUMX(LUT_Sales19, LUT_Sales19[Net_Sales]*CumGrowth), ALL(LUT_date_year[Year]))
)
I thought, that using SUMX will fix the problem, but it persists, and I am running out of ideas.
What did I miss?
Thank you for the help in advance.