Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Zwax
Contributor III
Contributor III

Set analysis syntax

Hi,

I do not yet get set analysis that well, so this might be a dumb question. 

Is it possible to make a statement that you want a field to be in something, but still selectable? 

Example:

Field: EventCode

I want it to always be within specific codes. Let say 450,455 & 550. If no user selection, I want to count all of the defined codes. But if the user select one of the eventcodes, I want only that one to be counted.

What my expression looks like now:

=Count(
{
<State={1},EventCode={450,455,550},Parameter={9}>
}EventTime
)

I have tried to add the $

=Count(
{$
<State={1},EventCode={450,455,550},Parameter={9}>
}EventTime
)

=Count(
{
<State={1},EventCode={$450,455,550},Parameter={9}>
}EventTime
)

, but it did not change anything. I guess by saying "EventCode={450,455,550}", I'm actually telling it to always show the eventcodes no matter what. 

So my question: Is it possible to dictate that the eventcode has to be within some values, but still make them selectable?

Labels (2)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Yes you can; using implicit set operator '*' like:

 

EventCode *={450,455,550}

View solution in original post

3 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

try in this way:

1) add a variable 

=if(GetSelectedCount(EventCode)=0,Replace(' 455 ' & ',' & ' 450 ' & ',' & ' 550 ',' ',chr(39)),chr(39) & Concat(EventCode,chr(39) & ',' & chr(39)) & chr(39))

2) then use that variable inside set analysis

EventCode={$(variable)}

tresesco
MVP
MVP

Yes you can; using implicit set operator '*' like:

 

EventCode *={450,455,550}

Zwax
Contributor III
Contributor III
Author


@tresesco wrote:

Yes you can; using implicit set operator '*' like:

 

EventCode *={450,455,550}


Yaaaassss. Great. Thank you 😁