I'm trying to return the sumproduct of the next 4 years of a measure by a dynamic multiplier for different financial forecasts but I can't seem to get it to work. Wondered if anyone could help?
My data is in a flat table:
ForecastName FiscalYear TransactionType Value
Forecast1 2019 borrowing 10
Forecast1 2020 borrowing 10
Forecast1 2021 borrowing 10
Forecast1 2022 borrowing 20
Forecast1 2023 borrowing 25
Forecast2 2019 borrowing 30
Forecast2 2019 turnover 40
Forecast3 2019 turnover 50
Forecast3 2020 turnover 50
I have a measure to calculate borrowing:
Borrowing = CALCULATE(SUM(Table[Value]),Table[TransactionType]="borrowing")
And a measure for the mutiplier (basically it returns {1, 1, 0.5, 0}):
Multiplier =
VAR YearNumber = MAX(Table[Fiscal Year])-2018
RETURN
IF(2.5 > YearNumber,1, IF(2.5 > YearNumber-1,.5,0))
Here's my attempt to write the sum product style measure:
Borrowing Forecast =
VAR CurrentFiscalYear = MAX(Table[Fiscal Year])
RETURN
SUMX((FILTER(ALLEXCEPT(Table,Table[ForecastName]),
Table[Fiscal Year] < CurrentFiscalYear + 4 &&
Table[Fiscal Year] >= CurrentFiscalYear)
Mutiplier x Borrowing)
The idea being that when you put the measure on a table with FiscalYear on the row, filtered by ForecastName, it grabs the Fiscal Year from the row and puts it in the variable, then uses this to filter the whole table on the current and next 3 Fiscal Years but keeps the filter on ForecastName, then performs the calculation and sums it. The table shows my desired result for Forecast1:
Fiscal Year Borrowing Forecast - DESIRED
2019 25 ((10*1)+(10*1)+(10*0.5)+(20*0))
2020 30 ((10*1)+(10*1)+(20*0.5)+(25*0))
The actual result is a big number I don't understand but I think one of the problems is the ALLEXCEPT part doesn't seem to be working..
I also wondered if the fact that the measure I'm trying to use in the calculation part of SUMX contains CALCULATE?
Many thanks!