

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Get Previous Month from Today's date
Dear All
How i can get Previous month from Current date as i need to generate QVD and use Month and Year as their filed using system date.
Thanks
Kushal Thakral
- Tags:
- new_to_qlikview
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Previous month
Month(AddMonths(Today(),-1))
Previous Year
Year(AddMonths(Today(),-1))
Current Month
Month(Today())
Current Year
Year(Today())

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Month(Today())-1 as PreviousMonth
Update : The above will give you month number.
If you want month number, use below
in script
=Subfield('$(MonthNames)',';',Month(Today())-1) as PreviousMonth
in UI
=Subfield('$(MonthNames)',';',Month(Today())-1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Month(AddMonths(Today(),-1))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Write like
Month(Max(DateField))-1 as PreviousMonth
What is mean for QVD generate and used Month Year

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Manish,
If Month is January, Month(Today())-1 is zero and you will get nothing from this expression
Subfield('$(MonthNames)',';',Month(Date#('01/01/2014','D/M/YYYY'))-1)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IF(Month(Date(YourDateField))-1=0,12,Month(Date(YourDateField))-1)
or
=Subfield('$(MonthNames)',';',IF(Month(Date(YourDateField))-1=0,12,Month(Date(YourDateField))-1))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All
I dont have Date field so need to calculate Month and Year using system date
So can you help with the same.
Thanks
Kushal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IF(Month(Today())-1=0,12,Month(Today())-1)
or
=Subfield('$(MonthNames)',';',IF(Month(Today())-1=0,12,Month(Today())-1))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Previous month
Month(AddMonths(Today(),-1))
Previous Year
Year(AddMonths(Today(),-1))
Current Month
Month(Today())
Current Year
Year(Today())

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kushal,
You try the following Syntax-:
=SUM({<MONTH={">=$(=MIN(MONTH)-1)<=$(=MAX(MONTH)-1)"}>}FIELDNAME)
it definitely work.

- « Previous Replies
-
- 1
- 2
- Next Replies »