Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help with Set Analysis syntax

1) I am trying to convert the below IF statement using  set analysis.  The below IF statement is capturing correctly the rows I need.  It even displays rows when RGroup is null....

if(([01-Opportunity WL] ='x' or [02-Engagement WL]='x' or [06-OPTT]='x') and RGroup <> '10',[User role])

2) I tried to convert the above IF statement using Set Analysis but it does not  count if the RGroup field is NULL...

count({$<[01-Opportunity WL]={"x"},[02-Engagement WL]={"x"},[06-OPTT]={'x'},RGroup-={"10"}>} distinct [User Name])

3) Then I tried using the below set analysis to capture RGroup is NULL and if RGroup is NOT equal to '10' but it doesn seem to be working...

Count({-<RGroup-={'*'}> +<RGroup-={'10'}> + <[01-Opportunity WL]={'x'}>*<[02-Engagement WL]={'x'}>*<[06-OPTT]={'x'}>} distinct [User Name]

Is my syntax wrong? Am I useing the '+' and '*' inccorrectly?

6 Replies
MK_QSL
MVP
MVP

=count({$<[01-Opportunity WL]={"x"},[02-Engagement WL]={"x"},[06-OPTT]={'x'},RGroup-={'10'}>} distinct [User role])

Not applicable
Author

Hi Manish,

Thanks for your quick response! I had your statement originally but...

I also need where RGroup is null or blank.  When I use the above statement it doesn not count the null values where RGroup is null or blank just the row where there are values for RGroup.

Any suggestions?

MK_QSL
MVP
MVP

Create a Flag in your Script just below RGroup

IF(RGroup <> 10 and (IsNull(RGroup) or Len(Trim(RGroup))=0, 1, 0) as Flag

Now you can use

=count({$<[01-Opportunity WL]={"x"},[02-Engagement WL]={"x"},[06-OPTT]={'x'},Flag={1}>} distinct [User role])

Not applicable
Author

Thanks!  Is there any other way to do this using set analysis and not creating a flag in the script? 

settu_periasamy
Master III
Master III

May be like this

=Count({<RGroup-={'*'},RGroup-={'10'}> +

<[01-Opportunity WL]={'x'},RGroup-={'10'}>+

<[02-Engagement WL]={'x'},RGroup-={'10'}>+

<[06-OPTT]={'x'},RGroup-={'10'}>} distinct [User Name])

Not applicable
Author

Thank you Settu but that did not work.