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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting previous quarters

Hi All,

Just want to ask how I can achieve getting the sum of previous quarters. Let's say I have the ff. data.

YearQtr-YearSourceQty
2013201303B21312
2013201304A21312
2014201401A32
2014201401A43
2014201401A24
2014201401B55
2014201401B6556
2014201402B21
2014201402A312
2014201402A445
2014201402B5
2014201402B7568
2014201403A79
2014201403A7878
2014201403B23432
2014201403A324
2014201403B32
2014201403B42
2014201404A23432
2014201404A423

I need to get all the sum of qty where source = A. I need to output in a table the sum({<source A>}qty) - previous sum({<source A>}Qty) / previous sum({<source A>}Qty) .

As much as possible I want to implement this in the script as I do not want to use column() in the table.

Thanks,

Lyn

1 Solution

Accepted Solutions
danieloberbilli
Specialist II
Specialist II

Maybe something like this: (see qvw attached for script part)

Capture.PNG.png

View solution in original post

3 Replies
danieloberbilli
Specialist II
Specialist II

Maybe something like this: (see qvw attached for script part)

Capture.PNG.png

Not applicable
Author

Hi,

Yes this is what i'm looking for. although I have a question. Is previous() the one I should use to look for the previous quarters? Thank you

danieloberbilli
Specialist II
Specialist II

Yes, but only in this example: note that I first sorted the table ascending by Qtr-Year, then I avoided the first row for the calculation and for the rest used the previous expression