Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Join us March 10th, 7 ways modern analytics can help you take smarter action. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mm112
Contributor II
Contributor II

HOW MANY OF SELECTED HAVE ALSO ENTRY OF ANOTHER STATE

Hello everyone

I have event entries:

USER_ID           ACTION                  DATE

1                        ACTION_A                  X

1                        ACTION_B                 Y

1                        ACTION_C                 Z

2                          ACTION_B               D

 

Let's assume that from filter panel I've selected from list of possible actions ACTION_B. Then count(user_id) = 2 -> I have two clients with ACTION_B. But now I want to show also how many of them have ACTION_A (counter should display value 1). How can I achieve this (without turning into single row for each USER_ID).

Thank you in advance for your help!

Regards

1 Solution

Accepted Solutions
Taoufiq_Zarra
Master II
Master II

with pleasure


because we set the value to'Action_A'.


test this new version:

=count({$<USER_ID = p({$<ACTION=ACTION>} )>} distinct USER_ID)

 

Regards,

Taoufiq

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
Taoufiq_Zarra
Master II
Master II

Hi,

try this:

Q1 : to calculate the number of USER_IDs, if I select ACTION_B for example :

=count({<[ACTION]=ACTION>} distinct USER_ID)

 

Q2: to show how many of them have ACTION_A 

=count({$<USER_ID = p({$<ACTION={'ACTION_A'}>} )>} distinct ACTION)

 

Capture.PNG

 

Cheers,

Taoufiq

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
mm112
Contributor II
Contributor II

Thank you very much for response! It helped me a lot. But I'm wondering if:

1. Formula for Q2 will work if I don't have action selected  (will then show number of users with ACTION_A) ??? Without selection it returns me number that is the same as number of all rows in event table. But maybe I'm doing something wrong... - I can add IF ELSE logic for this measure but I hope there is a better way to handle this

2. In your response (formula for Q2) there is:      '...... DISTINCT ACTION) ? For sure ACTION is right field to count in this case ??

I really appreciate your help on this

Regards

Taoufiq_Zarra
Master II
Master II

with pleasure


because we set the value to'Action_A'.


test this new version:

=count({$<USER_ID = p({$<ACTION=ACTION>} )>} distinct USER_ID)

 

Regards,

Taoufiq

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

mm112
Contributor II
Contributor II

Thank you! Works fine!

Cheers!