Skip to content

Temporal Aggregates

Temporal aggregates fetch individual values from a time-based or fixed-size window. When an event scope is supplied, they are best thought of as realtime joins between events.

First

Returns the first-seen value for given feature(s)

Syntax:

First<event>(query)

Code Examples:

First(ip, email by user where successful)
First(user by ip, user_agent last 10 minutes)
First(sku by account where price > 2000 after latest_billing_change)
First<page>(path by session_id last 2 hours)

Data Example:

_time user ip First(ip by user) First(ip by user last hour)
9:40AM anna 1.1.1.1 1.1.1.1 1.1.1.1
10:20AM brad 2.2.2.2 2.2.2.2 2.2.2.2
11:00AM anna 3.3.3.3 1.1.1.1 3.3.3.3
11:40AM anna 1.1.1.1 1.1.1.1 3.3.3.3
12:20PM anna 4.4.4.4 1.1.1.1 1.1.1.1

FirstTime

Returns the first-seen event time for the given clauses

Syntax:

FirstTime<event>(query)

Code Examples:

FirstTime(by user where successful)
FirstTime(by ip, user_agent last 10 minutes)
FirstTime(by account where price > 2000 after latest_billing_change)
FirstTime<signup>(by email where successful)

Data Example:

_time user FirstTime(by user) FirstTime(by user last hour)
9:40AM anna 9:40AM 9:40AM
10:20AM brad 10:20AM 10:20AM
11:00AM anna 9:40AM 11:00AM
11:40AM anna 9:40AM 11:00AM
12:20PM anna 9:40AM 11:40AM

Latest

Returns the most recent past value for given feature(s)

Syntax:

Latest<event>(query)

Code Examples:

Latest(ip, email by user where successful)
Latest(user by ip, user_agent last 10 minutes exclusive)
Latest(sku by account where price > 2000 after latest_billing_change)
Latest<click>(path, element by session_id last 10 minutes)

Data Example:

_time user ip Latest(ip by user) Latest(ip by user exclusive)
9:40AM anna 1.1.1.1 1.1.1.1 null
10:20AM brad 2.2.2.2 2.2.2.2 null
11:00AM anna 3.3.3.3 3.3.3.3 1.1.1.1
11:40AM anna 1.1.1.1 1.1.1.1 3.3.3.3
12:20PM anna 4.4.4.4 4.4.4.4 1.1.1.1

LatestTime

Returns the most recent past event time for the given clauses

Syntax:

LatestTime<event>(query)

Code Examples:

LatestTime(by user where successful)
LatestTime(by ip, user_agent exclusive)
LatestTime(by account where price > 2000 after latest_billing_change)
LatestTime<login>(by email where successful)

Data Example:

_time user LatestTime(by user) LatestTime(by user exclusive)
9:40AM anna 9:40AM null
10:20AM brad 10:20AM null
11:00AM anna 11:00AM 9:40AM
11:40AM anna 11:40AM 11:00AM
12:20PM anna 12:20AM 11:40AM