Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Week 2: Presenting "Automate Sucess" and "Integration for Innovation" - WATCH NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis: more values of Field from variable

Hi,

I have this trouble:

my variable gets the selected values of a field:

     set v_tipologia =GetFieldSelections(Tipo.Selezione,',',20);

for example, a possible return is the following string:

     Delta,Disp

I need use it in the following graph expression but not work:

     Count({$<Tipologia2={'$(v_tipologia)'}>}[Key ATT])

Any aid?

Thanks so much!

1 Solution

Accepted Solutions
Kushal_Chawda

Create Variable on front end like this

v_tipologia =Concat(distinct Chr(39)&Tipo.Selezione&chr(39),',');



Now write the expression


Count({$<Tipologia2={$(v_tipologia)}>}[Key ATT])


Expression will show error but it will work.

View solution in original post

9 Replies
Chanty4u
MVP
MVP

u miss single quote?

     set v_tipologia ='GetFieldSelections(Tipo.Selezione,',',20)';

Not applicable
Author

I mean the problem is the graph expression no the variable. Yours doesn't work

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this.

Count({<Tipo.Selezione = {$(=GetFieldSelections(Tipo.Selezione))}>}DISTINCT [Key ATT])

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
tamilarasu
Champion
Champion

Hi,

Try,

Count({<[Tipo.Selezione]={'$(=concat(distinct [Tipo.Selezione],chr(39)&','&chr(39)))'}>}Open)

Not applicable
Author

I have tried both suggests but they count all elements [Key ATT], without considerering the set

Kushal_Chawda

Create Variable on front end like this

v_tipologia =Concat(distinct Chr(39)&Tipo.Selezione&chr(39),',');



Now write the expression


Count({$<Tipologia2={$(v_tipologia)}>}[Key ATT])


Expression will show error but it will work.

Not applicable
Author

Perfect! Thanks

perumal_41
Partner - Specialist II
Partner - Specialist II

try below one

v_tipologia = =chr(39)& Replace(GetFieldSelections(Tipo.Selezione,',',20),',',chr(39)&','&chr(39))&chr(39)

Count({$<Tipologia2={$(v_tipologia)}>}[Key ATT])

sunny_talwar

This should also work:

LET v_tipologia = Chr(39) & GetFieldSelections(Tipo.Selezione,Chr(39) & ',' & Chr(39), 20) & Chr(39);

and then your count expression needs to be without single quotes:

Count({$<Tipologia2={$(v_tipologia)}>}[Key ATT])