Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

debabrata_sahoo
New 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

Re: How to get previous month sales for the current year.

try this

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

7 Replies
arvind_patil
Valued Contributor III

Re: How to get previous month sales for the current year.

Create it into date and do it as follows:

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

Thanks & Regards,
Arvind Patil

Re: How to get previous month sales for the current year.

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

debabrata_sahoo
New Contributor III

Re: How to get previous month sales for the current year.

Hi Arvind ,

Thanks for reply but this code not working.

Highlighted
arvind_patil
Valued Contributor III

Re: How to get previous month sales for the current year.

Hi,

 

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

 

Thanks & regards,

Arvind Patil

debabrata_sahoo
New Contributor III

Re: How to get previous month sales for the current year.

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

 

Re: How to get previous month sales for the current year.

try this

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

debabrata_sahoo
New Contributor III

Re: How to get previous month sales for the current year.

Thanks sunny. its working now.