SELECT a.dt, sum(a.bal) AS bal, (SELECT sum(b.bal) AS [bal1]
FROM bal b
where datediff("d",b.dt,a.dt) between 10 and 50 and dm=0
GROUP BY b.dt
order by b.dt) AS bal2
FROM bal AS a
WHERE dm=0
GROUP BY a.dt
ORDER BY a.dt DESC;
SELECT a.dt, a.bal, ( a.bal - a.bal2) AS sav
FROM [bal Query] AS a
ORDER BY a.dt DESC;
this works as needed
but form data has filter filled with bnk=8 not on load and order with dt desc wich give popup
both lines removed solve the problem