Skip to main content

# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for
Search instead for
Did you mean:
Contributor II

## Variable with multiple values used in Set Analysis

Hello all,

I was wondering if someone can point me in the right direction.  Basically I have a variable varGeographicalArea that is defined as follows:

varGeographicalArea = =if(Left(GetFieldSelections([Geographical Area]),3) = 'NOT','NOT',replace(Concat(DISTINCT chr(39)&GetFieldSelections([Geographical Area])&chr(39),','),',',chr(39)&', '&chr(39)))

So this variable can have multiple values contained in it.  e.g. 'Place_A', 'Place_B', 'Place C'

Now, when I stick this variable in a formula for a textbox, it only seems to give me the total value for the first value held within the variable varGeographicalArea.  This is despite the variable varGeographicalArea holding the value 'Place_A', 'Place_B', 'Place_C'.  Here is the formula I'm using for the textbox:

=Sum({1<[Geographical Area] = {\$(varGeographicalArea)}>} [Incident_Count])

So, rather than expecting the total for geographical areas 'Place_A', 'Place_B', and 'Place_C', I am only getting a total for geographical Area 'Place_A'.

Any help much appreciated.

1 Solution

Accepted Solutions
MVP & Luminary

A variable could contain only one single value at the same time and therefore you couldn't use them within the set analysis on a row-level. But I think in your case the following should be working:

=Sum({1<[Geographical Area] = p([Geographical Area])>} [Incident_Count])

- Marcus

6 Replies
MVP

Try this as your variable

varGeographicalArea = =Chr(39) & GetFieldSelections([Geographical Area], Chr(39) & ',' & Chr(39), 10000) & Chr(39)

MVP & Luminary

A variable could contain only one single value at the same time and therefore you couldn't use them within the set analysis on a row-level. But I think in your case the following should be working:

=Sum({1<[Geographical Area] = p([Geographical Area])>} [Incident_Count])

- Marcus

Contributor II
Author

I think that's sorted the issue out very nicely!  Thank you very much for the speedy response.

Contributor II
Author

Hello Marcus - funnily enough your answer was spot on too!  Can we mark multiple posts as being the correct answer???

Thank you very much for getting back to me too.

MVP

I think marcus_sommer‌'s response deserve the correct answer here

Contributor II
Author

Done.  Thank you for your honesty.

Community Browser