Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I’m using this for accumulating 1 dimension (Date) ,
test1:
load
CalendarDate,
country,
DailySales,
If(RowNo() = 1, DailySales, Peek('AccumulatedSales') + DailySales) AS AccumulatedSales
resident test;
you can see that the accumulation is made for the date excluding the country. (you see below only sample of the data)
how can I adjust it to 2 dimensions?
Thanks.
Date | country | DailySales | AccumulatedSales |
7/24/2013 | Afghanistan - AF | 7 | 34794 |
7/24/2013 | Albania - AL | 1 | 34824 |
7/23/2013 | Afghanistan - AF | 0 | 34787 |
7/23/2013 | Albania - AL | 3 | 34823 |
7/22/2013 | Afghanistan - AF | 5 | 34787 |
7/22/2013 | Albania - AL | 1 | 34820 |
7/21/2013 | Afghanistan - AF | 9 | 34782 |
7/21/2013 | Albania - AL | 1 | 34819 |
7/20/2013 | Afghanistan - AF | 10 | 34773 |
7/20/2013 | Albania - AL | 0 | 34818 |
7/19/2013 | Afghanistan - AF | 10 | 34763 |
7/19/2013 | Albania - AL | 1 | 34818 |
7/18/2013 | Afghanistan - AF | 7 | 34753 |
7/18/2013 | Albania - AL | 0 | 34817 |
7/17/2013 | Afghanistan - AF | 13 | 34746 |
7/17/2013 | Albania - AL | 1 | 34817 |
7/16/2013 | Afghanistan - AF | 17 | 34733 |
7/16/2013 | Albania - AL | 2 | 34816 |
7/15/2013 | Afghanistan - AF | 54 | 34716 |
7/15/2013 | Albania - AL | 20 | 34814 |
test1:
load
CalendarDate,
country,
DailySales,
If(country<>previous(country), DailySales, Peek('AccumulatedSales') + DailySales) AS AccumulatedSales
resident test
order by country CalendarDate;
this will accumulate the sales for each country by date
Have a look at this post: http://community.qlik.com/message/100042#100042
Jonathan
test1:
load
CalendarDate,
country,
DailySales,
If(country<>previous(country), DailySales, Peek('AccumulatedSales') + DailySales) AS AccumulatedSales
resident test
order by country CalendarDate;
this will accumulate the sales for each country by date
If(country=revious(country), DailySales, Peek('AccumulatedSales') + DailySales) AS AccumulatedSales
thanks