Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
DestinedTale
New Contributor

Max (Month Year)

Hi,

i have a field in a  file 20190220080003 where i change the format of it from timestamp to MMM-YY in script.

When i want to display the months, it will show string 42826 instead of the format i want.

0~20190220080003~98853

let DateTimeStamp=Peek('DateTimeStamp', 0, 'LastLine');

let MonthYear=Date(Date#('01/'&mid($(DateTimeStamp),5,2)&'/'&Left($(DateTimeStamp),4)),'MMM-YY');

=[Month Year] = Apr 17

=max([Month Year]) = 42826

screenshot.PNG

1 Solution

Accepted Solutions

Re: Max (Month Year)

Try this?

Date(max([Month Year]),'MMM YY')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
3 Replies

Re: Max (Month Year)

Try this?

Date(max([Month Year]),'MMM YY')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
passionate
Valued Contributor

Re: Max (Month Year)

these is number format for your date.

you can use date(max(timestamp),'MMM-YY')

MVP & Luminary
MVP & Luminary

Re: Max (Month Year)

Others have pointed out that you will need the date() formatting function because max() returns a number.  I'd also suggest that you can get rid of the complex string parsing by reading the timestamp string with the TimeStamp#() function.

let DateTimeStamp=TimeStamp#(Peek('DateTimeStamp', 0, 'LastLine'),'YYYYMMDDhhmmss');

Then you have a proper Qlik timestamp and can use functions like 

let MonthYear MonthStart(DateTimeStamp);

-Rob