If just to fix the error with you formula, you can use
if ATTR(year([Date])) = 2016
and [Index]>(WINDOW_MAX([Index]) -[param_index])
Hi Tien, it kind of works but when i do that, i will need year(date) to be on the color shelf in order to see the line chart of the forecast values:
what i want is for measure names to be on the color shelf so i can have all 3 line charts as different colors. but if measure names is on color shelf, the line chart disappears even though the legend shows it as purple.
How can i change the color of the forecast line chart?
Now, I have more idea of what you want to achieve.
You may try this formula instead and use it as secondary axis
IIF(ISNULL([Actual]) and Year([Date])=2016, [Forecast],NULL)
Please see sheet 2.
(I think I use the newer version of Tableau so you may not be able to open it unless you update it to 9.3) If that the case, this screenshot may help
forecast_test.twbx 34.1 KB
Select two fields with using ctrl key.
make it sure two fields are highlighted
drag either of fields into color shelf
You can see two fields are set in color shelf.