Set analysis, by design is only evaluated once per chart. This is the very reason which makes it more efficient then using if condition which evaluated on row by row basis. From what I understand, you have two options
1) Use Above() or Below() function
2) Use The As-Of Table. This is a slightly better approach, but requires some intervention in script. But if you are okay with adding a new table in your script... this would be the way to go
Some other alternatives if you didn't want to mess with the script you could either use an if() statement to compare the latest monthID or use FirstSortedValue combined with aggr to get what you need.
Both solutions would not be very efficient for large amounts of data though.