Unfortunately you can't create "Dynamic parameters" which is what you are trying to accomplish.
You'd have to populate the parameter with a list of years. If you do that, the calc should work.
thanks for the reply
is there any work around for this
I wish there was (and probably every other person here as well). It's in the pipeline for future updates to Tableau (I think one version of it is coming out in version 10)
How did you create your parameter in what values does it contain?
You'd generally write your calculation like SUM(if year(Date) = [MaxYear] THEN [Amount] Else 0 END )
It doesn't matter how it's written, you can't put that logic in a parameter
I know you can't put that logic in a parameter, the example would be using a parameter in a calculated field which can be done.
Vivek stated he already created his parameter, and I'm curious how he did it as I didn't think you could use Max(year) in a date parameter either.