Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner Ambassador
Partner Ambassador

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

View solution in original post

4 Replies
brian_booden
Partner Ambassador
Partner Ambassador

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

sunny_talwar

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
Author

Thank you for your help.

Both answers works.

Regards

sunny_talwar

Awesome

Glad we were able to help.

Best,

Sunny