Calculate how many users performed a given number of events (eg, buckets of 10) in the last 30 days
Hi Shane, 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 calculate how many users performed a given number of events (e.g., in buckets of 10) in the last 30 days in Mixpanel, you can use JQL (JavaScript Query Language) with the mixpanel.numeric_bucket() function. This function allows you to group users by the number of events they performed, bucketed into intervals (such as 0β9, 10β19, etc.).
Hereβs an example JQL query that does this:
```
function main() { return Events({ from_date: "2024-05-01", // set to 30 days ago to_date: "2024-05-30", // set to today event_selectors: [{event: "Your Event Name"}] // replace with your event }) .groupByUser(mixpanel.reducer.count()) .groupBy( [mixpanel.numeric_bucket('value', {bucket_size: 10, offset: 1})], mixpanel.reducer.count() ); }
LBKS- Replace `"Your Event Name"` with the event you want to analyze.
- Adjust the `from_date` and `to_date` as needed for your 30-day window.
This query will return the number of users in each bucket (e.g., how many users performed 1β10, 11β20, etc. events in the last 30 days)Β [Docs: JQL Builtins](https://docs.mixpanel.com/docs/reports/apps/jql#mixpanelnumeric_bucketaccessor-buckets-spec).
If you prefer to use the Mixpanel UI, you can use the Insights report with the "Frequency per User" measurement and select the "distribution" aggregation to visualize a similar breakdown, but the JQL approach gives you more control over bucket sizesΒ [Docs: Insights Measurements](https://docs.mixpanel.com/docs/reports/insights#measurements).
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.
