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: 
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.