Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting from Multiple Combination

Hello I have the following Table

USER_ID,

ONLINE_BOOKING_COUNT,

PHONE_BOOKING_COUNT

Here is a sample.

USER_IDONLINE_BOOKING_COUNTPHONE_BOOKING_COUNT
46933
32501
97413
32220
50324
73400
28315
28010
28305
90000
97431

I want to Count the Number of Users who Did the booking.

How do I count?

Thanks

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

You can use expressions in set analysis:

Count({< ONLINE_BOOKING_COUNT -= {0} > + < PHONE_BOOKING_COUNT -= {0} >} USER_ID)

That will return the set of USER_ID that are not zero in either ONLINE or PHONE. You can change that "+" for a "*" in case you want the intersection instead of the sum of sets (not zero in ONLINE AND in PHONE).

Hope that helps,

Miguel

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hi,

You can use expressions in set analysis:

Count({< ONLINE_BOOKING_COUNT -= {0} > + < PHONE_BOOKING_COUNT -= {0} >} USER_ID)

That will return the set of USER_ID that are not zero in either ONLINE or PHONE. You can change that "+" for a "*" in case you want the intersection instead of the sum of sets (not zero in ONLINE AND in PHONE).

Hope that helps,

Miguel

Not applicable
Author

Hi Miguel

Thank you for the quick response. I am trying to understand the set statement (for beginers like me I think need more practice). Is the above statement prevents duplicates as there are users who used bother ONLINE and OFFLINE. So we should count as one instead of two.

Also you mentioned the change '+' to '*' . what is intersection?

Miguel_Angel_Baeyens

Hi,

The "*" set modifier is used like the AND modifier, meaning "all in both set modifiers". In the case above, count when value is not zero for both fields.

Hope that helps,

Miguel