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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
annabergendal
Partner - Creator
Partner - Creator

Condition within set analysis expression

Hi,

I would like to include a condition in my set analysis.

I have the following table, where I would like to count the SubscriptionID's that has Status 7 and a status 2. So I would like to count ID nbr 123 but not 124. How can I do this?

This expression gives me both 123 and 124:

=count({$<Status={"7"}>} distinct SubscriptionID)

Table:

Load * inline

[

SubscriptionID, Status, Date

123, 2, 2014-01-01

123, 6, 2014-02-01

123, 7, 2014-03-01

124, 7, 2014-03-01

125, 2, 2014-01-01

125, 6, 2014-02-01

];

Thanks

1 Solution

Accepted Solutions
manojkulkarni
Partner - Specialist II
Partner - Specialist II

Use below expression to get subscription id having both status

=count({<[SubscriptionID] = p({<[Status] = {7}>}) * p({<[Status] = {2}>}) >} distinct SubscriptionID)

View solution in original post

10 Replies
amit_saini
Master III
Master III

Try this:

Table:

Load * inline

[

SubscriptionID, Status, Date

123, 2, 2014-01-01

123, 6, 2014-02-01

123, 7, 2014-03-01

124, 7, 2014-03-01

125, 2, 2014-01-01

125, 6, 2014-02-01

]

Where SubscriptionID <> '124' ;

Thanks,
AS

sushil353
Master II
Master II

Hi,

in the dimension.. you can write condition

if(status = 7 and status =2, subscriptionID)

also check the option for suppress null values..

HTH

sushil

sunilkumarqv
Specialist II
Specialist II

Try like this

=count({$<Status={"7"},SubscriptionID={'*'}-{'124'}>} distinct SubscriptionID)

alkesh_sharma
Creator III
Creator III

count({<Status={'7'},SubscriptionID={'*'}-{'124'}>} DISTINCT SubscriptionID)

annabergendal
Partner - Creator
Partner - Creator
Author

I just have a textbox where I put the result, so I need to refer to the dimension in the expression...

annabergendal
Partner - Creator
Partner - Creator
Author

In the real app, I have hundreds of SubscriptionID's, so I can't refer to the number of SubscriptionID like 124. I need to refer to the status 2 somehow...

licciardello
Partner - Contributor II
Partner - Contributor II

(sorry for my english)...

you can create two variables.

like this (about)

=count({$<Status={'$(vStatus)'}, SubscriptionID-={'$(vSID)'}>} distinct SubscriptionID)

You can use two inputbox for insert the value of var



manojkulkarni
Partner - Specialist II
Partner - Specialist II

Use below expression to get subscription id having both status

=count({<[SubscriptionID] = p({<[Status] = {7}>}) * p({<[Status] = {2}>}) >} distinct SubscriptionID)

annabergendal
Partner - Creator
Partner - Creator
Author

Thanks,

but how can I set the variable vSID to take into account the SubscriptionID's that has Status 2?

Or, have multiple values in vStatus to include both 2 and 7?