Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

rangesum and peek

i need help

this should be my result

A YearB MonthC sum(month)                    D   add the    same row with previous row
2014Aug8.6098.609
2014Sep2.62311.231
2014Okt81.36883.990
this my script

LOAD ACCOUNTINGCURRENCYAMOUNT,

     GENERALJOURNALENTRY,

     LEDGERACCOUNT,

     mid(LEDGERACCOUNT,1,6) as ACCOUNT

       

FROM

(qvd);

LOAD CREATEDDATETIME,

     Year(CREATEDDATETIME) AS Year,

     Month(CREATEDDATETIME) AS Month,

     RECID AS GENERALJOURNALENTRY

FROM

(qvd);

i want to work wit peek but its all new for me. Have i make a left join?

for the two tables

have i build a temp table?

Labels (1)
3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You'll have to create one table that contains the year and month field and a field that contains the values you want to sum. Once you have that table you can do something like:

Result:

LOAD *, rangesum(SumOfAmount, peek(RunningSum)) as RunningSum;

LOAD Year, Month, sum(MyAmountField) as SumOfAmount

resident MyTable

group by Year, Month;


talk is cheap, supply exceeds demand
Kushal_Chawda
MVP
MVP

Please see the attached

Not applicable
Author

thanks for your answer but my level is not so high

my solution is in the expression with rangesum and below/above (-1/0/1)

but i think it doesnt work over years because i have to get a reangesum over all years from the beginning