Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
rittermd
Honored Contributor

Limit Dimensions to Last 5 Years

I am trying to limit the bars in my chart to only show the last 5 years.

I have coded this set analysis.  But something is off and not working and I am just not seeing it.

Count({$<[Hire_Date_Most_Recent.autoCalendar.Year]={">=$(=vCurrentYear-5)"}>}EmployeeID)

vCurrentYear = 2017

I got this set analysis to work.  But it is not what I ultimately want.

Count({$<[Hire_Date_Most_Recent.autoCalendar.Year] = {">=$(=date(today()-2100))"} >} Employee_ID)

21 Replies

Re: Limit Dimensions to Last 5 Years

May be try this

Count({$<[Hire_Date_Most_Recent.autoCalendar.Year]={">=$(=(vCurrentYear)-5)"}>}EmployeeID)

rittermd
Honored Contributor

Re: Limit Dimensions to Last 5 Years

Nope

I get no errors in the expression builder.  But it is not limited the data in the chart.

Re: Limit Dimensions to Last 5 Years

How do you define vCurrentYear? Can you try vCurrentYear - 5 in a KPI Object to see if it gives you 2012 or 2013

rittermd
Honored Contributor

Re: Limit Dimensions to Last 5 Years

I actually did that and it returns the year value that I want.

Re: Limit Dimensions to Last 5 Years

Do you have an old version of Qlik Sense or new? I remember people saying a while ago, where they had set analysis issues with auto-generated calendar fields. Wonder if that is the issue here as well

rittermd
Honored Contributor

Re: Limit Dimensions to Last 5 Years

3.2

Re: Limit Dimensions to Last 5 Years

That doesn't seem too old... not sure... can you share screenshots?

rittermd
Honored Contributor

Re: Limit Dimensions to Last 5 Years

As I said in original post this expression works

Count({$<[Hire_Date_Most_Recent.autoCalendar.Year] = {">=$(=date(today()-2100))"} >} Employee_ID)


So I don't think it is an issue with the autoCalendar field or this wouldn't work either.  I would think.

Re: Limit Dimensions to Last 5 Years

You are right.... Can you share your app or screenshots?