Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use positive and negative logic simulatniously in Set Analysis

Hi there

I have 2 statements I would like to use in one Set Analysis statement. Individually they work a charm, but together I have no luck:

Statement 1:sum({$-1<ProductBrand = {'*Certificate*', '*Bank*'}>} NrOfExchTxns) // In this statement I want all Txns where the ProductBrand is not Certificate or Bank

Statement 2:

sum({$<CallMade={1}>} NrOfExchTxns)  // In This statement I want all Txns where the CallMade value = 1

Pretty simple one would think, but I have tried various scripts with the following being my latest stab at it, with no positive result:

sum( {$<CallMade = {"=sum({$-1<ProductBrand = {'*Certificate*', '*Spacebank*'}>}  NrOfExchTxns) = {1}"}>} NrOfExchTxns )

Any suggestions?

Many thanks

Paul

1 Solution

Accepted Solutions
sicilianif
Creator II
Creator II

Try:

sum({<ProductBrand -= {'*Certificate*', '*Bank*'}, CallMade={1}>} NrOfExchTxns)

View solution in original post

5 Replies
daveamz
Partner - Creator III
Partner - Creator III

Hello,

     For the 1st statement if you use QV 10, try:

      sum({<ProductBrand =ProductBrand- {'*Certificate*', '*Bank*'}>} NrOfExchTxns) // to sum all the Txns where ProductBrand is not Certificate or Bank.

     In QV 9 the statement will be:

     sum({<ProductBrand -= {'*Certificate*', '*Bank*'}>} NrOfExchTxns)

See the example attached.

Not applicable
Author

Hi there Dave

Thanks for the reply, but I was looking to incorporate both statements in one set analysis.

My problem was that the one used negative logic: $-1 and the other use positive logic $, and I did not know how to incorporate both in one statement. I have found a workaround by using posive logic in both statements $, and thereby easily combining the two.

sum({$<ProductBrand = {'*Local*', '*International*'}, CallMade={1}>} NrOfExchTxns)

In the statement above Local and International are the opposite of Certificate and Bank

If anybody else knows how to incorporate the $-1 and # in one statement I'd appreciate it

thanks

Not applicable
Author

Sorry man, I meant to end the message with:

If anybody else knows how to incorporate the $-1 and $ in one statement I'd appreciate it

rather than:

If anybody else knows how to incorporate the $-1 and # in one statement I'd appreciate it

sicilianif
Creator II
Creator II

Try:

sum({<ProductBrand -= {'*Certificate*', '*Bank*'}, CallMade={1}>} NrOfExchTxns)

Not applicable
Author

That did it

Many thanks!