Skip to main content
Question

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

  • November 25, 2025
  • 1 reply
  • 12 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 

1 reply

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.