Hi! How can I filter out in a Insights dashboards the event that happened in the first X days of the user in the app?
Hi Àlex C., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To filter events in an Insights dashboard to only include those that happened within the first X days of a user's activity in your app, you can use Mixpanel's cohort and filtering features. Here’s how you can approach this: 1. Create a Cohort of Users Based on "First Seen" or "Sign Up" Date: - Use the Cohort Builder to define a cohort of users whose "First Seen" or "Sign Up" date is within the last X days. For example, "Users who signed up in the last 7 days" [Creating Cohorts].2. Filter Events by This Cohort in Insights: - In your Insights report, use the filter menu to select the cohort you just created. This will restrict your analysis to users who are within their first X days in the app [Using Cohorts in Analysis].3. (Optional) Use Event Filters for "First Time" Events: - If you want to analyze only the first time a user performed a specific event, you can add a "First Time" filter to that event in Insights. This will show only the first occurrence of the event per user [Analyzing First Time Users].Note: Mixpanel does not natively provide a direct filter for "events that happened within the first X days after a user's signup" in the Insights UI. The closest approach is to use cohorts based on signup date and/or the "First Time" event filter. For more advanced or custom logic (e.g., filtering all events that occurred within X days after each user's signup), you may need to use JQL (JavaScript Query Language) for custom analysis, but this is not directly available in the standard Insights dashboard UI [Creating Cohorts].If you need to perform this exact filter (events within X days after each user's signup) and it's not achievable with the standard UI, consider using JQL for more flexibility.Let me know if you need guidance on using JQL for this use case!
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
You're correct that JQL is in maintenance mode and Mixpanel is not investing further in it. However, it is still available for use, but Mixpanel does not provide support for writing custom JQL queries. The documentation states: > JQL is in maintenance mode. Since the JQL platform is designed as a self-service tool, Mixpanel is unable to assist with writing custom JQL queries. Mixpanel is not investing in JQL any further. If you would like to run arbitrary queries on your Mixpanel events, please use our Data Pipelines add-on to export your events to your data warehouse. Docs / Reports / Apps / JQL
Example JQL Query
If you still want to use JQL to filter events that happened within the first X days of a user's activity, you can write a query similar to the following (replace X
with the number of days you want): LBKSfunction main() { // Get all users and their signup date var users = People().map(function(user) { return { distinct_id: user.distinct_id, signup_date: user.properties.signup_date }; });LBKS // Convert to a lookup for quick access var userSignupDates = {}; users.forEach(function(u) { userSignupDates[u.distinct_id] = new Date(u.signup_date); });LBKS // Filter events that happened within X days of user's signup var X = 7; // for example, first 7 days return Events({ from_date: "2023-01-01", to_date: "2023-12-31" }).filter(function(event) { var signup = userSignupDates[event.distinct_id]; if (!signup) return false; var eventTime = new Date(event.time); var diffDays = (eventTime - signup) / (1000 ** 60 ** 60 ** 24); return diffDays > = 0 && diffDays < X; }); }LBKS
**Note:* You may need to adjust the property names (e.g., signup_date
) to match your actual user profile properties. Also, this query assumes that signup_date
is stored in a format that can be parsed by new Date()
.Again, please be aware that JQL is not actively supported and is in maintenance mode, but it is not deprecated and can still be used for custom queries as described above <https://docs.mixpanel.com/docs/reports/apps/jql|Docs / Reports / Apps / JQL>.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.