Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
sifatnabil
Valued Contributor

Set analysis and operator

Hi all,

I would like to count the distinct number of sessions where trader A and B both participated on a Tuesday. Should the set analysis look like this?

count({<SessionId = p({<[TraderName] = {'Mark'}>}) * p({<[TraderName] = {'Bob'}>}),Day={'Tues'}>} distinct SessionId)

Tags (1)
1 Solution

Accepted Solutions

Re: Set analysis and operator

What about this:

Count({<SessionId = p({<[TraderName] = {'Mark'}, Day={'Tues'}>}) * p({<[TraderName] = {'Bob'}, Day={'Tues'}>})>} distinct SessionId)

View solution in original post

9 Replies
MVP
MVP

Re: Set analysis and operator

May be like:

count({<[TraderName] = {'Mark'},Day={'Tues'}> *<[TraderName] = {'Bob'}>},Day={'Tues'}>} distinct SessionId)

Re: Set analysis and operator

What about this?

Count({<SessionId = p({<[TraderName] = {'Mark', 'Bob'}, Day={'Tues'}>})>} distinct SessionId)

sifatnabil
Valued Contributor

Re: Set analysis and operator

Hi sunindia‌, this is close, but it's doing Mark OR Bob. How can we make it count sessions for Mark AND Bob ?

Re: Set analysis and operator

tresesco‌ expression did not work as well?

sifatnabil
Valued Contributor

Re: Set analysis and operator

Yes, that one seems to return zero.

Re: Set analysis and operator

What about this:

Count({<SessionId = p({<[TraderName] = {'Mark'}, Day={'Tues'}>}) * p({<[TraderName] = {'Bob'}, Day={'Tues'}>})>} distinct SessionId)

View solution in original post

kkkumar82
Valued Contributor III

Re: Set analysis and operator

I think it would be better to create a sample either by some one to see the results

sifatnabil
Valued Contributor

Re: Set analysis and operator

Thanks, I just checked the data and it looks like both these variations work:

count({<SessionId=p({<[TraderName] = {'Bob'},Day={'Tue'}>})*p({<TraderName={'Mark'},Day={'Tue'}>})>}distinct SessionId)

OR

count({<SessionId = p({<[TraderName] = {'Bob'}>}) * p({<[TraderName] = {'Mark'}>}),Day={'Tue'}>} distinct SessionId)

Any idea why tresesco's doesn't work? Is it because TraderName itself cannot be 2 different names simultaneously?

Re: Set analysis and operator

Yes, you are right, a single row of data cannot have both TraderName on it. But a single SessionId can have multiple rows where one contains Mark and other contains Bob. He might have forgot to add SessionId and the p.