Orb What's new in Orb logo
Back to Homepage

What's new in Orb

Subscribe to Updates

Labels

  • All Posts
  • API
  • Dashboard
  • Integrations
  • Performance
  • Subscription Management
  • Billable Metrics
  • Feature
  • Invoices
  • Customer Portal
  • Improvement
  • Tax
  • IT Administration
  • Revenue Reporting
  • Webhooks
  • Plan Configuration
  • Developer Experience
  • Pricing Models
  • Usage Data
  • Coupons
  • Credits
  • Data Exports

Jump to Month

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
Changelog byAnnounceKit

Create yours, for free!

2 years ago

New custom SQL functions

Orb's billable metrics layer now supports two time-based SQL functions, EARLIEST_BY and LATEST_BY. These can be used in combination with the timestamp of an event to perform queries that take the latest or earliest event in a billing period. They behave as follows:

  1. EARLIEST_BY(value_property, time_based_property): Returns the earliest value of value_property ordered by time_based_property.
  2. LATEST_BY(value_property, time_based_property): Returns the latest value of value_property ordered by time_based_property.

For example, you might use these functions to compute the earliest and latest storage_gbvalues seen during the month to naively compute storage added. 

Note that Orb automatically applies time range filtering to billable metric queries based on the billing period bounds.