Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Cumulative sum per Week, Country and Priority

Hi Everyone,


I want to calculate stock per week, country and Priority. So when i usee it in a chart with the dimension Week and the field Stock. It shows the accumulate of the stock.

Thanks for your time,



Load *,

WeekTemp1 &'|'& [CountryStart] &'|'& [PrioStart] as K_WStart_Country_Prio,  

   If(AutoNumberHash128(WeekTemp1,CountryStart,PrioStart)=Previous((AutoNumberHash128(Peek('WeekTemp1'), Peek('CountryStart'),Peek('PrioStart')))),


  Peek([Cumulative qty])+Stocksinacumular,Stocksinacumular) as Stock2 ,






   RangeSum(Stocksinacumular, Peek('Stock3'))) as Stock3


Resident CountStockTemp

order by WeekTemp1,CountryStart,PrioStart ;

drop table CountStockTemp,OrderStockTemp;

Community Browser