Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
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

Tags (1)
1 Solution

Accepted Solutions
Highlighted
rustyfishbones
Honored Contributor II

Re: Re: Where clause in expressions

Hi Michael,

See the attached file.Does it help

View solution in original post

14 Replies
Highlighted
Not applicable

Re: Where clause in expressions

Are tables containing your fields associated?

Highlighted

Re: Where clause in expressions

You should use set analysis.  Something like this:

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

Highlighted
Not applicable

Re: Where clause in expressions

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

Highlighted
juleshartley
Valued Contributor

Re: Where clause in expressions

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?

Highlighted
Not applicable

Re: Where clause in expressions

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.

Highlighted
juleshartley
Valued Contributor

Re: Where clause in expressions

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?

Highlighted

Re: Where clause in expressions

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

and

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

Highlighted
Not applicable

Re: Where clause in expressions

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.

Highlighted
Not applicable

Re: Where clause in expressions

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.