WEIGHTED SUM Billable Metric
Step-by-Step Setup When creating a WEIGHTED SUM-based metered feature:-
Navigate to Features
- Go to Product Catalog → Features
- Click “Add Feature”
-
Basic Information
- Name: “Reserved Storage” (or descriptive name)
- Type: Select “Metered”
-
Event Configuration
- Event Name:
storage.reserved
(must match your event data) - Aggregation Function: Weighted Sum
- Aggregation Field:
gb_reserved
(the property to weight by time)
- Event Name:
-
Usage Settings
- Usage Reset: Periodic (for capacity-based billing)
- Unit Name:
GB-time
(time-weighted unit)
- Save Feature
Calculation Example
Billing Period
Period: July 31, 2025 18:30:00 UTC to August 31, 2025 18:30:00 UTCTotal period duration: 31 days = 2,678,400 seconds
Event Data
Weighted Sum Formula
Calculation Process
Event 1: August 16, 2025 - 20 GB
- Event timestamp: August 16, 2025 00:00:00 UTC
- Seconds until period end: August 31 18:30:00 - August 16 00:00:00 = 15 days, 18.5 hours = 1,365,300 seconds
- Weighted contribution: (20 / 2,678,400) × 1,365,300 = (20 × 1,365,300) / 2,678,400 = 27,306,000 / 2,678,400 = 10.198660714285714 GB
Event 2: August 18, 2025 - 10 GB
- Event timestamp: August 18, 2025 00:00:00 UTC
- Seconds until period end: August 31 18:30:00 - August 18 00:00:00 = 13 days, 18.5 hours = 1,197,300 seconds
- Weighted contribution: (10 / 2,678,400) × 1,197,300 = (10 × 1,197,300) / 2,678,400 = 11,973,000 / 2,678,400 = 4.470982142857143 GB
Event 3: August 20, 2025 - 10 GB
- Event timestamp: August 20, 2025 00:00:00 UTC
- Seconds until period end: August 31 18:30:00 - August 20 00:00:00 = 11 days, 18.5 hours = 1,029,300 seconds
- Weighted contribution: (10 / 2,678,400) × 1,029,300 = (10 × 1,029,300) / 2,678,400 = 10,293,000 / 2,678,400 = 3.843303571428571 GB
Event 4: August 25, 2025 - 5 GB
- Event timestamp: August 25, 2025 00:00:00 UTC
- Seconds until period end: August 31 18:30:00 - August 25 00:00:00 = 6 days, 18.5 hours = 573,300 seconds
- Weighted contribution: (5 / 2,678,400) × 573,300 = (5 × 573,300) / 2,678,400 = 2,866,500 / 2,678,400 = 1.070200892857143 GB
Total Weighted Sum
10.198660714285714 + 4.470982142857143 + 3.843303571428571 + 1.070200892857143 = 19.583147321428571 GB Result:19.583147321428571 GB-time
Use Cases
Reserved Capacity Billing
Perfect for: Cloud storage reservations, compute capacity, bandwidth reservationsTime-Based Resource Usage
Perfect for: Database connections, server instances, license usageSubscription Changes
Perfect for: Mid-cycle plan changes, prorated upgrades/downgradesInfrastructure Provisioning
Perfect for: VM instances, container resources, network bandwidthLicense Allocation
Perfect for: Software seats, user licenses, feature entitlementsWhen to Use WEIGHTED SUM
✅ Use WEIGHTED SUM when:- Billing for reserved or allocated capacity
- Need time-proportional calculations
- Handling mid-cycle subscription changes
- Measuring sustained resource usage over time
- Events earlier in the period have more time remaining and get higher weight
Key Characteristics
- Time-weighted calculation - Events earlier in the period have higher impact
- Perfect for capacity billing - Bills based on how long resources were allocated
- Handles subscription changes - Automatically prorates usage changes
- Complex formula - More computationally intensive than other aggregations
Next Steps
- Creating a Metered Feature - Complete setup guide
- Sending Events - How to transmit WEIGHTED SUM events