DECLARE @InputPeriodStart DATE = '1/1/2014'
DECLARE @InputPeriodEnd DATE = '12/31/2014'
ROUND(CONVERT(DECIMAL, DATEDIFF(dd, @InputPeriodStart, @InputPeriodEnd)) / 30, 1) AS DECIMAL(18, 2))
The issue here is that not every month has 30 days in it. So how can I make this calculation work properly?
I would need to remove the ROUND()
and then replace the 30 with the actual number of days for each month. I'm not sure how I'd do that.