Questions tagged [running-balance]
11 questions
9
votes
1 answer
SQL Server : running Sum() Over Partition
I am working on a MS Access frontend with a SQL Server 2017 as backend storing tables and views.
I want to calculate (on the SQL Server side) the quantity of stock (Bestand), remaining stock (Restbestand) and reserved stock (Reserviert) from…

Java-Jim
- 93
- 5
2
votes
1 answer
Selecting sum and running balance for last 18 months with generate_series
I have this working query, but I need to add all months to my result, no matter if the items sold during that month:
select * from (
select
to_char(max(change_date), 'YYYY-MON')::varchar(8) as yyyymmm,
max(change_date) as yearmonth,
sum(vic.sold_qty…

markdueck
- 43
- 7
0
votes
1 answer
DAX consolidated running balance from two fact tables
I have this simple data model w/ two fact tables that pertain to purchases and sales of shares of stock:
I need to calculate a running balance by taking a running sum of shares purchased by ticker and SUBTRACT by the running sum of shares sold by…

leolapa
- 31
- 8
0
votes
0 answers
Check Discrepancy of Running Balance
i want to check discrepancy in running balance in SQL ,want to find a row from after where my running balance not correct could anyone please guide me in this problem will be thankfull to you
i searched it out but could not find
0
votes
0 answers
Oracle query for running total
I have the below table and trying to derive the result in the 'expected output' column. I have mentioned the logic on how I derive it in the 'logic' column.
enter image description here
I tried using the rows unbounded preceding
0
votes
1 answer
Get minimum value per user
I have this SQL code here, my wish is to calculate the latest fee balance per student for each deposit made. So far I have been able to achieve this but now the question is how I'm I to select only the latest balance while disregarding the other…

John Rohosafi
- 1
- 1
0
votes
1 answer
Running balance in Sheets - Deduct row from total deposits
Sheet 1: I have a list of jobs in column A, for each job there is a charge of $10 in column B unless it was canceled in which case it will display 0. Sheet 2: I have a list of payments and a sum of those payments in cell C1 of Sheet 1. I want to…

Aleksandar Rašević
- 49
- 7
0
votes
1 answer
Subtract from an input appended list with a running balance output
Noob
I am trying to write a script that gives a running balance. I am messing up on the elementary declared functions of python.
I need it too:
accept a balance via input
append a list of transactions
take those out one by one in the order they…
user58284
0
votes
2 answers
Running Balance on Union Tables
The code below computes the running outstanding balance for the tables ACCOUNT and PAYMENT:
select
b.payment_date,
a.account_no, a.accountname, a.loan_amount,
b.amount,
ob = a.loan_amount - sum(b.amount) over (partition by…

Joey
- 391
- 3
- 9
- 28
0
votes
2 answers
How to update running balance in one shot?
I have a temp table, let's call it #invoices, defined as
create table (id int identity(1, 1), billed money, credited money, balance money)
i have the following data in it
Billed Credited
140.00
20.00
60.00
20.00
…

AngryHacker
- 59,598
- 102
- 325
- 594
-4
votes
1 answer
Rolling Balance SQL
Hello I need some help please
I have the following select statement But the rolling balance seems not to be working.
Select Distinct
Substring(Convert(Varchar(10), M.ValueDate, 101), 0, 11) As 'Value Date'
, base.Reference
,…

CodeGuy
- 13
- 3