Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

lthurman
New 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

1 Solution

Accepted Solutions
luismadriz
Valued Contributor

Re: Limit years in a table

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

2 Replies
luismadriz
Valued Contributor

Re: Limit years in a table

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
New Contributor III

Re: Limit years in a table

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