if your table contians column which having month total and year total.
then you can use that values only...
try below query..
select datepart(year,dt) yr, datepart(mm,dt) month, month_tot,year_tot
from users
where dt in (select max(dt) from Stock_details
group by datepart(year,dt),
datepart(mm,dt))
order by 1 asc,2 asc,3 asc