Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
Valued Contributor II

Re: Getting previous quarters

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

Capture.PNG.png

3 Replies
danieloberbilli
Valued Contributor II

Re: Getting previous quarters

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

Capture.PNG.png

Not applicable

Re: Getting previous quarters

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
Valued Contributor II

Re: Getting previous quarters

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

Community Browser