Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do I set a static filter on a chart to only show the information for a max date?

I've found some things indicating I need to do set analysis, and even found some syntax, but the challenge I'm running into is that my date field is in the format YYYY-MM.  I think that makes it a text field, and I believe using the max function isn't working properly.  Does anyone know how to do the syntax so that I can set an expression to only return the results for the max date?

Here are the two attempts I've made so far (but I think I might be getting some Qlikview syntax mixed in here....I'm really new to this, so the syntax is a challenge for me):

=Sum({<[Year-Month] = {"$(=Max([Year-Month])"}>}Count)

=sum({<[Year-Month]={'=(max([Year-Month]))'}>}Count)

3 Replies
sunny_talwar

Did you may be missed a parenthesis in your first expression?

=Sum({<[Year-Month] = {"$(=Max([Year-Month]))"}>}Count)

If you think that your Year-Month is not read as date, I would suggest you to make it read as a date in the load script like this

Date(Date#([Year-Month], 'YYYY-MM'), 'YYYY-MM') as [Year-Month]

and then try this

=Sum({<[Year-Month] = {"$(=Date(Max([Year-Month]), 'YYYY-MM'))"}>}Count)

Anonymous
Not applicable
Author

Thanks!  I took a different approach and created a Date Sort Key that was Year*12+Month so that I could use the max function without having to mess with date formatting.

This worked for me:

=Sum({<[Date Sort Key] = {"$(=Max([Date Sort Key]))"}>}Count)

sunny_talwar

Yup, that's another way to do it...