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

  1. Open a Trends insight with one event series
  2. Add a second series
  3. Turn on Formula mode
  4. Enter a formula that uses A and B
  5. Name the formula

Interactive demo

Loading 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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Create interactive demos like this one — free, no coding required.

Start for free →