This might not be the most elegant solution, but it should give the correct answers.
DECLARE @currentDate date
DECLARE @expiredTrades int
DECLARE @yesterday int
DECLARE @salesDataTable TABLE
(
dates date,
day_trades int,
daily_total int NULL
)
INSERT INTO @salesDataTable (dates, day_tradeS, daily_total) VALUES
('2019-01-01', 10, 10),
('2019-01-02', 27, 17),
('2019-01-03', 28, 1),
('2019-01-04', 28, 0),
('2019-01-05', 24, NULL),
('2019-01-06', 7, NULL),
('2019-01-07', 11, NULL),
('2019-01-08', 11, NULL),
('2019-01-09', 18, NULL),
('2019-01-10', 18, NULL),
('2019-01-11', 56, NULL),
('2019-01-12', 61, NULL),
('2019-01-13', 56, NULL),
('2019-01-14', 68, NULL),
('2019-01-15', 48, NULL),
('2019-01-16', 52, NULL),
('2019-01-17', 54, NULL)
WHILE 1 = (SELECT TOP 1 1 FROM @salesDataTable WHERE daily_total IS NULL)
BEGIN
SELECT TOP 1 @currentDate = dates
FROM @salesDataTable
WHERE daily_total IS NULL
ORDER BY dates
SELECT
@expiredTrades = LAG (daily_total, 4, 0) OVER (ORDER BY dates),
@yesterday = LAG (day_trades, 1, 0) OVER (ORDER BY dates)
FROM @salesDataTable
WHERE dates <= @currentDate
UPDATE @salesDataTable
SET daily_total = day_trades - (@yesterday - @expiredTrades)
WHERE dates = @currentDate
END
SELECT *
FROM @salesDataTable