# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
The #1 reason QlikView customers adopt Qlik Sense is a desire for a modern BI experience. Read More
cancel
Showing results for
Did you mean:
Highlighted
Not applicable

## How to get Previous Month

Hi Guyys,  i want to Find Out Previous Month Method. Suppose I have a One Year 2015 and 2014.. In that I want to

Compare the sum of sales month wise.. Like If I select 2015 as a Year and dec as a Month. so i get the Sum of sales

for Dec and Nov . as well if i select Year 2015 and Month Jan i get the sum of sales for Jan and Dec2014..

Kindly Help me ..

Tags (1)
14 Replies
Highlighted
Master III

Hi,

Like this???

Thanks,

AS

Highlighted
Not applicable

## Re: How to get Previous Month

hi Amit..

This is not i want.. I want only on Month Basis.. JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC ..

say i have a List Box for Month.. if i select MAR...I GET Value for MAR And FEB

Highlighted
Master III

## Re: How to get Previous Month

Hi,

Try this:

=Date(MonthStart(Max(DateField), -1), 'MMM')

Thanks,

AS

Highlighted
Creator

## Re: How to get Previous Month

Hi,

Try below expression, hope this will solve your issue

=Date((Datefield)-1,'MMM-YY')

Highlighted

## Re: How to get Previous Month

The simplest way to perform this sort of analysis is to have a month sequence number in the master calendar

Calendar:

Date,

Year(Date) As Year,

Month(Date) As Month,

Year(Date) * 12 + Month(Date) As MonthSeq,

...

Now you can use the expressions for selected month and the previous month:

Sum({<MonthSeq = {"\$(=Max(MonthSeq))"}>} Sales)

Sum({<MonthSeq = {"\$(=Max(MonthSeq) - 1)"}>} Sales)

You may need to override selections of Month and Year....

Sum({<MonthSeq = {"\$(=Max(MonthSeq))"}, Month, Year>} Sales)

Sum({<MonthSeq = {"\$(=Max(MonthSeq) - 1)"}, Month, Year>} Sales)

See

Understanding the Master Calendar (video)

Calculating rolling n-period totals, averages or other aggregations

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Highlighted
Not applicable

## Re: How to get Previous Month

Thanks Amit,

Its Working Fine.. But When i select JAN2015 its Shows the Value for DEC2015.. Can we show DEC2015 Value..

Thanks Once Again

Highlighted
Specialist III

## Re: How to get Previous Month

PFA. Hope it is you are looking for.

Highlighted
Creator III

## Re: How to get Previous Month

You need to have date field also. Create it if does not exist in model.

In Script add , Date(makedate(Year,month),'MMYYYY') as Date.

then