percentOfTotal

The percentOfTotal function calculates the percentage a measure contributes to the total, based on the dimensions specified.

Syntax

The brackets are required. To see which arguments are optional, see the following descriptions.

Copy
percentOfTotal
(
     measure 
     ,[ partition_field, ... ] 
)

Arguments

measure

An aggregated measure that you want to see the percent of total for. Currently, the distinct count aggregation is not supported for percentOfTotal.

partition field

(Optional) One or more dimensions that you want to partition by, separated by commas.

Each field in the list is enclosed in {} (curly braces), if it is more than one word. The entire list is enclosed in [ ] (square brackets).

Example

The following example creates a calculation for the percent of total Sales contributed by each State.

Copy
percentOfTotal
(
     sum(Sales), 
     [State]

The following example calculates the percent that a specific Billed Amount is when compared to the total Billed Amount, partitioned by ([{Service Line} ASC]). The fields in the table calculation are in the field wells of the visual.

Copy
percentOfTotal
(
     sum( {Billed Amount} ), 
     [{Service Line}]
)

The following screenshot shows the results of the example. The red highlights show that the partition field with the value "Billing" has three entries, one for each region. The total billed amount for this service line is divided into three percentages, which total 100 percent. Percentages are rounded and might not always add up to exactly 100 percent.