Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where clause in expressions

I want to create a chart that shows the count and sum of one field but limits the output to criteria from another field. What is the correct syntax for the expression (eg: where field1 = X).  Thanks in advance

1 Solution

Accepted Solutions
rustyfishbones
Master II
Master II

Hi Michael,

See the attached file.Does it help

View solution in original post

14 Replies
Not applicable
Author

Are tables containing your fields associated?

Nicole-Smith

You should use set analysis.  Something like this:

=sum({<field1={'X'}>}field2)

Not applicable
Author

The fields are all derived from a single table in the load script that has no link to the other data.

juleshartley
Specialist
Specialist

It would help if you could give a more specific example of what you are trying to do. Are you saying that the result of an expression in one fields provides a value that you want to use as a filter on another field within another expression?

Not applicable
Author

I have two dimensions on the chart Sum of field1 and Count of field1. I want to use an expression to filter the result based on a value in field2. Boyh fields are in the same table. Just to note, I am new to Qlikview.

juleshartley
Specialist
Specialist

I'm afraid this doesn't make sense to me. Surely if Field 2 is a dimension in the table then it is already 'filtering' the expression fields?

Nicole-Smith

=sum({<field2={'X'}>}field1)

and

=count({<field2={'X'}>}field1)

Not applicable
Author

Hi Michael, You can't use Sum or Count aggregation functions in the dimensions.

Please post sample data and explain clearly what you are looking.

Not applicable
Author

I want to thank you all for the responses. I will try to state the issue more clearly. I want to create a straight table chart that sums as well as counts the data in one field using crieria from another field to filter the result.

Field1      Field2

10            1

15            2

20            1

I want the sum and count  of Field1 for those records that are equal to 1 in Field2. I tried =sum({<field2={'X'}>}field1) as sugested above but got unfiltered results. Again thank you.