Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
arvindjha2050
Creator
Creator

Creating variables

Hello Team,

I am trying to create variable in Qliksense with multiple values but it's not working for which i tried various combinations.

While creating a variable say with expression  : 'January'                              -----This works

But when i want multiple values it doesn't work : 'January;February'             -----This doesn't work

How to correctly define them such that they can be used in set expressions?

Thanks & Regards,

Arvind Kumar Jha

1 Solution

Accepted Solutions
arvind_patil
Partner - Specialist III
Partner - Specialist III

in Variable pass As follows:

vMonth    'Jan','Feb','Mar'

In Set

Sum({<Month={$(vMonth)}>}Sale)


Thanks,

Arvind Patil

View solution in original post

17 Replies
rahulpawarb
Specialist III
Specialist III

Could you please share the set expression where you are thinking to use the said variable?

Regards!
Rahul Pawar

arvind_patil
Partner - Specialist III
Partner - Specialist III

in Variable pass As follows:

vMonth    'Jan','Feb','Mar'

In Set

Sum({<Month={$(vMonth)}>}Sale)


Thanks,

Arvind Patil

agigliotti
Partner - Champion
Partner - Champion

did you try to replace variable with string value in set analysis ?

arvindjha2050
Creator
Creator
Author

I have already tried above but it doesn't work , Error in expression

agigliotti
Partner - Champion
Partner - Champion

try using numbers for months, ex. 1 for jan, 2 for feb and so on...

arvindjha2050
Creator
Creator
Author

Hello Andrea,

Below is the set expression :

sum({$<[Sales Month] = {$(vMonth)}>} Sales)

Below is the variable :

vMonth = 'Jan'           ----This gives sum of sales for Jan

vmonth = 'Jan','Feb'

                'Jan,Feb';        etc etc      ----- I have tried various permutations and combinations with comma and semicolon but couldn't get sum of sales for both Jan and Feb

arvind_patil
Partner - Specialist III
Partner - Specialist III

HI Arvind,

It shows error in expression but it works. else try below one:

Sum({<Month={'vMonth'}>}Sale)


Thanks,

Arvind Patil

agigliotti
Partner - Champion
Partner - Champion

let's try with the below:

sum( {$< [Sales Month] = {1,2} >} Sales )

arvindjha2050
Creator
Creator
Author

Actually it gives 0 as output which is incorrect