Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

How to get previous month sales for the current year.

How to get previous month sales for the current year. In my table YEAR,MONTH,SALES are there. MONTH format is 'MMMYY'.

please help me to write set analysis for sum  of sales of previous months.

 

Thanks in advance.

1 Solution

Accepted Solutions
Highlighted

try this

Sum({<Month = {"$(=Date(MonthStart(Max(Month), -1), 'MMMYY'))"}>}Sales)

View solution in original post

7 Replies
Highlighted
Partner
Partner

Create it into date and do it as follows:

Sum({<MONTH={'$(=Date#(Addmonths(Date(Date#(MONTH,'MMMYY')),-1),'MMMYY')}>}Sales)

Thanks & Regards,
Arvind Patil
Highlighted

I think you might need to use Inter-Record Functions here

Highlighted
Contributor III
Contributor III

Hi Arvind ,

Thanks for reply but this code not working.

Highlighted
Partner
Partner

Hi,

 

Kindly provide me sample data so i can give you exact op.

 

Thanks & regards,

Arvind Patil

Highlighted
Contributor III
Contributor III

Year      Month    Sales
2017     Sep17     300
2017     Oct17     340
2017     Nov17     345
2017     Dec17     674
2018     Jan18     235
2018     Feb18     564 

In A text object i want to display previous month Sum of sales .

it will be 235

 

Highlighted

try this

Sum({<Month = {"$(=Date(MonthStart(Max(Month), -1), 'MMMYY'))"}>}Sales)

View solution in original post

Highlighted
Contributor III
Contributor III

Thanks sunny. its working now.