Changing Column Aggregation

You may find it useful to change the basic attribute defaults in your dataset. For example, the default aggregation function for numerical values is Sum; for some measures, another aggregation operation, such as Average, is more appropriate.

The following steps demonstrate how to change the default aggregation function from Sum to Average for the column life_expectancy in dataset World Life Expectancy [data source samples.world_life_expectancy].

  1. On the main navigation bar, click Data.

    The Data view appears, open on the Datasets tab.

  2. In the left navigation menu, click samples.
  3. In the Datasets area, select World Life Expectancy (samples.world_life_expectancy).

    selecting a dataset
    Selecting Dataset 'World Life Expectancy'
  4. In the Dataset Detail menu, select Attributes.

    detail of 'World Life Expectancy'
    Dataset Detail for 'World Life Expectancy'
  5. In the Attributes area, select Edit Attributes.

    Edit attributes for 'World Life Expectancy'
    Editing Attributes for 'World Life Expectancy'
  6. Under Measures, find the field life_expectancy, and click the down arrow on its right side.

    From the menu, select Edit Attributes.

    selecting edit attribute window
    Editing Column Properties
  7. The Edit Table Column Properties window modal appears.

    Change Default Aggregation from Sum to Average, and click Apply.

    changing default aggregation
    Changing Default Aggregation
  8. Under Dataset: World Life Expectancy, click Save.

    Saving changes to attributes
    Saving Changes to Attributes
  9. As a result of this change, all new visuals created from this dataset will automatically use the new aggregation.

    To test this, click New Visual in the top left corner of the Dataset: World Life Expectancy page.

  10. On the left navigation, under Measures, pick up the field life_expectancy, and drag it to the Measures shelf.

    Notice that the field appears as avg(life_expectancy).

    altered column shows new default aggregation
    Default Aggregation Changed from Sum() to AVG()