COUNT_ACTIVE
All functions > BUSINESS > COUNT_ACTIVE
Returns the number of active days for the given activity bits and time period
Signatures
Returns: Number of active days in the specified period
COUNT_ACTIVE(activity_bits: BIGINT, length_days: BIGINT, [offset_days: BIGINT]) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
activity_bits | BIGINT | Yes | Bit-packed activity representation |
length_days | BIGINT | Yes | Length of time period to count |
offset_days | BIGINT | No | Optional offset from reference date (default 0) |
Notes
- Counts number of days user was active in time window
- Uses efficient BIT_COUNT operation
- offset_days=0 counts most recent period
- Returns integer from 0 to length_days
- More granular than IS_ACTIVE (which returns boolean)
- Useful for engagement metrics, frequency analysis
- Common for calculating days active per week/month
On this page