Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am trying to get the cumulative sales per Booking Date per Service Month.
Please see below...
Service Month | Booking Date | Sales | Cumulative Sales |
Jul-14 | 2014-01-15 | 851 | 851 |
Jul-14 | 2014-02-01 | 100 | 951 |
Jul-14 | 2014-04-10 | 150 | 1101 |
Jul-14 | 2014-07-15 | 292 | 1393 |
Jul-14 | 2014-07-18 | 356 | 1749 |
Aug-14 | 2014-03-23 | 659 | 659 |
Aug-14 | 2014-08-23 | 784 | 1443 |
Aug-14 | 2014-08-25 | 254 | 1697 |
Aug-14 | 2014-08-28 | 169 | 1866 |
Sep-14 | 2014-04-19 | 32 | 32 |
Sep-14 | 2014-05-12 | 524 | 556 |
Sep-14 | 2014-05-28 | 94 | 650 |
Sep-14 | 2014-08-09 | 863 | 1513 |
Sep-14 | 2014-09-21 | 97 | 1610 |
Oct-14 | 2014-10-01 | 899 | 899 |
Oct-14 | 2014-10-13 | 966 | 1865 |
Oct-14 | 2014-10-16 | 444 | 2309 |
I am trying to get field 'Cumulative Sales' ..
Any suggestions will be appreciated.
Regards,
Magen
Hi,
try this it would be helpful to you
Load *,numsum(Sales+peek([Cumm Sales]) as [Cumm Sales]
resident Table;
tmp:
LOAD [Service Month], date(date#([Booking Date],'YYYY-MM-DD')) as [Booking Date], Sales, [Cumulative Sales]
FROM [http://community.qlik.com/thread/139744] (html, codepage is 1252, embedded labels, table is @1);
final:
load
*,
if(peek([Service Month])<>[Service Month], Sales, Sales + peek(NewCumSales)) as NewCumSales
Resident tmp
order by [Service Month], [Booking Date];
DROP Table tmp;
Duplicate post Cumulative total in script