Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

pooja821
New Contributor III

Getting Previous month date from current month date

Hi,

I have a Date field with value 31-Sep-2017.

I need to get the previous month date i.e. 30-Aug-2017 from current month date.

Kindly help.

1 Solution

Accepted Solutions
shraddha_g
Honored Contributor III

Re: Getting Previous month date from current month date

Try,

Date( MonthEnd(addmonths(Max(Date#(Datefield,'DD-MMM-YYYY')),-1)),'DD-MMM-YYYY')

15 Replies
isorinrusu
Contributor II

Re: Getting Previous month date from current month date

MonthEnd(Addmonths(MYDATE,-1))

aronwilliamson
Contributor

Re: Getting Previous month date from current month date

September 2017 would be 30th as it only has 30 days.

Are you trying to get the last(previous) months max date?

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Not Working Sorin.

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Yes Aron.

Like for 30-Sep-2017, I should get 31-Aug-2017.

Re: Getting Previous month date from current month date

May be this

Date(Floor(MonthEnd(Max(DateField), -1)))

Highlighted
pooja821
New Contributor III

Re: Getting Previous month date from current month date

Not Working Sunny.

How would it calculate the max value from the Date in your expression.

I tried using this expression in KPI, but still not getting the result. Just Blank.

isorinrusu
Contributor II

Re: Getting Previous month date from current month date

Pooja, is it in date format?

Do you use a max month to do it?

For example, this works: monthend(addmonths(MakeDate(2017,6),-1))

Re: Getting Previous month date from current month date

I guess you need to check if your date is read as date by qlikview or not. It seems that it is not read as date

Why don’t my dates work?

QlikView Date fields

Get the Dates Right

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Yes, it is in date format.

I have a field named DATE with several dates in it.

Community Browser