cancel
Showing results for 
Search instead for 
Did you mean: 

cumulative balance - which table?

Former Member
0 Kudos

Hi there, I am writing a fairly simple query from JDT1, but i can't find the cumulative balance column in either ODJT or JDT1. is it in a different table or is there a formula i should write?

thanks, my example query is below:

SELECT T1.[TransId], T1.[Account], T1.[CreatedBy], T1.[ContraAct], T1.[LineMemo], T1.[Credit], T1.[Debit], T1.[DebCred], FROM [dbo].[JDT1] T1 INNER JOIN OJDT T2 ON T1.TransId = T2.TransId WHERE T1.[Account] = '[%0]' and T1.[RefDate] between '[%1]' and '[%2]'

Accepted Solutions (1)

Accepted Solutions (1)

marcella_rivi
Employee
Employee
0 Kudos

Hello Groovy,

You can use the word SUM to sum the different values.

E.g. this sums the values of both credit and debit side and it was used in the query generator:

SELECT sum(T0.[Debit]) + sum(T0.[Credit]) FROM JDT1 T0 INNER JOIN OJDT T1 ON T0.TransId = T1.TransId WHERE T1.[TransId] = '95' group by t1.transid

or if you want the total of the column you can use:

select SUM (debit) from jdt1 where transid = 'XXX'

and it will sum the total of debit for that transid.

Please, let me know if the information helped you. If not, can you please give us more information about what you need?

Thank you.

Marcella Rivi

SAP Business One Forums Team

Former Member
0 Kudos

Thanks Marcella I will try this

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

There is no such field or table for you to hold those cumulative balances. They are calculated on the fly in run time application.

One option for you would be: export your query result to Excel and get those cumulative balances by a new column with a simple formula.

Thanks,

Gordon