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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Expression problem (AND, OR)

Hi guys,

I'm just getting to grips with set analysis and am having some difficulty.

The following is my expression:

Sum({$ < GamingTransaction.game_tran_type={commission},UserMembership.com_percentage={50} > } GamingTransaction.amount/2)

I want to find all GamingTransactions which have 'commission' as their 'game_tran_type' and also have a UserMembership.com_percentage with a value of '50', and sum the amounts of these GamingTransactions and divide the result by 2.

As far as I can tell, the above expression gives me the GamingTransaction amounts of those with a GamingTransaction.game_tran_type={commission} OR those which have a UserMembership.com_percentage={50}.

How do I change the expression so that the resulting GamingTransactions have both attributes?

Thanks

3 Replies
Not applicable
Author

Hi,

In the syntax of set analysis you give the extra selections that must be made for this expression.

So it is always an "and" situation.

Halmar

Not applicable
Author

Halmar,

Thanks for getting back to me again.

Ok, that seems to be working, I may have just been wrong before. But now I would like to insert a function into my set analysis to check whether a number is Odd or Even, like so:

Sum({$ < GamingTransaction.game_tran_type={commission}, UserMembership.com_percentage{50}, Even(GamingTransaction.runner_id) > } GamingTransaction.amount/2)

However, I am getting an error in my expression syntax.

Is this possible, to put a function into the set analysis? If so, do you know the syntax for this?

Thanks

Not applicable
Author

Hi,

I would do this like this:

In your script:

if(even(GamingTransaction.runner_id),1,0)     as GamingTransaction.runner_id_EvenFlag

In your expression:

Sum({$ < GamingTransaction.game_tran_type={commission}, UserMembership.com_percentage{50}> } GamingTransaction.amount*GamingTransaction.runner_id_EvenFlag)/2

Succes!

Halmar