Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
miikkaqlick
Partner - Creator II
Partner - Creator II

Exclusion in Set Analysis

Hi All!

I'm making application that shows how often customers have bought things. I'll simplify it a bit to this. I need to groups, first is customers who have bought things in rolling 12 and second group is people who have bought things before this.

I'm making this with set analysis and with QV9 sr5.

Expression 1

Count({

(

$<InvoicingDate={">$(=v_RollingStart)<=$(=v_MonthEnd)"}, Product={'Things'}>

)

}

Distinct Customer)

This gives me all customers who have bought things in selected rolling 12 period. Second expression is the problem:

Expression 2

Count({

(

$<InvoicingDate={">$(=v_Passive24)<=$(=v_Passive12)"}, Product={'Things'}>

)

-

(

$<InvoicingDate={">$(=v_RollingStart)<=$(=v_MonthEnd)"}, Product={'Things'}>

)

}

Distinct Customer)

This gives me also customers who have bought things in rolling period. So I have customers that fits to both expressions. If I undestand second expression correctly then QV calculates 1-1=1. First part of expression returns 1 and second part of expression returns also 1.

I have various versions of this:

Version2:

Count({

(

$<  Customer =

P({$<Product={'Things'}, InvoicingDate={">$(=v_Passive24)<=$(=v_Passive12)"}>})>

)

*

(

$<Customer =

  E({$<InvoicingDate={">$(=v_Passive12)"}>})> 

)

}

Distinct Customer)

If I take version 2 apart then first part of expression returns 1 and second part of expression returns 0, but for some reason 1 * 0 = 1. I have tried also - and + operators in this.

Any ideas?

11 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

There won't be any difference between these for this set operator both will be same.

Set1/Set2 equals Set2/Set1

Also Set1*Set2 equals Set2*Set1

and Set1+Set2 equals Set2+Set1

Only the result of - (Exclusion) operator varies.

Set1-Set2 not equals Set2-Set1

Regards,

Celambarasan

Not applicable

Hi,

thanks for the answer,

So,that means we can generalize and say that 

always holds true:

Set1/Set2 equals Set2/Set1

Also Set1*Set2 equals Set2*Set1

and Set1+Set2 equals Set2+Set1

and the result of Set1-Set2 depends on the values in Set1.

You explained it quite well with the example.

Regards