How can I calculate a percentage?

Data Pipeline

In this example, we’re dividing our cancelled subscriptions over our total subscriptions to calculate our churn rate, which is a common SaaS metric.

Create your two datasets where you wish to calculate a percentage. This is an example dataset:

Example dataset

Count of Subscriptions that have started paying, and have not cancelled.

Count of Subscriptions that have paid

Count of Subscriptions that have cancelled in the past month.

After you’ve created your two datasets, make sure to use a Cross Join.

Use Cross Join as the Merge type

In the Data Pipeline, click +Add Step, then choose Add Column from the dropdown menu. Title your column, then enter the percentage formula, which is as follows:

100.0 * "Column1" / "Column2"

To round your percentage, use the SQLite round() function. Your formula will look like this:

round( 100.0 * "Column1" / Column2", 2)

Where 2 is the number of decimal places.

If your column values are integers and you would like your results to have decimal precision, be sure to multiply by 100.0. This will convert the top value to a decimal before the division step, and will ensure your results are in decimal form.

Our example looks as follows:

Add decimal precision to integer values

Click Ok, and your percentages will be calculated.


Related Data Pipeline Help Articles

See more