Percent of Group Analytic Function

We are using US Census data to create a visual that uses the Percent of Group analytic function.

Availability Note. This feature is not available when using the following data connection types: MySQL, SQLite, and MariaDB.

To use the Percent of Group analytic function with US Census data, follow the steps in the Example.

Developer Note. If you do not have access to the US Census dataset, download the census-pop.csv.zip file, uncompress it, Importing Data, and Creating Datasets.
  1. The input set up for the Percent of Group visuals follows:

    • X shelf: state
    • Y shelf: sum(population), for now
    • Colors shelf: year
    • [Optional] Tooltips shelf: sum(population), sum(year)
    shelves for analytic functions
  2. On the Y shelf, click the icon to the right of the variable.

    field options when on shelf
    Accessing Field Options
  3. In the dropdown, hover over Analytic Functions.

    analytic functions menu
    Analytic Functions Options
  4. From the Analytical Functions menu, select Percent of group.
  5. In the Analytical Function: Percent of Group modal window,

    • In Select aggregate for this measure, leave the default Sum.
    • Under Select entities over which to take calculate percentage, select state.
    Analytic Function: Percent of Group
    Analytic Function: Percent of Group
  6. Click Apply.
  7. Click Refresh Visual.

    percentage of group for state populations over time
    Percentage of Group for State Populations over Time; Stacked Bar Chart
  8. Note the expression used for calculating the percent of group:

    sum([population]) / sum(sum([population])) over (partition by [state]) as 'percent(population)'
    Viewing the Percentage of Group Expression
    Viewing the Percentage of Group Expression

Percent of Group Analytic Function

Follow these general steps to create a percent of group visual:

  1. When creating or editing a visual, determine for which field variable you must apply an analytic function.

    The shelves that support analytic functions depend on the visual type, and are typically available for X and Y axes, Measures, Dimensions, Colors, and Tooltips.

  2. Click the icon to the right of the variable.

    field options when on shelf
    Accessing Field Options
  3. In the dropdown, click Analytic Functions.

  4. From the Analytic Functions menu, select Percent of Group.

    Analytic Function: Percent of Group Interface
    Analytic Function: Percent of Group Interface
  5. In the Analytic Function: Percent of Group modal window, in Select entities over which to calculate percentage, choose one of:

    • Sum [default]
    • Count
    • Approx Distinct Count
    • Exact Distinct Count
    • Minimum
    • Maximum
    • Average
  6. [Optional] Under Select entities over which to calculate percentage, select one or more entities listed in the modal window.
  7. Click Apply.
  8. Click Refresh Visual.