Previous year MTD and YTD query in MS SQL
<p>am using MS SQL 2014.</p>

<p>i have a situation where i need to display the data in MTD,YTD,Previous year MTD and Previous YTD.</p>

<p>I have wrote the query for MTD and YTD for current year (as per the date input)</p>

<p>ex: 
1) MTD (current year) : </p>

<p>DBP.Date BETWEEN DATEADD(MONTH,DATEDIFF(MONTH,0,@RefDate),0) AND @RefDate</p>

<p>2) YTD (current year) :</p>

<p>DBP.Date BETWEEN DATEADD(YEAR,DATEDIFF(YEAR,0,@RefDate),0) AND @RefDate</p>

<p>i have searched in the forums on previous year MTD and YTD but couldnt find.</p>

<p>it would be very helpfull if anyone could help in writing the previous year MTD and YTD.</p>

<p>Thanks.</p>