Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation on run time

disbwthbalance
300003000
030000
300003000
300006000
030003000


Dear All

I have a problem how i do this, calculate balance column on run time like balance=disb-wth for first row

and for the remaining rows balance=balance+(disb-wth)

how i reference the first row balance.

Prompt response will be highly appreciated.

Thanks in advance

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Chart - Straight Table

Dimension : Date

Expressions :

Deposit =Sum([disb amt])

Withdrawl =Sum([wth amt])

Balance = Alt(Above([Balance]), 0) + [Deposit] - [Withdrawl]

Please find attached file for reference

Regards,

Jagan.

View solution in original post

9 Replies
Not applicable
Author

Create row number while loading the data and use that row num as part of your expression.

Thanks

maxgro
MVP
MVP

a:

load *, rowno() as id inline [

disb, wth, balance

3000, 0, 3000

0, 3000, 0

3000, 0, 3000

3000, 0, 6000

0, 3000, 3000

];

b:

NoConcatenate load

  *,

  disb - wth + alt(peek(newbalance),0) as newbalance

resident a

order by id;

drop Table a;

Not applicable
Author

Thanks for the reply

i dont want to add an line table  i do this in pivot table.I have one dimenshion and  

the disb and wth are my expressions and i have to calculate the balance on run time like

credit-debit=balance

jagan
Luminary Alumni
Luminary Alumni

Hi,

You can do this by using Rangesum() and Above() in  expression.  If you attach the sample file it would be easier to give solution.

Regards,

Jagan.

mukesh24
Partner - Creator III
Partner - Creator III

Hi Asif,

These can be done at backend level & frontend also -->

In backend reading record level value

In frontend through ABove(),Rangesum()

Regards,

Mukesh Chaudhari

Not applicable
Author

Datedisb amtwth amtBalance
10-07-2012300030000
14-02-2013300003000
18-02-201303000-3000
27-06-2013300003000
16-07-201303000-3000
26-07-2013300003000
06-08-201303000-3000
28-12-2013350003500
07-01-201403000-3000
15-03-2014370003700
21-03-201404000-4000
27-03-2014360003600
28-03-201403500-3500
05-06-2014360003600
12-06-201403500-3500
04-09-2014450004500
08-09-201404500-4500
18-12-2014450004500
25-12-201404500-4500
3540035000400

Thanks for reply

My scenario is like this

disb amt-wth amt = balance

on line three it shows -3000 but according to calculation it shows 0 because on date 14-02-2013, 3000 is disb and on date 18-02-2013 3000 is wth so balance is 0.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Chart - Straight Table

Dimension : Date

Expressions :

Deposit =Sum([disb amt])

Withdrawl =Sum([wth amt])

Balance = Alt(Above([Balance]), 0) + [Deposit] - [Withdrawl]

Please find attached file for reference

Regards,

Jagan.

Not applicable
Author

Bundle of thanks it works

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please close this thread by Clicking Correct and Useful Answer buttons to the useful posts.

REgards,

Jagan.