Percent of group/pivot total
Calculate each value as a percentage of its group or pivot total
A formula table calculation computes this without hand-written SQL — combine the percent-of-total example with a PARTITION BY clause to divide each value by its group's total.
Here's an example of a percent of the total group/pivot:

And here's the SQL used in the table calculation:
${orders.total_order_amount} /
SUM(${orders.total_order_amount}) OVER (
PARTITION BY
${orders.order_date_month}
)In general, the SQL used for calculating the percent of the total has two important columns:
column_i_want_to_see_the_percent_of_total- this is the column that you want to see the percent total of. In our example above, that was thesum of profit.column_i_want_to_group_by- this is the column that you want the total to be grouped by. In our example above, that was theorder date - month.
Here's the SQL you can copy-paste to calculate the percent of the group/pivot total
${table.column_i_want_to_see_the_percent_of_total} /
SUM(${table.column_i_want_to_see_the_percent_of_total}) OVER (
PARTITION BY
${table.column_i_want_to_group_by}
)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).
