query_segmentation_average
Calculate average numeric metrics like purchase amounts or session durations over time. Input event data, date range, and expression to analyze trends by hour or day.
Instructions
Averages an expression for events per unit time. Useful for calculating average values like purchase amounts, session durations, or any numeric metric, and tracking how these averages change over time.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
event | Yes | The event that you wish to get data for. Note: this is a single event name, not an array | |
from_date | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) | |
on | Yes | The expression to average per unit time. The result of the expression should be a numeric value | |
project_id | No | The Mixpanel project ID. Optional since it has a default. | |
to_date | Yes | The date in yyyy-mm-dd format to query to (inclusive) | |
unit | No | The buckets [hour, day] into which the property values are placed. Default is 'day' | |
where | No | An expression to filter events by based on the grammar: <expression> ::= 'properties["' <property> '"]' | <expression> <binary op> <expression> | <unary op> <expression> | <math op> '(' <expression> ')' | <string literal> <binary op> ::= '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'and' | 'or' | <unary op> ::= '-' | 'not' | |
workspace_id | No | The ID of the workspace if applicable |