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: 
cliff_clayman
Creator II
Creator II

Set Analysis not equal to Syntax

I am trying to use Set Analysis for a not equal to value.

=Sum({$<[Flag]-={'x'}>}[Amount])

This is not working properly.  When I change -= to just = , I get the correct amount for the ones that should be equal to x.  How should I write this to sum the Amount where the Flag is not equal to x?

26 Replies
cliff_clayman
Creator II
Creator II
Author

I think that is the issue.  How do I account for NULL values then?

rupamjyotidas
Specialist
Specialist

Maybe This.

=sum({($ -<Flag={'*'}>) Sales)

rupamjyotidas
Specialist
Specialist

Or define something for NULL in Script

If(Flag<>'X', Y) as Flag

and use Set Analysis in equation

cliff_clayman
Creator II
Creator II
Author

That doesn't work.  If I cannot determine a way to do it within Set Analysis, I will just add something to the script that gives it a value when it is not 'x'.

cliff_clayman
Creator II
Creator II
Author

That does not work, most likely because of the NULL values as well.

Anonymous
Not applicable

Hi Cliff, I prefer to do the exclusion in two steps to manage null values better:

=Sum(Amount)-Sum({$<[Flag]={'x'}>}[Amount])

Regards!!

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

If want to get solution quickly, try to share sample data or else Qvw.

-Nagarjun

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If the rows where Flag is a field have some sort of unique ID, you could try with an expression search. For example:

=Sum({<SalesOrderID = {"=Flag <> 'x'"}>} Amount)

Anonymous
Not applicable

Hi Cliff,

Can you try below expression. I just removed the quotes in the value.

=Sum({$<[Flag]-={x}>}[Amount])

Hope this time it should work.

Anil_Babu_Samineni

Perhaps this

=Sum({$<flag -= {'x'}>} amount)

I've written all lower letters

The better Sample Data. Why this is not working? Have you get any typo error from Expression

Load * Inline [

flag, amount

x, 10

y, 20

z, 30

];

For me this expression is working. Would you provide data which you expecting

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful