# Third-Party Qlik Jobs

Highlighted
Contributor III

## Getting Current Month and Year & Previous Month and Year

Hello!

I have been calculating the current month with the expression:

=Date(Max(MakeDate(2018,MonthNum,1)),'MMM') & ' ' & Max(Year)

And the previous month with:

=Date(MonthStart(Max(MakeDate(2018, MonthNum, 1)), -1), 'MMM YYYY')

How would I go about updating it so it picks up 2019? I tried changing 2018 to 2019 but that is not working, any ideas?

Thanks!

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Getting Current Month and Year & Previous Month and Year

So, you are showing this in a text box object? Is this completely based on today's date? Why don't you just use
For current Month

`=Date(MonthStart(Today()), 'MMM YYYY')`

For Previous Month

`=Date(MonthStart(Today(), -1), 'MMM YYYY')`
4 Replies
MVP

## Re: Getting Current Month and Year & Previous Month and Year

Where are you trying to do this? What exactly is MonthNum and Year in your expressions?
Contributor III

## Re: Getting Current Month and Year & Previous Month and Year

Hi Sunny,

I have this in my master calendar:

Mastercalendar:
TempDate as ActualDate,
monthname(TempDate) as YearMonth,
monthname(TempDate) as MonthYear,
num(month(TempDate)) as MonthNum,
day(TempDate) as Day,
weekday (TempDate) as WeekDay,
week(TempDate) as Week,
year(yearstart(TempDate,0,4)) as FiscalYear,
InYearToDate(TempDate,\$(vToday),0) * -1 as CurYTDFlag,
InYearToDate(TempDate,\$(vToday),-1) * -1 as LastYTDFlag

So I'm trying to show the max Month and max year in a text box. I'm doing this so I can update my reports in NPrinitng.

MVP

## Re: Getting Current Month and Year & Previous Month and Year

So, you are showing this in a text box object? Is this completely based on today's date? Why don't you just use
For current Month

`=Date(MonthStart(Today()), 'MMM YYYY')`

For Previous Month

`=Date(MonthStart(Today(), -1), 'MMM YYYY')`
Contributor III

## Re: Getting Current Month and Year & Previous Month and Year

Hey Sunny,

Thank you that is working. I think my issue was with the filter I had in NPrinting but I was able to update that also.