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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max date from a string

Hi I have a source file which stores dates as in this format '2000 Jan'.

Now I want to find the latest date so I use Max(datefield)

But all I get is a blank value. Any help?

I am guessing that it could be considering my field as string and hence the max function isn't working..

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try:

Date(Max(Date#(datefield, 'YYYY MMM')))

View solution in original post

5 Replies
tresesco
MVP
MVP

Try:

Date(Max(Date#(datefield, 'YYYY MMM')))

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Date(Max(Date#(DateDimensionName, 'YYYY MMM')))


Hope this helps you.


Regards,

Jagan.

morganaaron
Specialist
Specialist

If you need to keep the same format (Year and Month only) you could use either:

MonthName(Max(Date#(Datefield, 'YYYY MMM')))

or

Year(Max(Date#(Date, 'YYYY MMM'))) & ' ' & Month(Max(Date#(Date, 'YYYY MMM')))

MarcoWedel

MonthName(Max(Date#(Datefield, 'YYYY MMM')))


is the better choice, because it keeps the numerical value, so no sorting or calculation issues.

hope this helps

regards

Marco


jagan
Partner - Champion III
Partner - Champion III

Hi,

If you got the solution please close this thread by giving Correct and Helpful Answers.

Regards,

Jagan.