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: 
Anonymous
Not applicable

Set Analysis - Greater than Year

I've seen this question asked and answered, but I can't seem to get it to work for me.

I'm trying to limit a bar chart based on year. If I do this in the measure, things work fine - I only see 2016 data:

Count({<[InitDate.autoCalendar.Year] = {'2016'}>}ID)

2016.png

But if I try to show only data greater than a certain year, all data shows up:

Count({<[InitDate.autoCalendar.Year] = {'>=2016'}>}ID)

all.png

Is there something wrong with my syntax? Or something else going on?

Thanks,

Mike

12 Replies
vinieme12
Champion III
Champion III

Count({<[InitDate.autoCalendar.Year] = {">=2016"}>}ID)


Use double quotes

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thanks Vineeth, but there's no change - still shows all years.

anushree1
Specialist II
Specialist II

Hi Mike,

The Same expression seems to work well with me(Please refer the attached file !). could you please share a sample to show where the problem is

vinieme12
Champion III
Champion III

If your year field is numeric then this will work!

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
CarlosAMonroy
Creator III
Creator III

Hi Mike,

I guess is not your expression, but the year format. You have to make sure the field has 'num' format or is going to screw up your expressions like that.

Hope that helps,

Carlos M

vinieme12
Champion III
Champion III

Can you post the app

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Hi Vineeth,

I'm very new to Qlik Sense, and do not know how to post the app. Could you please point me to a reference on how to do that?

Thank you,

Mike

Anonymous
Not applicable
Author

Hi Carlos,

That could be, but I'm not sure how to have the 'num' format. 'InitDate' is a smalldatetime field in Sql Server, is being loaded in the script, and the auto-generated autoCalendar has created the Year property:

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

MK9885
Master II
Master II

Maybe use

Count({<[InitDate.autoCalendar.Year] = {">=$(2016)"}>}ID)

Add $ after >=

or if you want it to be dynamic instead of hardcoding, create a variable

vLast5Year = Year(Today())-5

and use

Count({<[InitDate.autoCalendar.Year] = {">=$(vLast5Year)"}>}ID)

Using variable should work.