Forum Discussion
Forecast From Selected Year
- Anonymous2 years ago
Hi Anonymous , bhanu_gautam, thank you for your prompt reply!
For your requirements, please try as follows:
- Create a separate calculated table containing all year values:
YearsTable = DISTINCT('Table'[Year])
- Then create a slicer and drag it to the slicer field:
- Next, create a measure to calculate yearly increase of 7% each year from selected year:
Sales Forecast = VAR SelectedYear = SELECTEDVALUE(YearsTable[Year])
VAR StartRevenue =CALCULATE(
MAX('Table'[Revenue]),
FILTER('Table', 'Table'[Year] = SelectedYear)
)
VAR CurrentYear = MAX('Table'[Year])
VAR PreviousForecast = CALCULATE(
MAX('Table'[Revenue]),
FILTER(ALL('Table'), 'Table'[Year] = CurrentYear - 1)
)
RETURN
IF(
ISBLANK(SelectedYear),
MAX('Table'[Revenue]),
IF(
CurrentYear = SelectedYear,
StartRevenue,
IF(
CurrentYear > SelectedYear,
PreviousForecast * 1.07,
MAX('Table'[Revenue])
)))Test result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous , bhanu_gautam, thank you for your prompt reply!
For your requirements, please try as follows:
- Create a separate calculated table containing all year values:
YearsTable = DISTINCT('Table'[Year])
- Then create a slicer and drag it to the slicer field:
- Next, create a measure to calculate yearly increase of 7% each year from selected year:
Sales Forecast = VAR SelectedYear = SELECTEDVALUE(YearsTable[Year])
VAR StartRevenue =CALCULATE(
MAX('Table'[Revenue]),
FILTER('Table', 'Table'[Year] = SelectedYear)
)
VAR CurrentYear = MAX('Table'[Year])
VAR PreviousForecast = CALCULATE(
MAX('Table'[Revenue]),
FILTER(ALL('Table'), 'Table'[Year] = CurrentYear - 1)
)
RETURN
IF(
ISBLANK(SelectedYear),
MAX('Table'[Revenue]),
IF(
CurrentYear = SelectedYear,
StartRevenue,
IF(
CurrentYear > SelectedYear,
PreviousForecast * 1.07,
MAX('Table'[Revenue])
)))
Test result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.