Q:

Return Previous Month in SSIS Expression

I am writing an SSIS Expression that creates a Date Key to be used with a DimDate table. 
I need the Expression to return the previous Month not the Current month. 
(DT_STR, 4,1252)YEAR(GETDATE()) + RIGHT("0" + (DT_STR, 2, 1252) MONTH(GETDATE()),2) + RIGHT("0" + (DT_STR, 2, 1252)  DAY( GETDATE()), 2)

I tried putting a -1 in the following, but it did not allow it to work. 
RIGHT("0" + (DT_STR, 2, 1252)  MONTH( GETDATE()-1  ),2)

RIGHT("0" + (DT_STR, 2, 1252)  MONTH( GETDATE()  )-1,2)

RIGHT("0" + (DT_STR, 2, 1252)  MONTH( GETDATE()  ),2)-1

What am I doing wrong?

A:

Try this when you are retrieving the Month part - 
RIGHT("0" + (DT_STR, 2, 1252)  MONTH( DATEADD("MONTH",-1,GETDATE()) ),2)

