Home
Analytics
RUNNINGSUM Question
HSMorales
I have a table with 10 fields.
Field "Current_Balance" is what I need to compute.
Field "BEG_BALANCE" holds my starting balance which I will use to initialize "Current_Balance" to start.
Fields "Debit" and "Credit" must be added or subtracted from Current_Balance in each detail line.
Where do I initialize "Current_Balance" ? Table Header maybe ?
is RUNNINGSUM the best way to do it or should I use a PersistentGlobalVariable. ??
If I use a PersistentGlobalVariable, where (using script) do I initialize it to start and how do I add or subtract from it.
Thanks for you help.
BIRT 3.7.0
Find more posts tagged with
Comments
kclark
Are you trying to do this in a table or crosstab? If you used a crosstab you could build a datacube that takes care of calculating the running totals for you.
Tubal
I'd use a RUNNINGSUM aggregation. But you wouldn't actually show the running sum. You'd create a new data element that adds your beg_balance to your running sum. This should give you your current balance starting with your beg_balance.
This is assuming your beginning balance is already constant in every row, which is what I understand?
Step 1: Create a new RUNNINGSUM aggregation in your table's data bindings called runningSum or whatever. This will get the running sum of dataSetRow["Debit"] + dataSetRow["Credit"].
Step 2: Add a new data element to your table named currentBalance or whatever. This data element will hold row["runningSum"] + "dataSetRow["BEG_BALANCE"].
So each row will add the running sum to the beginning balance to give you your current balance.
That should put you in the right direction.
Thanks.
HSMorales
worked great . Thanks for the help.