Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set expression, aggregation, and intersections

Hi

I have a data table which has three fields: Client, Problem_ID, Ticket, and Status. I need a set expression to count the number of records that match the all of the following criteria:

  • Distinct client names
  • Problem_ID = 123 and Status <> W
  • Problem_ID = 456 and Status <> W

I tried the following, but it is obviously wrong:

count({$ <problem_id = 123, status <> 'W'> + <problem_id = 456, status <> 'W'>} DISTINCT client)

If I try using the intersection operator instead, the result is zero.

With the example data below, the expected counting should be 2 (as only Client A and Client D match the criteria).

clientproblem_idticketstatus
Client A123123456A
Client A456789012B
Client B123131517A
Client C456242628A
Client D123654321A
Client D456876543B

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

=Count(DISTINCT {<client = P({<problem_id = {123}, status -= {'W'}>})*P({<problem_id = {456}, status -= {'W'}>})>} client)


Capture.PNG

View solution in original post

7 Replies
sunny_talwar

Try this

=Count(DISTINCT {<client = P({<problem_id = {123}, status -= {'W'}>})*P({<problem_id = {456}, status -= {'W'}>})>} client)


Capture.PNG

Anonymous
Not applicable
Author

Thanks a lot. It does the trick

Other than the page below, do you know any other resource that describes the P() and E() element functions? I don't quite understand them yet.

sunny_talwar

Page below? Did you mean to share a link?

sunny_talwar

This seems like a good example

Qlikview: Qlikview Indirect Set Analysis

Anonymous
Not applicable
Author

Thanks. Much appreciated.