I would like to be able to group by multiple fields in my query.
In my query I set "by": ["Campaign Name", "Subject", "Bounce Type"],
However, whenever I do so I get the below error:
Length of ‘by’ must be <= 1
Based on the docs it appears that grouping by multiple fields is possible - if not can this be made available? It would prove extremely useful
Best answer by ben.liangView original
@rpaul12 and welcome back to the Community!
May I ask you to provide the documentation you are referring to so that I can get a better perspective on the issue?
With some more context, I can figure out whether or not the documentation needs to be updated and/or a product request made to our Product Team.
Thanks for being a Community Member!
Sure so looking at: https://developers.klaviyo.com/en/reference/query_metric_aggregates
If I expand the body params tab I see the following:
It seems to indicate that multiple fields can be added to the “by” array, but when I try this on my machine, I get the above error.
@rpaul12 and @daniellanger ! We can probably add additional grouping fields to this endpoint, we wanted to start off small though in order to avoid extremely complex queries that may bog down our backend. Out of curiosity, how many additional groups would satisfy your respective use cases? @rpaul12 would you be able to make do with 2 group-by’s, or is your posted list of three a firm requirement for this to be useful for you?