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: 
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
Anonymous
Not applicable
Author

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
Partner - Specialist
Partner - Specialist

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
Master II
Master II

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
Author

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
Author

Hi there,

Any suggestions?

Thank you.

anandathome
Creator
Creator

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