COUNT_ACTIVE
All functions > BUSINESS_ACTIVITY > COUNT_ACTIVE
Returns the number of active days for the given activity bits and time period
Syntax
COUNT_ACTIVE(activity_bits: BIGINT, length_days: BIGINT) → BIGINT
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
activity_bits | BIGINT | Yes | Bit-packed activity representation |
length_days | BIGINT | Yes | Length of time period to count |
offset_days | ANY | Yes | Optional offset from reference date (default 0) |
Returns
BIGINT - Number of active days in the specified period
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