Question

Querying events on unique users with breakdowns

  • 3 December 2021
  • 1 reply
  • 27 views

  • New Participant
  • 1 reply

I’d like to replicate this query from my insights:

 

I can get the first half, getting the total number of views per issue

function main() {
return Events({
from_date: '2016-01-01',
to_date: '2021-12-02',
event_selectors: [{event: "Viewed issue"}]
}).groupBy(
["properties.issueId"],
mixpanel.reducer.count()
)
}

but I can’t figure out how to get the number of unique views per issue.


1 reply

Hm, I got the data I want, but now how do I combine the two queries into one?

 

 return Events({
from_date: '2016-01-01',
to_date: '2021-12-03',
event_selectors: [{event: "Viewed issue"}]
}).filter(function(user){return user.distinct_id}).groupBy(["properties.issueId", "distinct_id"], mixpanel.reducer.count()).groupBy(["key.0"], mixpanel.reducer.count());

 

Reply