Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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)
But if I try to show only data greater than a certain year, all data shows up:
Count({<[InitDate.autoCalendar.Year] = {'>=2016'}>}ID)
Is there something wrong with my syntax? Or something else going on?
Thanks,
Mike
Count({<[InitDate.autoCalendar.Year] = {">=2016"}>}ID)
Use double quotes
Thanks Vineeth, but there's no change - still shows all years.
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
If your year field is numeric then this will work!
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
Can you post the app
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
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'),
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.