# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor II

## 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

Tags (2)
1 Solution

Accepted Solutions
Valued Contributor II

## Re: Creating variables

in Variable pass As follows:

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

In Set

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

Thanks,

Arvind Patil

17 Replies
Valued Contributor II

## Re: Creating variables

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

Regards!
Rahul Pawar

Valued Contributor II

## Re: Creating variables

in Variable pass As follows:

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

In Set

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

Thanks,

Arvind Patil

Highlighted
Honored Contributor II

## Re: Creating variables

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

New Contributor II

## Re: Creating variables

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

Honored Contributor II

## Re: Creating variables

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

New Contributor II

## Re: Creating variables

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

Valued Contributor II

## Re: Creating variables

HI Arvind,

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

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

Thanks,

Arvind Patil

Honored Contributor II

## Re: Creating variables

let's try with the below:

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

New Contributor II

## Re: Creating variables

Actually it gives 0 as output which is incorrect