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: 
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

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)