Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Variable in Measure

Hi,

I Have a problem with Qlik Sense.

I have a variable in my script :

SET JournalTreso1=CA Banque;

I have created a measure in order to have the sum SOLDE when JOURNAL = CA Banque

sum({$<JOURNAL=$(JournalTreso1)>}SOLDE)

But It doesn't work.

Is-it possible to use variable in measure with qlik sense ?

Thank you for your help

Sincerely

1 Solution

Accepted Solutions
brian_booden
Contributor

Re: Variable in Measure

Hi Julien,

Try this:

sum({$<JOURNAL={'$(JournalTreso1)'}>}SOLDE)


When evaluating a field against a string in set analysis, you need the curly brackets and single quotes around the evaluated variable.


Regards,

Brian

4 Replies
brian_booden
Contributor

Re: Variable in Measure

Hi Julien,

Try this:

sum({$<JOURNAL={'$(JournalTreso1)'}>}SOLDE)


When evaluating a field against a string in set analysis, you need the curly brackets and single quotes around the evaluated variable.


Regards,

Brian

MVP
MVP

Re: Variable in Measure

Try to Set the variable with single quotes and see if that works:

SET JournalTreso1 = 'CA Banque';


and then use the following expression


Sum({$<JOURNAL={'$(JournalTreso1)'}>}SOLDE)

HTH

Best,

Sunny

Not applicable

Re: Variable in Measure

Thank you for your help.

Both answers works.

Regards

MVP
MVP

Re: Variable in Measure

Awesome

Glad we were able to help.

Best,

Sunny