Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner - Creator
Partner - Creator

Return number for Month

Hi,

This script doesn't work, (MaxDate = 30 Aug 2015):

let vMN=Max(Month(addmonths(peek('MaxDate', $(m)-1, 'MaxMonth'),1)));

I need vMN to = '9' for September...and it's not returning anything at all.

let vM=Month(addmonths(peek('MaxDate', $(m)-1, 'MaxMonth'),1)); 

this script returns Sep, so why doesn't the above script work?

1 Solution

Accepted Solutions
sunny_talwar

How are you creating MaxDate??

Max(Date) as MaxDate??

If that is true, try this may be:

LET vMN = Num(Month(AddMonths(Peek('MaxDate'), 1)));

Try this:

LET vMN = Num(Month(addmonths(peek('MaxDate', $(m)-1, 'MaxMonth'),1)));

View solution in original post

3 Replies
sunny_talwar

How are you creating MaxDate??

Max(Date) as MaxDate??

If that is true, try this may be:

LET vMN = Num(Month(AddMonths(Peek('MaxDate'), 1)));

Try this:

LET vMN = Num(Month(addmonths(peek('MaxDate', $(m)-1, 'MaxMonth'),1)));

maxgro
MVP
MVP

num or rangemax

let vM=rangemax(Month(addmonths(peek('MaxDate', $(m)-1, 'MaxMonth'),1)));

Clever_Anjos
Employee
Employee

There´s no sense to use Max() in this case, because you have only one value returned by Peek