Hi @Enric ,
Please try the following solution.
SQL
-- DDL and sample data population, start
DECLARE @tMovements AS TABLE(id2 INT, typeop CHAR(1), amount DECIMAL(18,2), createdate DATE);
INSERT INTO @tMovements(id2,typeop,amount,createdate) VALUES
(1, 'D',2500,'2022-01-01'),
(2,'D',3456.25,'2022-01-01'),
(3,'C',-5250,'2022-01-01'),
(4, 'C',-3000,'2022-01-05'),
(5,'D',10000,'2022-01-06'),
(6,'C',-1500,'2022-01-31');
-- DDL and sample data population, end
SELECT *
, result = SUM(amount) OVER (ORDER BY id2)
FROM @tMovements;
Output
+-----+--------+----------+------------+----------+
| id2 | typeop | amount | createdate | result |
+-----+--------+----------+------------+----------+
| 1 | D | 2500.00 | 2022-01-01 | 2500.00 |
| 2 | D | 3456.25 | 2022-01-01 | 5956.25 |
| 3 | C | -5250.00 | 2022-01-01 | 706.25 |
| 4 | C | -3000.00 | 2022-01-05 | -2293.75 |
| 5 | D | 10000.00 | 2022-01-06 | 7706.25 |
| 6 | C | -1500.00 | 2022-01-31 | 6206.25 |
+-----+--------+----------+------------+----------+