Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sibideepak
Creator II
Creator II

Accumulation in script ..

Hi ,

see attached image ,

I did to calculation like this : Quantity+Alt(Peek(Q2),0) As Q2

I did from calculation like this : if(isnull(Previous(Q2)),0,Previous(Q2)) As Q1

by doing resident .

what I want is accumulate year wise ..ie from , to is accumulated totally

but i want it for each year accumulation..

here in 2014 start , from should be 0 and to should be 5 in this case.

Thanks in advance ,

Deepak Sibi

1 Solution

Accepted Solutions
sibideepak
Creator II
Creator II
Author

Thanks anbu ,

but already i have also done it ..and finished it.

View solution in original post

6 Replies
anbu1984
Master III
Master III

Can you post your script

ashfaq_haseeb
Champion III
Champion III

Hi,

Check anbu cheliyan reply here

http://community.qlik.com/thread/137531

Regards

ASHFAQ

sibideepak
Creator II
Creator II
Author

Hi anbu,

here is my script

LOAD *,

       Quantity+Alt(Peek(Q2),0) As Q2;

target2:

LOAD * INLINE [

TargetDate,product,Quantity

12-01-2013, A, 6

19-04-2013, A, 7

06-08-2013, A, 10

11-11-2013, A, 13

15-02-2014, A, 5   

11-05-2014, A, 6  

26-07-2014, A, 4 

16-12-2014, A, 2

];

target1:

LOAD Year(TargetDate) as New_Year,TargetDate, Only(product) as product,sum(Quantity) as Quantity,max(if(isnull(Previous(Q2)),0,Previous(Q2))) as from,Only(Q2) as to Resident target2 Group by Year(TargetDate),TargetDate;

DROP Table target2;

sibideepak
Creator II
Creator II
Author

help needed !!

anbu1984
Master III
Master III

LOAD *,Year(TargetDate) as New_Year,

       Quantity+Alt(Peek(Q2),0) As Q2;

target2:

LOAD Date#(TargetDate,'D-M-YYYY') As TargetDate,product,Quantity INLINE [

TargetDate,product,Quantity

12-01-2013, A, 6

19-04-2013, A, 7

06-08-2013, A, 10

11-11-2013, A, 13

15-02-2014, A, 5  

11-05-2014, A, 6 

26-07-2014, A, 4

16-12-2014, A, 2

];

target1:

LOAD New_Year,TargetDate, Only(product) as product,sum(Quantity) as Quantity,max(if(New_Year <> Previous(New_Year),0,(if(isnull(Previous(Q2)),0,Previous(Q2))))) as from,Only(Q2) as to Resident target2 Group by TargetDate,New_Year

Order by New_Year;

DROP Table target2;

sibideepak
Creator II
Creator II
Author

Thanks anbu ,

but already i have also done it ..and finished it.