Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rittermd
Master
Master

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
sunny_talwar

May be try this

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

rittermd
Master
Master
Author

Nope

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

sunny_talwar

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

rittermd
Master
Master
Author

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

sunny_talwar

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
Master
Master
Author

3.2

sunny_talwar

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

rittermd
Master
Master
Author

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.

sunny_talwar

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