Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
Showing results for 
Search instead for 
Did you mean: 

Getting Preevious Month Data in Current Month

Hi Experts,

I need to reuse the previous month value in current month. How I can achieve this please suggest.

For Example:

Mar-18 No. of Emp640
Apr-18 No. of Emp641
May-18 No. of Emp638
Jun-18 No. of Emp640
Jul-18 No. of Emp675
Aug-18 No. of Emp681
Sep-18 No. of Emp679
Oct-18 No. of Emp678
Nov-18 No. of Emp677
Dec-18 No. of Emp679
Jan-19 No. of Emp698
Feb-19 No. of Emp699
Mar-19 No. of Emp698


I have the data for March'18 to March'19.

Now I need the output as below

Mar-18 No. of Emp-
Apr-18 No. of Emp640
May-18 No. of Emp641
Jun-18 No. of Emp638
Jul-18 No. of Emp640
Aug-18 No. of Emp675
Sep-18 No. of Emp681
Oct-18 No. of Emp679
Nov-18 No. of Emp678
Dec-18 No. of Emp677
Jan-19 No. of Emp679
Feb-19 No. of Emp698
Mar-19 No. of Emp699
Apr-19 No. of Emp698


Please suggest how i can achieve this.

Thanks in advance.


2 Replies
Contributor III
Contributor III

You can use expression Above(Sum(MonthEnd)) provided the sorting is the sequence you expected.


If handling this in front end then @mcsshg2011 is probably the way to go, but if you are able to manipulate the script then you have two possible solutions. 

Manipulating the header by adding one month:


LOAD Closing, Capitalize(Date(MonthName(date#(Subfield(Closing, ' ',1), 'MMM-YY') , 1), 'MMM-YY')) & ' No. of Emp' as Opening, Monthend FROM [https://community.qlik.com/t5/New-to-Qlik-Sense/Getting-Preevious-Month-Data-in-Current-Month/m-p/1571887#M133387] (html, codepage is 1252, embedded labels, table is @1);

Reading the previous loaded data:

By fetching the Monthly amount from the previous line read you are able to get the previous month value, but you wont get a value for 'Apr-19 No. of Emp' as it is not in your data. It is also important that you are able to sort your input data correctly, hence it is reading the previous line.


Plees ekskuse my Swenglish and or Norweglish spelling misstakes