I have a field with sales_start_date( values like 2014-06-17 ,2015-07-23...)
I need to do calculation based on sales_start date..
I have to take the most recent month-end date(i have to force this value to 2016-07-31) and subtract the sale_start_date to get an integer count of the days elapsed. If number of days passed is less than 2 default the value 2
You basically need to use DATEDIFF
SELECT DATEDIFF(day,<enter start date column here>,<most recent month-end date column here>) AS [Calculated field] FROM <your table here>