Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

using variables in set analysis

Hi there,

I have  a variable (v_on_season) that calculates the number of thansactions that a customer performs in a selected period , eg Q1 2012. and another variable (v_off_season) that calculates the number of thansactions that a customer performs in another selected period , eg Q4 2012.

I want to calculate the number of customers that performed at least one transaction in the first period and at least 100  in the other selected period.

So if customer_id is the calculated field i want to calculate something like this:

count ( {$< $(v_on_season) > 0 , $(v_off_season) >= 100>} customer_id)

Any help would be very appreciated.

Thank you in advance.

6 Replies
mov
Esteemed Contributor III

Re: using variables in set analysis

Try this, without set analysis:

count(distinct if(aggr($(v_on_season),customer_id)>0 and aggr($(v_off_season),customer_id)>=100, customer_id))

I can't be sure if I got it right without knowing the nature of your variables.  In this case I assume that they are text of expressions rather than result of expressions calculations.

Regards,

Michael

nilesh_gangurde
Valued Contributor

Re: using variables in set analysis

Hi  dimcharalampou

the variable will store only one value hence you cant calculate for each customer.

please share the logic, how u are calculating those variables.

-Nilesh

sushil353
Honored Contributor II

Re: using variables in set analysis

Hi,

Try this:

if($(v_on_season)>0 and $(v_off_season) >= 100,count(customer_id))

if it is not working then please share the logic to implement the set analysis.

HTH

Sushil

Not applicable

Re: using variables in set analysis

Hi there,

The variable for on season  is : count({$< Season = p[Season1] >} [Transaction Ammount])

and for off season is:  count({$< Season = p[Season2] >} [Transaction Ammount])

Thank you all for your responses guys!

Not applicable

Re: using variables in set analysis

Hi there,

Any suggestions?

Thank you.

anandathome
Contributor

Re: using variables in set analysis

Hi,

   Please try this example.

As rightly said by Nilesh, you can not achieve it by variables.

Try this one and see if it helps

Community Browser