dharmendr says:
WHERE
Date
BETWEEN
DATEADD(MM, -13, GETDATE())
AND
GETDATE()
With the condition you will get the record between current data and the previous year current date - 1.
As per the record in between this the group sum will be calculated.
So if you want to calculate the complete month of from and to you need to modify the query as below.
As per the condition the record will be between 2019-11-29 18:52:56.000 and 2020-12-29 18:52:56.000.
Use below query.
SELECT SUM(Price),
DATEPART(MM, [Date]) AS [Month],
SUM (CONVERT(INT, CONVERT(VARCHAR(MAX),quantity))) AS Lesh
FROM Expenses
WHERE [Date] BETWEEN DATEADD(MONTH,DATEDIFF(MONTH,0,DATEADD(MM,-12,GETDATE())),0)
AND DATEADD(SECOND,-1,DATEADD(MONTH,1,DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE()),0)))
GROUP BY DATEPART(MM, Date),DATEPART(YYYY, Date)
As per this condition the record will be between 2019-12-01 00:00:00.000 and 2020-12-31 23:59:59.000.
So you will get the acurate group sum as you want.