This is a very common misunderstanding about Set Analysis... Keep in mind that Set Analysis is only performed once per chart, not in every line of the chart. Therefore, the Set Analysis condition cannot be sensitive to your chart dimensions.
In addition, if this is truly a Variable, and if the formula really begins with the equals sign =, then the variable is evaluated with every click and then the last calculated value is used in all chart lines. In other words, variables with formulas that begin with the equals sign, will not get evaluated in each line of the chart. Instead, the same value will be used in every chart line. In order to have the formula evaluated in each line of the chart, remove the equals sign from the variable definition.