To get the previous Month variable have the previous month.
Have a month number field created in your dataset if its not existing already. For efficient result i suggest you have the month number field like... 201301, 201302, 201303....
Considering you have the month number field like above.
Table1:
Load Distinct Max(MonthNumber,2) as MonthNumber Resident Calendar;
LET PreviousMonth = Peek('MonthNumber', 0, 'Table1');
DROP Table Table1;
And in your IF condition also use the month field which is numeric.