> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-refactor-full-audit-reorg.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Percent of column total

> The percent of the column total will give you the percentage of each value in the column out of the total sum of the values in the column.

<Note>
  A [formula table calculation](/explore/table-calculations/formulas) computes this without hand-written SQL — see the [percent-of-total example](/explore/table-calculations/formulas#examples): `=revenue / SUM(revenue) * 100`.
</Note>

[Just gimme the code! <Icon icon="bug" iconType="solid" />](#here’s-the-sql-you-can-copy-paste-to-calculate-the-percent-of-the-column-total)

Here's an example of a percent of the total column:

<Frame>
  <img src="https://mintcdn.com/lightdash-refactor-full-audit-reorg/Y1Tt9ArnO_oUIk2_/images/explore/table-calculations/sql-templates/percent-of-total-column/percent-of-total-b8c053a0eb7fad3061bc54438ef495de.jpg?fit=max&auto=format&n=Y1Tt9ArnO_oUIk2_&q=85&s=b6348d173eafc12f932463e51e614ac6" width="2873" height="1391" data-path="images/explore/table-calculations/sql-templates/percent-of-total-column/percent-of-total-b8c053a0eb7fad3061bc54438ef495de.jpg" />
</Frame>

And here's the SQL used in the table calculation:

```sql theme={null}
${orders.total_order_amount} / SUM(${orders.total_order_amount}) OVER()
```

In general, the SQL used for calculating the percent of the total has just one important column:

* `column_i_want_to_see_the_percent_of_total` - this is the column that you want to see each value's percent of the total values in that column

### Here's the SQL you can copy-paste to calculate the percent of the column total

```sql theme={null}
${table.column_i_want_to_see_the_percent_of_total} /
  SUM(${table.column_i_want_to_see_the_percent_of_total}) OVER()
```

### Make sure to add percent formatting to your calculation

In the `format` tab, make sure to update the format to `percent` so that your table calculation is shown as a percentage value (instead of a number).

<Frame>
  <img src="https://mintcdn.com/lightdash-refactor-full-audit-reorg/xyxY8b3SfAcIlLzW/images/explore/table-calculations/sql-templates/format-percent-6d905aa48e29631b298dd27a38a8b183.jpg?fit=max&auto=format&n=xyxY8b3SfAcIlLzW&q=85&s=98cb7f221b03ffd38de40f315fb49f9b" width="2644" height="1512" data-path="images/explore/table-calculations/sql-templates/format-percent-6d905aa48e29631b298dd27a38a8b183.jpg" />
</Frame>
