Skip to content
Telemetry
Product analytics SQL recipe

Count recorded steps in a student prototype

Run SQL on 18 fictional event rows from eight toy trials. Count distinct trials at each step without mistaking a missing event for proof of abandonment.

Beginnerprototype_eventsReviewed 2026-09-29Tested with Apache DataFusion 45.2.0

Reviewed by the Telemetry product team on . We checked the SQL syntax, required event fields, sample results, and limits on using the query. Who reviews this page

Question answered

How many distinct toy trials have a start, question-open, or answer-submitted event?

A logged-event funnel shows what the prototype recorded. It does not explain why an event is absent or prove what a person did next.

Event schema

Fields the query expects

FieldTypeWhy it exists
trial_idUtf8Fictional attempt identifier, not a student or person ID.
eventUtf8One recorded step in the toy practice-question flow.
DataFusion SQL

Copy the query

sql
SELECT
  COUNT(DISTINCT CASE WHEN event = 'flow_started' THEN trial_id END) AS started,
  COUNT(DISTINCT CASE WHEN event = 'question_opened' THEN trial_id END) AS opened,
  COUNT(DISTINCT CASE WHEN event = 'answer_submitted' THEN trial_id END) AS submitted
FROM prototype_events;

This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. We review the synthetic sample output separately. Check field types, thresholds, and counting rules against your own data. Read the testing methodology.

Query result

Recorded distinct trials

Eight starts, six question opens, and three submissions were recorded in the fictional fixture.

startedopenedsubmitted
863

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

Recorded distinct trials: static chart of synthetic submitted values from the Count recorded steps in a student prototype example result
Download this SVG chart of the sample results for an article, runbook, or design review. Please credit Telemetry.

Reproduce the example

Download the sample data

The JSON bundle includes the event schema with field types, reproducible input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1COUNT(DISTINCT trial_id) counts attempts with each event. toy-02 has two question-opening rows, so counting rows would overstate that step by one.
  2. 2The recorded count falls by two between start and open, then by three between open and submit.
  3. 3A missing submit event does not prove abandonment. The person may have stopped, the app may have failed, or the logger may have missed the event.

Edge cases to check

  • A submitted event without an opened event would break the expected sequence; inspect individual trials before interpreting a real funnel.
  • Reused or missing trial IDs can corrupt distinct counts. Define the identifier before collecting real events.
  • These fictional rows contain no randomized comparison and cannot measure the impact of a design change.

Recommended dashboard

  • Table: distinct trial counts for the three recorded steps

Alert guidance

This fictional teaching fixture is not suitable for a production alert.

Read alert setup

Set up the events this query needs

Related instrumentation and guides

Continue the analysis

Run it on your events

Create a table, adapt the fields, and save the result

Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.

Telemetry’s current terms require account creators to be over 18. Younger students can use the printable activity without creating an account. Terms of Service

Get an API key