Is there a way to query based on the last event a user performed?

  • 18 June 2021
  • 3 replies


Here’s the problem:

I’m trying to get to a total user count for our app. I setup a behavioral cohort and am querying based on user_id to get a sum of how many users we have. That said, this does not account for uninstalls, and so I am taking out anyone who performed an uninstall in x days. But...we have a number of users who uninstall and then reinstall our app.

Ideally I’d love to be able to query based on user_id, and exclude anyone whose final event was “uninstall”. Is there anyway to do this?



Best answer by Saish Redkar 18 June 2021, 22:26

View original

3 replies

Userlevel 7
Badge +10

Hey @RosieC. 

Interesting use case.
Afaik, the behavioral cohorts feature currently doesn’t support a final event clause for a user. Off the top of my head, I can’t think of any other charts which can enable this final event use case in a straightforward manner. 


But considering the nature of the use case I can think of the following by leveraging the relative count feature of cohorts.

Assuming every install App and uninstall App Events are captured accurately, let’s consider the following categories of users 

  1. Users who have installed and are actively using your app
  2. Users who have installed -→ use the app → uninstall the app → never come back again
  3. Users who have installed -→ use the app → uninstall the app → reinstall again → use the app ( this cycle can go n number of times ) 

So looking at that, we can consider that the number of install app events will be greater than the uninstall app events for a user to be captured in category #1 and #3.


So the cohort definition for users who are your active app users  ( who are using your the app and users who uninstalled, and started using the app again after reinstallation )  could be - 


Also, if you want a cohort just for users who uninstalled the app for good , then the following might help- 



Let me know if you see any logical errors in the above approach. There would be definitely other ways of solving this one.

Hope I have interpreted your use case correctly. 

Also, can you elaborate on the “querying based on user_id” part?


This is really helpful. Thank you @Saish Redkar !!

Userlevel 7
Badge +10


Were you able to test this logic and get the desired cohort?