Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Do More with Qlik - for Beginners and Beyond, Topic: Qlik Replicate on January 21, 2PM EST. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

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

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
Specialist III
Specialist III

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

Regards!
Rahul Pawar

Partner
Partner

in Variable pass As follows:

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

In Set

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


Thanks,

Arvind Patil

View solution in original post

Partner
Partner

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

Contributor III
Contributor III

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

Partner
Partner

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

Contributor III
Contributor III

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

Partner
Partner

HI Arvind,

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

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


Thanks,

Arvind Patil

Partner
Partner

let's try with the below:

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

Contributor III
Contributor III

Actually it gives 0 as output which is incorrect