Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I need to get the user id of people who did the event A and the event B. I'm having trouble using p() and intersection.
First problem: p()
If I use count({$<event_name={'A'}>}distinct user_id)
the result is 500, which is the correct answer (doublecheck in databricks)
But if I use count({$<user_id=P({<event_name={'A'}>}user_id)>}distinct user_id)
the result I get is 1.17K.
Second problem: p() and *
So, before I got two different answers: 500 and 1.17k. If I use count({$<user_id=P({<event_name={'A}>}user_id)*P({<event_name={'B'}>}user_id)>}distinct user_id)
I get 1.09k, which is wrong since it's bigger than 500.
Things that also didn't work:
count({$<user_id=P({<event_name={'A}>}user_id)*P({<event_name={'B'}>}user_id), event_name={'A','B'}>}distinct user_id)
count({$<user_id=P({<event_name={'A}>}user_id)>*<user_id=P({<event_name={'B'}>}user_id)>}distinct user_id)
count({<event_name={'A'}>}user_id) * count({<event_name={'B'}>}user_id)
Hi,
Try below
For 1st Query
1: Count({<event_name={'A'}>} distinct user_id)
for intersection
1: Count({<event_name={'A'}>*<event_name={'B'}>} distinct user_id)
2: Count({<event_name={'A'}>} distinct user_id) + Count({<event_name={'B'}>} distinct user_id)
I don't understand, Why you need p() over here?
If you want to see all user_id where event_name=A regardless any selection then use 1 instead of $
Regards,
Prashant Sangle
HI,
try below expression:
count( DISTINCT {$<user_id=P({<event_name={'A'}>} ) *P({<event_name={'B'}>} ) >} user_id)
Thanks,
Sasi
Hi @sasikanth , thanks for replying.
Unfortunately, it also doesn't work. The codes I was trying to use also have distinct, just before the user_id, so it's not that the problem.
can you check the result for below expression
count( DISTINCT {$<user_id=P({<event_name={'A'}>} ) >} user_id)
Hi,
Try below
For 1st Query
1: Count({<event_name={'A'}>} distinct user_id)
for intersection
1: Count({<event_name={'A'}>*<event_name={'B'}>} distinct user_id)
2: Count({<event_name={'A'}>} distinct user_id) + Count({<event_name={'B'}>} distinct user_id)
I don't understand, Why you need p() over here?
If you want to see all user_id where event_name=A regardless any selection then use 1 instead of $
Regards,
Prashant Sangle
Thank you, @PrashantSangle , it worked!