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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use of variables in Set Analysis

I feel I'm missing something very obvious here. Can someone please tell me the difference between these two expressions?

This expression returns data:

Count({<MATTER.MATTER_OPEN_YEAR={'2014'}>} MATTER.CLNT_MATT_CODE)

This expression does not. The currentYear variable contains the value '2014', which I have confirmed by displaying the contents in a text box. The expression editor shows no errors.

Count({<MATTER.MATTER_OPEN_YEAR={$(currentYear)}>} MATTER.CLNT_MATT_CODE)

Many thanks, Gavin

14 Replies
Not applicable
Author

well, I would use the equal sign + double quotes. Sth like (but not tested):

Count({<MATTER.MATTER_OPEN_YEAR={“= $(currentYear)”}>} MATTER.CLNT_MATT_CODE)

Fabrice

Not applicable
Author

Hi Michael,

Unfortunately the file is very large - I'm not sure if the screenshots below will help?

currentPeriod variable: ScreenHunter_09 Jan. 21 09.03.gif

currentYear variable:

ScreenHunter_10 Jan. 21 09.03.gif

textbox to verify:

ScreenHunter_10 Jan. 21 09.04.gif

Chart + formula with hardcoded '2014':

ScreenHunter_10 Jan. 21 09.06.gif

Chart + formula with currentYear variable (have tried with single, double and no quotes):

ScreenHunter_11 Jan. 21 09.06.gif

Thanks, Gavin

Not applicable
Author

Hi Alessandro - That returns a 'Y':

ScreenHunter_11 Jan. 21 09.14.gif

(Please also see the just-attached screenshots above)

Thanks, Gavin

Not applicable
Author

Thank you Aunez. The use of double quotes, plus the extra = sign within them, works, i.e.:

Count({<MATTER.MATTER_OPEN_YEAR={"=$(currentYear)"}>} MATTER.CLNT_MATT_CODE)

Gavin

Anonymous
Not applicable
Author

Gavin,

Explanation of the problem and the solution:

Your variable content is not '2014' - it is expression 'left($(currentPeriod),4)'.  The text box to verify had to be
=currentYear

That's why the solution from AUNEZ FABRICE resolved the problem by adding "=" before the variable.

Regards,

Michael

PS: Regarding file upload - you can always use "data reduction" and scrambling.