How to calculate Sessions per User
Sessions per user is the average number of visits each active user makes to your product in a period.
Formula
Sessions per user = total sessions ÷ distinct active users in the same periodSQL query
This example assumes: sessions(id, user_id bigint, started_at timestamptz). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.
SELECT DATE_TRUNC('week', started_at)::date AS week,
COUNT(*) AS sessions,
COUNT(DISTINCT user_id) AS users,
COUNT(*)::numeric / NULLIF(COUNT(DISTINCT user_id), 0) AS sessions_per_user
FROM sessions
WHERE user_id IS NOT NULL
GROUP BY 1
ORDER BY 1;Common mistakes that make Sessions per User wrong
- Anonymous sessions have no user id; leaving them out changes the denominator.
- A few power users can pull the average up; look at the median too.
- How a session ends (timeout, tab close) is a tool setting that changes the count.
Ask for Sessions per User in plain English
Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.
- What is the average number of sessions per user each week?
- How many users had more than 5 sessions last week?