Your set expression and this part: $(=Only(Year))
will be evaluated once per chart, not per dimension value.
So, if you have not selected any Year, only(Year) will return NULL, since you've still got two values and only() function requires a unambiguous value returned.
You could either replace your set expression with an if() clause or use an if() clause to check the year in your expression and then use two set expressions with the year set fixed.
Hope this helps,