How to use formulas in insights in PostHog
Learn how to combine two event series in a PostHog Trends insight with formula mode, so you can chart a ratio such as completed tasks per created task.

Quick answer
Open a new Trends insight, add two event series so they are labeled A and B, then turn on Formula mode. Type an expression such as B / A * 100 into the formula box and PostHog plots the result. Give the formula a name so the chart line is easy to read.
Steps at a glance
- Open a Trends insight with one event series
- Add a second series
- Turn on Formula mode
- Enter a formula that uses A and B
- Name the formula
Interactive demo
Summary
Formulas let a Trends insight do math across its series, so you can chart ratios and rates instead of raw counts. They turn two event counts into one metric, such as a completion rate, that you can track over time.
Step-by-step guide
Step 1
Add a second series
In a Trends insight, the first event appears as series A. Click the Series button below it to add series B, then pick the second event you want to compare.
Step 2
Turn on formula mode
With two series on the chart, switch on the Formula mode toggle under the series list. A formula box appears, and the chart still shows both series with their totals.
Step 3
Enter a formula
Click the formula box and type an expression that refers to the series by letter, for example B / A * 100. Each letter matches the series with that label, so B is the second event and A is the first.
Step 4
Name the formula
Click Formula name (optional) and type a short label such as Completion rate. The name shows in the chart legend, so teammates know what the line measures.
Why this matters
You track tasks created and tasks completed, but the two raw counts do not tell you how well work is getting finished. A formula turns them into one completion-rate line you can watch day by day and share with your team.
Frequently asked questions
How do I refer to a series in a formula?
Use the letter shown beside the series. The first series is A and the second is B.
Can I add more than one formula?
The Add formula button sits under the formula box, so you can add another formula to the same insight.
Related guides
Continue with more step-by-step guides for getting work done.
How to create a trends insight in PostHogBuild a PostHog trends insight that charts the task_created event over the last 14 days, then name it and save it so you can reopen it later.
How to break down an insight by property in PostHogBreak down a PostHog trends insight by a property such as plan. Open the insight in edit mode, add a breakdown and pick the property to group by.
How to add an annotation in PostHogLearn how to add an annotation in PostHog: open Annotations, write a note such as a launch, and save it so the date is marked on your charts.
How to view live events in PostHogLearn how to watch PostHog events arrive in real time from the Activity page, filter the stream to a single event, and pause it to read it.
How to view person profiles in PostHogOpen a person in PostHog from People and groups, then review their properties and event activity on the profile page's Properties and Events tabs.
How to write a SQL query in PostHogLearn how to write a SQL query in PostHog: enter a query in the SQL editor, run it, and read a table of your most frequent events over 14 days.
Create interactive demos like this one — free, no coding required.
Start for free →