Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Highlighted
shraddha_g
Honored Contributor III

Re: Getting Previous month date from current month date

Try


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

MVP
MVP

Re: Getting Previous month date from current month date

If none of the expression work for you, you need to either share images or share a sample? because I am not seeing any issues with the expressions shared... it seems that something is wrong with your date field.

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Hi,

This expression is working fine for all the month with 31st date i.e. for all the month with 31st date its giving the previous date as 30th  but for the date 30th its previous value is coming out to be 30th only not 31st.

for eg if I select 31-oct-2017 then its previous value is coming out to be 30-sep-2017, but on selection of 30-sep-2017 the previous date is coming out to be 30-Aug-2017 not 31-Aug-2017.

Kindly resolve this issue as well.

Regards

Pooja Goswami

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')

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Thanks Shraddha ,

Works like charm, but I need the format to be like 31-Oct-2017 and its giving in 10/31/2017 format.

pooja821
New Contributor III

Re: Getting Previous month date from current month date

Thanks Sharddha,

The issue has been resolved.