Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

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)


3 Replies

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)

Contributor II
Contributor II

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)


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