Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Please Help, continous rangesum 2 table

Hello Everyone,

Can anyone help me in writing the 'Expression'  Script ?

Please see my table (database using SQL) :

Capture.PNG

the first row in credit (yellow highlight),

it came from  first credit = -5.325.019.926(1st credit/LSALDO) - 219.242.320(1st Income) = -5.105.777.606.

this is my script on CREDIT expression :

rangegesum(above(sum(If(INCOME<1,(LSALDO-OUTCOME),(LSALDO+INCOME))),0,rowno()))  but it came wrong from my expectation.. 

LSALDO = -5.325.019.926


1. I want the value 2nd row in the CREDIT = -5.105.777.606(from the first row in 'CREDIT') - 31.822.991(from the 2nd row in 'INCOME') =  5.073.954.615 <- iwant the value like this. like continuous substraction.

     then the third row value is =

-5.073.954.615(from the 2nd row in 'CREDIT' - 31.822.991(from the 3rd row in 'INCOME') = -5073954615

2. and if the income <1 or null the CREDIT is - OUTCOME


I hope everybody understand what I mean and sory for my bad english


Thanks & Best Regards

 

11 Replies
Not applicable
Author

Hi Qlikviewwizard

i think i found the error problem. it becouse i dont have RowNo() in my qlikview. why 'rowno()' , becouse i try reload data in excel, with the same value, script expression from u, and also 'LOAD RowNo() in main script. then the answer is right.

is there any script for SQL database to create rowno() like this?

(reload excel table)

LOAD  RowNo(),

     INCOME,

     OUTCOME,

FROM

D:\asdf.xls

(biff, embedded labels, table is Sheet1$);

Thanks

Not applicable
Author

If you use excel table or database you can use script from mr/mrs. settu_periasamy

   

if(RowNo()=1,

  if(INCOME<1,

  (LSALDO-OUTCOME),

  (LSALDO+INCOME)),

  if(INCOME<1,Rangesum(Above(Column(4)),-Sum(OUTCOME)),

  Rangesum(Above(Column(4)),Sum(INCOME))))

But, if you use SQL Database you can use my script

if(Row=1,

    if(INCOME<1,

        (vsaldo-outcome),

        (vsaldo+income)

    ),

    if(INCOME<1,

        RangeSum(above(TOTAL Column(4)), - Column(3)) ,  

        RangeSum(above(TOTAL Column(4)), + Column(2))

    )

)

in first line 'Row' is expression. you must create this expression for main 'IF'

the expression is  'RowNo(TOTAL)' to count your total row.

vsaldo=LSALDO

LSALDO=my 1st value of credit

thanks all for the support