Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Just want to ask how I can achieve getting the sum of previous quarters. Let's say I have the ff. data.
Year | Qtr-Year | Source | Qty |
2013 | 201303 | B | 21312 |
2013 | 201304 | A | 21312 |
2014 | 201401 | A | 32 |
2014 | 201401 | A | 43 |
2014 | 201401 | A | 24 |
2014 | 201401 | B | 55 |
2014 | 201401 | B | 6556 |
2014 | 201402 | B | 21 |
2014 | 201402 | A | 312 |
2014 | 201402 | A | 445 |
2014 | 201402 | B | 5 |
2014 | 201402 | B | 7568 |
2014 | 201403 | A | 79 |
2014 | 201403 | A | 7878 |
2014 | 201403 | B | 23432 |
2014 | 201403 | A | 324 |
2014 | 201403 | B | 32 |
2014 | 201403 | B | 42 |
2014 | 201404 | A | 23432 |
2014 | 201404 | A | 423 |
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
Maybe something like this: (see qvw attached for script part)
Maybe something like this: (see qvw attached for script part)
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
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