Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
rt_new_user
Contributor III
Contributor III

How to exclude an item from a list box when performing aggregation finction?

Hi All

i asked this question before too but it looked liked it worked but didn't really. Didn't know how to re-open that discussion hence posting a new one.

I have a list box which i used subfield function to generate two other list boxes from using the below command:

Directory;

LOAD Date,

     Time,

     Operator,

     SubField(Operator,'-',1) as Country,

     subfield(Operator,'-',2) as Operatorname,

     [No of IMSI's] as 'No of items'

FROM

Now that i have two desired list boxes one as 'Country' and other as 'Operatorname' i want to table to show Sum of 'No of items' for all the countries but do not show the Sum when the country name is Australia. I used the below process but still see Sum for Australia??

Screen Shot 09-23-14 at 12.54 PM.JPG.jpgScreen Shot 09-23-14 at 12.56 PM.JPG.jpg

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Ravi,

I think the field has a space at the end, trim those space like below

Directory;

LOAD Date,

     Time,

     Operator,

     Trim(SubField(Operator,'-',1)) as Country,

     Trim(subfield(Operator,'-',2)) as Operatorname,

     [No of IMSI's] as 'No of items'

FROM

and then try below expression

=Sum( {<Country -= {'AUSTRALIA'}>} [No of items])


Hope this helps you.


Regards,

Jagan.

View solution in original post

7 Replies
JonnyPoole
Former Employee
Former Employee

missing some {} around the SET MODIFIER :

sum( {<Country -= {AUSTRALIA}>} [No of items])

aveeeeeee7en
Specialist III
Specialist III

Hi

You have not used Curly Brackets which is the standard syntax of Set Analysis to pass specific values for fields and calculate result on its basis.

Use this: {'AUSTRALIA'}

Try this:

sum( {<Country = {'*'}-{'AUSTRALIA'}>} [No of items])

or,

sum( {<Country -= {'AUSTRALIA'}>} [No of items])

Regards

Av7eN

rt_new_user
Contributor III
Contributor III
Author

Tried the below set analysis expression but same result..didn’t work ☹

rt_new_user
Contributor III
Contributor III
Author

Tried both expressions but still see AUSTRALIA in the table ☹

jagan
Luminary Alumni
Luminary Alumni

Hi Ravi,

I think the field has a space at the end, trim those space like below

Directory;

LOAD Date,

     Time,

     Operator,

     Trim(SubField(Operator,'-',1)) as Country,

     Trim(subfield(Operator,'-',2)) as Operatorname,

     [No of IMSI's] as 'No of items'

FROM

and then try below expression

=Sum( {<Country -= {'AUSTRALIA'}>} [No of items])


Hope this helps you.


Regards,

Jagan.

rt_new_user
Contributor III
Contributor III
Author

Great!!

I learnt two things from you in the last two days!!

What are these Trim functions for? What made you think that this data set requires a TRIM command? Eager to know please.

Thanks

jagan
Luminary Alumni
Luminary Alumni

Hi,

I noticed that your values has a separator - with spaces on both sides, but in script you specified only - in SubField(), instead you should give

subfield(Operator,' - ',2) - giving space on both sides of hyphen


or


Trim(subfield(Operator,'-',2))  - trimming the extra spaces


Hope this helps you.