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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
lthurman
Partner - Contributor III
Partner - Contributor III

Limit years in a table

I have a range of years in my data from 01/01/2000 and 01/01/2017, but I want to 1) limit the table to displaying only the last 7 seven years and 2) only display the year. I've tried all sorts of expressions, but can't get it right. Sometimes the Expression Editor displays a syntax error, sometimes it does not, but when I click apply, I see "Invalid Dimension" in the table. How can I make this work?

Thanks

Labels (1)
1 Solution

Accepted Solutions
luismadriz
Specialist
Specialist

Hi Lorenzo,

Not sure that I follow what you try to do, but here:

When creating the dimension in your chart you could use the following expression

=If(Num(Year(DateField))>=$(vYearFrom),Year(DateField))

Which needs that you had created the following variable inyour script:

Let vYearFrom = Num(Year(Today())) - 6;

Cheers,

Luis

View solution in original post

2 Replies
luismadriz
Specialist
Specialist

Hi Lorenzo,

Not sure that I follow what you try to do, but here:

When creating the dimension in your chart you could use the following expression

=If(Num(Year(DateField))>=$(vYearFrom),Year(DateField))

Which needs that you had created the following variable inyour script:

Let vYearFrom = Num(Year(Today())) - 6;

Cheers,

Luis

lthurman
Partner - Contributor III
Partner - Contributor III
Author

Thank you, this is precisely what I'm looking for.