Solved

Data discrepancy between interval "month" vs "day" (using Query Metric Aggregate)

  • 30 June 2023
  • 4 replies
  • 60 views

Userlevel 1
Badge +2

Hi, we’re using the latest stable version of the “Query Metric Aggregates” endpoint and we’re using it to query common use-cases e.g. “Revenue”, “active on site”, etc.

The “interval” filter for this API does not seem to have much documentation (https://developers.klaviyo.com/en/docs/using_the_query_metric_aggregates_endpoint)

We know that it is for aggregating the data. But why does “day” and “month” return different results?

 

icon

Best answer by David To 3 July 2023, 22:50

View original

4 replies

Userlevel 7
Badge +60

Hello @airboxr,

Great question!

The discrepancy you’re seeing when using either the “by day” or “by month” interval grouping is based on when those metrics/events were triggered. 

When grouping the data “by day” you’ll get an aggregate of how many times the event was triggered each day by a unique profile. 

Grouping the data “by month” will do the same thing, but for the entire month. 

For example, let's say you’re aggregating the data for profiles who have clicked an email within a two-week time frame. A profile is recorded as clicking the same email twice on the first day they received the email which falls into the time frame, but also decides to click on it again the next day. 

Using the “by day” grouping, this would be counted as 2 clicks. This unique profile clicked on both days. It wouldn’t matter how many times this profile clicked on an email in the same day, it would be counted as 1 click since its unique to them. 

This same understanding is applied when using the “by month” grouping. Where, using this same example, this user would be counted as 1 click. The data would be viewing the entire month rather than day and grouping the unique profile action as a whole. Using this grouping method despite clicking on two separate days, it doesn’t change the fact that they clicked on the same email within the given time frame of the month. 

I hope this helps!

David

Userlevel 1
Badge +2

Hi @David To - thank you for the response. I understand your explanation but I'm not sure it explains the discrepancy — our metrics when chosen BY MONTH is always higher than BY DAY. Based on your explanation, it should have been the other way round, isn't it?

Userlevel 1
Badge +2

Hello @airboxr,

Great question!

The discrepancy you’re seeing when using either the “by day” or “by month” interval grouping is based on when those metrics/events were triggered. 

When grouping the data “by day” you’ll get an aggregate of how many times the event was triggered each day by a unique profile. 

Grouping the data “by month” will do the same thing, but for the entire month. 

For example, let's say you’re aggregating the data for profiles who have clicked an email within a two-week time frame. A profile is recorded as clicking the same email twice on the first day they received the email which falls into the time frame, but also decides to click on it again the next day. 

Using the “by day” grouping, this would be counted as 2 clicks. This unique profile clicked on both days. It wouldn’t matter how many times this profile clicked on an email in the same day, it would be counted as 1 click since its unique to them. 

This same understanding is applied when using the “by month” grouping. Where, using this same example, this user would be counted as 1 click. The data would be viewing the entire month rather than day and grouping the unique profile action as a whole. Using this grouping method despite clicking on two separate days, it doesn’t change the fact that they clicked on the same email within the given time frame of the month. 

I hope this helps!

David

 

Hey David, thanks for this information.

Just a follow up question:
- so, if we wanted to query “Unique Clicks” for the last seven days, which interval is more appropriate? “day” or “month”?
- if we wanted to query “Unique Clicks” for the last 3 months, which interval is more appropriate? 
 

Userlevel 7
Badge +60

Hey @airboxr,

That’s certainly an interesting behavior. Sounds like there may be other factors involved in the discrepancies you’re seeing then. Other than how the interval grouping is calculated. 

If you’re on a paid subscription, I would suggest reaching out to our wonderful Support colleagues. Although our colleagues can’t provide coding assistance, they may be able to help spot the cause of this discrepancy in learning more about how you have things set up. 

 

When it comes to which interval is more appropriate, it really depends on your business strategies. There’s really no right or wrong option here as it all involves the same data, just viewed from different perspectives. 

As I like to say, it’s just all a matter of how you want to cut the pie. 

David

Reply