Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

narband2778
New Contributor III

Trying to use a variable In Set Analysis

Hello Everyone,

I have created a Variable in the Variables

vCurrentSelection =SubField(GetCurrentSelections(), ':',2)

and now I am trying to use the variable in Set analysis, but it is not working

=Count({<[Session  Name] = {"$(=vCurrentSelection)"}>}[Session  Name])

Can someone help me with this.

thanks in advance.

Naresh

1 Solution

Accepted Solutions

Re: Trying to use a variable In Set Analysis

My bad... can you try this

=Count({<[Session  Name] = p($(='[' & SubField(GetCurrentSelections(), ':', 1) & ']'))>} [Session  Name])

43 Replies
praveenkumar_ma
Contributor

Re: Trying to use a variable In Set Analysis

Hi Naresh ,

Try this ...

=Count({<[Session  Name] = {'$(vCurrentSelection)'}>}[Session  Name])

or

=Count({<[Session  Name] = {='$(vCurrentSelection)'}>}[Session  Name])

Mightbe helpful..

Thanks

PM

narband2778
New Contributor III

Re: Trying to use a variable In Set Analysis

Not working.

praveenkumar_ma
Contributor

Re: Trying to use a variable In Set Analysis

Try this...

=Count({<[Session  Name] = {"$(vCurrentSelection)"}>}[Session  Name])

Might be Helpful..

Thanks

PM

narband2778
New Contributor III

Re: Trying to use a variable In Set Analysis

Not good Praveen. i am getting the result 0.

I am using the hard coded value then I am getting the count for below expression.

=Count({<[Session  Name] = {'XYZ'}>}[Session  Name])

praveenkumar_ma
Contributor

Re: Trying to use a variable In Set Analysis

Try this or Previous

=Count({<[Session  Name] = {"'=$(vCurrentSelection)'"}>}[Session  Name])

and in Variable Defination do you have '=' front of Defination

just for info..

this might helpful

Thanks

PM

narband2778
New Contributor III

Re: Trying to use a variable In Set Analysis

yes, have '=' sign before variable.

praveenkumar_ma
Contributor

Re: Trying to use a variable In Set Analysis

Try this..

=Count({<[Session  Name] = {'"=$(vCurrentSelection)"'}>}[Session  Name])

Regards

PM

Chanty4u
Esteemed Contributor III

Re: Trying to use a variable In Set Analysis

try this too

Try this..

=Count({<[Session  Name] = {'$(=vCurrentSelection)'}>}[Session  Name])

narband2778
New Contributor III

Re: Trying to use a variable In Set Analysis

still the same. I am getting the value '0'.

Thanks,

Naresh

Community Browser