Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cumulative sum per Week, Country and Priority

Hi Everyone,

Captura1.PNG

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,

Javier

CountStock:

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 ,

  

 

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

     

 

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

  

Resident CountStockTemp

order by WeekTemp1,CountryStart,PrioStart ;

drop table CountStockTemp,OrderStockTemp;

0 Replies