SELECT v.rep,
Sum(v.[Gross Rev]) as GrossRev,
DATENAME(month, v.Funded) as Mth
FROM CRMPROD_01.dbo.v_P_Reporting v
WHERE v.Funded is not null and v.Status <> 'Closed' and (YEAR(v.Funded) = YEAR(getdate()))
and (MONTH(v.Funded) > MONTH(getdate())-3)
Group by rep, v.Funded
ORDER BY v.rep, Month(v.Funded)
|