Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in Set Analysis Question

Hello, could you please help me solve a problem with using a year variable in set analysis :

Firstly, I have set the year variable with following statement -

     LET vYear_Current = Year(Today());

When I use this expression, I get the correct answer -

     =COUNT({<'StartYear' = {'2014'}>} [EMP NO.])

When I use this, I get zero as the answer -

     =COUNT({<'StartYear' = {$vYear_Current}>} [EMP NO.])

Thanks,

Wayne

1 Solution

Accepted Solutions
sasikanth
Master
Master

Try some thing like this

=COUNT({<'StartYear' = {'$(=vYear_Current)'}>} [EMP NO.])

View solution in original post

6 Replies
sasikanth
Master
Master

Try some thing like this

=COUNT({<'StartYear' = {'$(=vYear_Current)'}>} [EMP NO.])

Not applicable
Author

try,

=COUNT({<'StartYear' = {$(=vYear_Current)}>} [EMP NO.])

hope this helps.

regards,

MT

its_anandrjs
Champion III
Champion III

Try like

=COUNT({<'StartYear' =  {'$( vYear_Current )' }>} [EMP NO.])

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

=COUNT({<[StartYear] = {$(=vYear_Current)}>} [EMP NO.])


Regards,

Jagan.

Not applicable
Author

Use this Expression.

=COUNT({<'StartYear' =  {"$( vYear_Current )" }>} [EMP NO.])


And also check whether the variable passed is giving you correct value by removing the name of the expression and then hover on Expression in chart.

Not applicable
Author

Thank you all so much for replying, really appreciate it.

5 slightly different answers, no wonder I am finding the syntax in set analysis a little challenging. Just for the record, three gave me the answer I was looking for :

     =COUNT({<'StartYear' = {'$(=vYear_Current)'}>} [EMP NO.])

     =COUNT({<'StartYear' = {$(=vYear_Current)}>} [EMP NO.])    

     =COUNT({<[StartYear] = {$(=vYear_Current)}>} [EMP NO.])

     =COUNT({<'StartYear' = {$vYear_Current}>} [EMP NO.])   - my initial attempt.

It seems the = sign preceding the variable is the key.

Thanks again

Wayne