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
ParameterTypeRequiredDescription
activity_bitsBIGINTYesBit-packed activity representation
length_daysBIGINTYesLength of time period to count
offset_daysBIGINTNoOptional 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
Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19