Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
JohannaS
Partner - Contributor
Partner - Contributor

Operatots in set expression not working

Hi, 

I am pretty new to Qlik Sense and I was following one of the tutorials on the Qlik Sense Learning Page.

I am using the data from the tutorial, which contains information about employees, their job title and the sales office they are working in. 

Using

 

 =Count({1<SalesOffice={Lund}>} DISTINCT EmployeeID)

 

I get a count of 11, which checks with my data. What is also working is:

 

=Count({1<JobTitle={'Systems Manager'}>} DISTINCT EmployeeID)

 

which also gives me the correct result. 

Now I am trying 

 

=Count({1<JobTitle={'Systems Manager'}>+1<SalesOffice={Lund}>} DISTINCT EmployeeID)

 

which should give 13 according to the exercise, but it results as 2, which doesn't make sense at all (even from a mathematics point of view).

I attached my app to the question. The relevant sheet is Office Sales.

Thank you for helping me! 🙂

 

 

Labels (3)
2 Solutions

Accepted Solutions
Digvijay_Singh

Not sure but I think its something to do with the keyfield counting which appears in multiple tables, When I surround the expression with another dimension, it counts properly

Digvijay_Singh_0-1647579444634.png

 

Digvijay_Singh_1-1647579543429.png

Can you also try creating a copy of employee ID field in the employee table and use that in the expression.

View solution in original post

Digvijay_Singh

Counting EmployeeName instead of EmployeeID gives the correct results so looks like the expression becomes ambiguous sometimes when keyfields are counted but its not always the case.

View solution in original post

4 Replies
anthonyj
Creator III
Creator III

Hi @JohannaS ,

The "+" operator between the sets adds the results of the two sets together which should give you 13. In your case you've added an extra "1" in your set analysis creating an error and so it is only resolving the first part of the set analysis. (Systems Manager by itself is resolving to 2).

=Count({1<JobTitle={'Systems Manager'}>+<SalesOffice={Lund}>} DISTINCT EmployeeID)

 

 If you take the 1 out this should resolve correctly.

Thanks

Anthony

Digvijay_Singh

Not sure but I think its something to do with the keyfield counting which appears in multiple tables, When I surround the expression with another dimension, it counts properly

Digvijay_Singh_0-1647579444634.png

 

Digvijay_Singh_1-1647579543429.png

Can you also try creating a copy of employee ID field in the employee table and use that in the expression.

Digvijay_Singh

Counting EmployeeName instead of EmployeeID gives the correct results so looks like the expression becomes ambiguous sometimes when keyfields are counted but its not always the case.

JohannaS
Partner - Contributor
Partner - Contributor
Author

Taking the 1 out does not work for me. Also, it usually works perfectly fine with one "1" for each selector.