Your problem is that you're using month as dimension. The set analysis expression doesn't create a set per row, but per chart. It can't look at other rows, so the row for september can't calculate anything from august. That's why it works if you select a month and a year, but not if you select only a year.
What you could try is to create a new field in the script that retrieves the opportunities of the previous month.
Or a kind of AsOf table that links each month with itself and with the previous month.
Month_AsOf, Month, Period
janv. , janv. , Current
févr., févr., Current
févr., janv., Previous
mars, mars, Current
mars, févr, Previous
You can then use Month_AsOf as dimension instead and expressions like: