You can get the day of the previous month with dateadd(m,-1,getdate()) . Then filter the year and month of this date in the where clause, for example:
select * from items where datepart(yy,dateFinished) = datepart(yy,dateadd(m,-1,getdate())) and datepart(m,dateFinished) = datepart(m,dateadd(m,-1,getdate()))
This should work after years, and also if the request is executed later than the first month.
source share