Skip to main content
Question

how to create custom report using event attributes and make use of metrics and group by.

  • November 25, 2025
  • 2 replies
  • 18 views

Forum|alt.badge.img

Hi,

We have klaviyo events such as this on every profile

created_at: 2025-11-24T21:36:41.084Z
initiated_by_user_id: null
type: task_completed
id: 15303601
target_type: Task
environment: production
consumer_id: ed42321a-d65f-4794-9bbf-1a2cb79e76ed
target_id: 9ec15878-3395-4427-a18e-e49b58cdf673
updated_at: 2025-11-24T21:36:41.084Z


i want to create an report for the following 

 select consumer_id, type, count(*) from all events  group by consumer_id, type

i tried going through the documentation for custom report using metrics https://help.klaviyo.com/hc/en-us/articles/360046242952  and also the documentation for using metrics aggregate apis https://developers.klaviyo.com/en/docs/using_the_query_metric_aggregates_endpoint  

but could not find any hints that will help to solve my reporting requirements.

how to achieve this via custom report , could you share some samples or create a example report in our  customer reports and share details.  also could you share how to make use of metrics aggregate api endpoint and create the same report.  

 

Thanks 

2 replies

talha.hussain
Problem Solver II
Forum|alt.badge.img+4
  • Problem Solver II
  • November 25, 2025

Custom Report

  1. Make sure your events are sent to Klaviyo as metrics (e.g., task_completed).

  2. Include consumer_id as an event property.

  3. In Klaviyo → Analytics → Custom Reports:

    • Select the metric (e.g., task_completed)

    • Group by consumer_id

    • Add Count of Events

This gives you:
consumer_id | type (metric name) | count

Metrics Aggregate API

You must query one metric at a time:

Request:

{
"data": {
"type": "metric-aggregate",
"attributes": {
"metric_id": "YOUR_METRIC_ID",
"interval": "all",
"by": ["consumer_id"],
"measures": ["count"]
}
}
}

This returns counts grouped by consumer_id.

To mimic your SQL, run this once per event type (metric) and combine results.


Byrne C
Community Manager
Forum|alt.badge.img+27
  • Community Manager
  • November 26, 2025

Hi ​@vijayk,

This is best done through a custom report. I’d recommend making a Single metric deep-dive report, and choosing the metric that contains the data you referenced above. After that, you can group by any event property that the metric carries over. You can’t group by multiple event properties at a time, so you’d want to make one report by each property you’d like to group by. While I don’t have the same event you have in your account, you could set the report up using this basic structure:

Let me know if this makes sense or if I can help with anything else.