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: 
Nourrahmcnean
Contributor III
Contributor III

Exclude that doesn't work properly

Hello everyone,

I want to exclude the type "gaming" from "laptop" in the total sum of the products, so I put this expression in the sum

"sum({<Type-={"Gaming"}>}TOT_COUNT)". As a result, keyboard and Screen values are omitted, too while I excluded only Gaming type.

Nourrahmcnean_0-1685354545476.png

The only solution that came to my mind is to add the Type to table Keyboard and Screen in the code below. but it'll take so much time to reload. I hope there is a better solution for this. 

 

 

 

Laptop:
LOAD * INLINE [
    product, Type, TOT_COUNT
    Laptop,Gaming ,10, 
    Laptop,Macbook ,10 , 
   Laptop,Ultrabook ,10 ,;]
NoConcatenate
Screen:
LOAD * INLINE [
    product,  TOT_COUNT   
    Screen, 20,     ];
NoConcatenate
Mouse:
LOAD * INLINE [
    product, Type, TOT_COUNT
      Mouse,Wired ,  10 ,
      Mouse,Wireless ,10 ,      ];
NoConcatenate
keyboard:
LOAD * INLINE [
    product, TOT_COUNT      
    keyboard,  10,];
NoConcatenate
Tab:
Load * Resident Laptop;
drop table Laptop;

Concatenate(Tab)
Load * Resident Screen;
drop table Screen;

Concatenate(Tab)
Load * Resident Mouse;
drop table Mouse;

Concatenate(Tab)
Load * Resident keyboard;
drop table keyboard;

 

 

 

 

Labels (2)
2 Solutions

Accepted Solutions
BrunPierre
Master
Master

Hi, Maybe this?

=Sum( {$<Type-={'Gaming'}> +<Product = E({<Type={"*"}>})>} TOT_COUNT)

View solution in original post

Or
MVP
MVP

Have you tried something along the lines of:

sum({$ - <Type={"Gaming"}>}TOT_COUNT)

View solution in original post

7 Replies
BrunPierre
Master
Master

Hi, Maybe this?

=Sum( {$<Type-={'Gaming'}> +<Product = E({<Type={"*"}>})>} TOT_COUNT)

Or
MVP
MVP

Have you tried something along the lines of:

sum({$ - <Type={"Gaming"}>}TOT_COUNT)

Nourrahmcnean
Contributor III
Contributor III
Author

Nourrahmcnean_0-1685369885644.png

 No it didn't work. thank you for the effort

 

Nourrahmcnean
Contributor III
Contributor III
Author

Thank you it woeked. So if i want to exclude the sales of screens it will be like this 

sum({$ - <Type={"Gaming"}> - <product={"Screen"}>}TOT_COUNT)

BrunPierre
Master
Master

It works perfectly for me though.

BrunPierre_1-1685373414161.png

Or
MVP
MVP

If the product field is always populated (no nulls), you could use a slightly cleaner version:

sum({<product-={"Screen"}> - <Type={"Gaming"}> }

 

Nourrahmcnean
Contributor III
Contributor III
Author

Thanks for the solution. But it give me a wrong result a right result when I select a product, As it is shown in the example below

Nourrahmcnean_1-1686756839303.png