For our mortgage loans, we keep track of 'Lock Date'. I want to write an expression that counts the number of Lock Dates that occurred in the Previous Month (we have a token in my sql system for previous month start, previous month end, or just previous month name)
This is as far as I've gotten, but I keep getting an error:
COUNT(LockDate)
CASE WHEN LockDate BETWEEN @prevmonthstart AND @prevmonthend