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

ParameterTypeRequiredDescription
activity_bitsBIGINTYesBit-packed activity representation
length_daysBIGINTYesLength of time period to count
offset_daysANYYesOptional 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
Last update at: 2025/10/13 10:23:46