Solved

JQL Query: Joining By Specified Property

  • 18 July 2019
  • 1 reply
  • 256 views

Badge

Hello,

I am trying to filter query results to only rows with with 'User Id' fields linked to People profiles. My present query is something like this:

function main() {
return join(
Events({
from_date: 'START_DATE',
to_date:   'END_DATE',
event_selectors: [{event: 'EVENT_NAME', selector: 'SELECTOR_EXPRESSION'}]
}),
People({
user_selectors: [SELECTOR_OBJECTS]
}),
{type:'inner'})
}

However, the query returns no data, even for rows with 'User Id' values that exist in People profiles. The "distinct_id" attribute has recently been removed from the events, so I'm guessing the join is now being done on other columns. I suspect it is a vector of columns that includes 'User Id', as well as some fields that are in People Profiles but not in events - hence producing no matches. This means I need the join to only match based on 'User Id'.

I looked through the documentation here and couldn't find a parameter that allowed me to specify the column for the join. Does anyone know a clever way to solve this? Thanks!


icon

Best answer by scotthavard92 26 July 2019, 22:05

Hi michaelym,

I am not entirely sure I follow what your goal is. Could you elaborate on what you are trying to learn from your query?

You mention the "distinct_id" attribute being removed from events, which isn't possible. Event data is immutable, and the distinct_id is a necessary identifier connected to every event. There is more on distinct IDs role in Mixpanel in this article. Do you mean that the distinct_id is removed from the query results?

I built a query that joins event data with people data where the "User ID" property is set and the event name is "Event Name". Hopefully this can help guide you to success!


function main() {
   return join(
    Events({
      from_date: "2018-01-01",
      to_date: "2018-02-01",
      event_selectors: [{event: "Event Name"}]
    }),
    People({
    user_selectors:[{selector:
        '(defined (user["User ID"]))'}]
  }), 
  {type:'inner'}
 );
}



View original

1 reply

Badge

Hi michaelym,

I am not entirely sure I follow what your goal is. Could you elaborate on what you are trying to learn from your query?

You mention the "distinct_id" attribute being removed from events, which isn't possible. Event data is immutable, and the distinct_id is a necessary identifier connected to every event. There is more on distinct IDs role in Mixpanel in this article. Do you mean that the distinct_id is removed from the query results?

I built a query that joins event data with people data where the "User ID" property is set and the event name is "Event Name". Hopefully this can help guide you to success!


function main() {
   return join(
    Events({
      from_date: "2018-01-01",
      to_date: "2018-02-01",
      event_selectors: [{event: "Event Name"}]
    }),
    People({
    user_selectors:[{selector:
        '(defined (user["User ID"]))'}]
  }), 
  {type:'inner'}
 );
}



Reply