Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Variables in set analysis

Hello!

I am working on a histogram bar chart. I am trying to make it so when I select a company from a filter pane the chart updates with data only from the companies with the same asset range (eg. the user selects Company A which has an asset range of 1 million - 2 million and the chart updates with data from companies who only have asset range of 1million - 2 million)

Here is what I have so far which doesn't work:

Count({1<[AssetRange]= P({1<[company]= $(vCompany) >} [AssetRange]) >}[ParticipationRate])

where I have defined vCompany = GetFieldSelections([company]). When I try to hard code the company in like this:

Count({1<[AssetRange]= P({1<[company]= {'CompanyA'} >} [AssetRange]) >}[ParticipationRate])


I get the desired result. My question is, what am I doing wrong as far as using the variable in this case. Please feel free to ask any clarifying questions, or let me know if anything is ambiguous.


Thanks in advance

1 Solution

Accepted Solutions
MVP
MVP

Re: Variables in set analysis

Yes, it puts a single quotes. Can you try this:

Count({1<[AssetRange]= p({1<[company]= p(company)>} [AssetRange])>}[ParticipationRate])

5 Replies
MVP
MVP

Re: Variables in set analysis

Try this:


Set vCompany = Chr(39) & GetFieldSelections([company], Chr(39) & ',' & Chr(39)) & Chr(39)

Not applicable

Re: Variables in set analysis

That puts quotes around the output of GetFieldSelections right? It didn't work but I will continue playing around with it. Thanks!

MVP
MVP

Re: Variables in set analysis

Yes, it puts a single quotes. Can you try this:

Count({1<[AssetRange]= p({1<[company]= p(company)>} [AssetRange])>}[ParticipationRate])

Not applicable

Re: Variables in set analysis

Is that right? I see 2 set analysis tags being opened and 3 being closed. This is what ended up working for me based on your answer above:

Count({1<[AssetRange]= p({1<[company]= p(company)>}[AssetRange]) >}[ParticipationRate])



MVP
MVP

Re: Variables in set analysis

My bad