I have the following sample dataset
| ID | Type | Opening Balance | Trans Amount | 
|---|---|---|---|
| 1 | Credit | 1000.00 | 40.00 | 
| 2 | Debit | 1000.00 | -50.00 | 
| 3 | Debit | 1000.00 | -20.00 | 
| 4 | Credit | 1000.00 | 10.00 | 
| 5 | Debit | 1000.00 | -30.00 | 
The opening balance is a fixed amount from the previous day. What i want is to use it to start computing the running balance from the first row. The desired output should be as follows
| ID | Type | Opening Balance | Trans Amount | Running Total | 
|---|---|---|---|---|
| 1 | Credit | 1000.00 | 40.00 | 1040.00 | 
| 2 | Debit | 1000.00 | -50.00 | 990.00 | 
| 3 | Debit | 1000.00 | -20.00 | 970.00 | 
| 4 | Credit | 1000.00 | 10.00 | 980.00 | 
| 5 | Debit | 1000.00 | -30.00 | 950.00 | 
The script i have written so far is only able to do a running total on the trans amount without factoring the opening balance on the first row
    SELECT SUM([trans amount]) OVER (PARTITION BY id ORDER BY id) from dbo.table1
How do i achieve the intended results

