Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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
Highlighted
sicilianif
Contributor

Re: How to use positive and negative logic simulatniously in Set Analysis

Try:

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

5 Replies
daveamz01
Contributor III

Re: How to use positive and negative logic simulatniously in Set Analysis

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

Re: How to use positive and negative logic simulatniously in Set Analysis

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

Re: How to use positive and negative logic simulatniously in Set Analysis

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

Highlighted
sicilianif
Contributor

Re: How to use positive and negative logic simulatniously in Set Analysis

Try:

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

Not applicable

Re: How to use positive and negative logic simulatniously in Set Analysis

That did it

Many thanks!

Community Browser