Mixpanel Community Icon

Filtering Player Statistics Events in Mixpanel for Scores Over 30

·
·

Assume you are passing Player Statistics event the following event properties - score event property - [1,17,36,9] player event property - ["A", "B", "C", "D"] score event property - [1,31,20,4] player event property - ["Q", "X", "Z", "L"] Now you would like to only consider the events where the score event property was greater than 30, and then you would like to get the score output as 36 and the player name as C and output as 31 and player name as X How can you do this in Mixpanel? Assume if it is being passed in array, how do you get an output in Mixpanel - For example, here is the array structure - "Player": [ "A", "B", "C", "D" ]

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi Tarun S., 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

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    To achieve this in Mixpanel, you can use a combination of filtering and custom properties. Here's how you can approach this: 1. First, you'll need to use list filtering to select events where any element in the "score" list property is greater than 30.2. Then, you can create a custom property to extract the player name corresponding to the score greater than 30.Here's a step-by-step approach: 1. Filter the events: Use the "Any" operator to filter events where any element in the "score" list is greater than 30. List Filter Your filter would look like this:

    ```LBKSLBKS2. Create a custom property: You'll need to create a custom property to extract the player name corresponding to the score greater than 30. Unfortunately, the provided knowledge sources don't give specific information on how to create such a complex custom property in Mixpanel that would match array indices between two list properties.LBKS3. Break down by the custom property: After creating the custom property, you would break down your results by this new property to see the player names associated with scores greater than 30.LBKSIt's important to note that handling complex array manipulations and index matching between multiple array properties is not a straightforward operation in Mixpanel based on the information provided in the knowledge sources. LBKSFor more advanced data manipulations, you might need to consider using [JQL (Javascript Query Language)](https://docs.mixpanel.com/docs/reports/apps/jql) in Mixpanel, which allows for more complex custom queries. However, the documentation notes that JQL is in maintenance mode and not being further developed.LBKSIf this level of data manipulation is crucial for your analysis, you might want to consider preprocessing your data before sending it to Mixpanel, or using Mixpanel's [Data Pipelines](https://developer.mixpanel.com/reference/raw-data-export-api) to export your data to a data warehouse where you can perform more complex operations.LBKSFor the most accurate and up-to-date information on handling complex data structures in Mixpanel, I recommend reaching out to Mixpanel's support team directly.

    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.

  • Avatar of Tarun S.
    Tarun S.
    ·
    ·

    kapa.ai, how to create a custom property for this use case?

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Let me check the knowledge base for you again. One moment! 📚

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    To create a custom property for this specific use case in Mixpanel, you can use the custom property feature. However, it's important to note that creating a custom property that matches array indices between two list properties is a complex operation that may not be directly supported by Mixpanel's standard custom property functionality.Based on the information provided in the Custom Properties documentation, here's a general approach you could try: 1. Click the plus button to the right of the search bar in your Mixpanel report. 2. Select "Event Property" to open the property builder. 3. Give your property a name, such as "High Score Player". 4. Click into the formula bar to start defining your custom property.The challenge here is that the formula needed for your specific use case is quite complex and may not be directly achievable using the standard functions available in Mixpanel's custom property feature. The custom property would need to: 1. Find the index of scores greater than 30 in the "score" array. 2. Use that index to retrieve the corresponding player name from the "player" array.Unfortunately, the provided knowledge sources don't give examples of custom properties that can perform such complex array operations or index matching between multiple array properties.Given the complexity of this operation, you might need to consider alternative approaches: 1. Preprocess your data before sending it to Mixpanel, creating a new property that already contains the desired information. 2. Use JQL (Javascript Query Language) for more complex custom queries, although it's worth noting that JQL is in maintenance mode. 3. Export your data using Mixpanel's data pipelines and perform this analysis in a more flexible environment like a data warehouse.For the most accurate and up-to-date information on handling such complex custom properties in Mixpanel, I recommend reaching out to Mixpanel's support team directly. They would be best equipped to advise on whether this specific use case can be handled within Mixpanel's current custom property capabilities.

    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.

  • Avatar of Tarun S.
    Tarun S.
    ·
    ·

    Can you share the JQL instructions for this scenario? kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Let me check the knowledge base for you again. One moment! 📚

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Certainly! I can provide you with a JQL (JavaScript Query Language) script that addresses your specific scenario. Here's an example of how you might structure the JQL query: LBKSfunction main() { return Events({ from_date: '2023-01-01', to_date: '2023-12-31' }) .filter(function(event) { return event.properties.score.some(score => score > 30); }) .map(function(event) { var highScoreIndex = event.properties.score.findIndex(score => score > 30); return { score: event.properties.score[highScoreIndex], player: event.properties.player[highScoreIndex] }; }); }LBKSThis JQL script does the following: 1. It selects events from a specified date range (you should adjust these dates as needed). 2. It filters the events to only include those where at least one score is greater than 30. 3. It then maps each event to an object containing the first score greater than 30 and its corresponding player.To use this JQL script in Mixpanel: 1. Navigate to the JQL interface in Mixpanel. 2. Copy and paste this script into the JQL editor. 3. Run the query to see the results.Please note that while this JQL script should work for your scenario, there are some important considerations: 1. As mentioned in the JQL documentation, JQL is in maintenance mode and Mixpanel is not investing in it further.2. The JQL documentation also states: "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."3. There are limitations to JQL queries, including a timeout after 2 minutes of run-time and a maximum of 5 concurrent queries and 60 queries per hour, as noted in the Custom JQL Query documentation.Given these limitations, for complex or frequent analyses of this type, you might want to consider using Mixpanel's Data Pipelines to export your data to a separate data warehouse where you can perform more flexible and powerful analyses.

    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.