# Selective Aggregation

In SuperTables you can use selective aggregation to aggregate only certain rows based on a condition. Selective aggregation instead of aggregating over all rows in a group, it aggregates based only on rows where a column  has valid values, by using a flag system that can be setup by the user to determine valid values. 1 for valid values and 0 for invalid values.

&#x20;To set up selective aggregation in SuperTables, follow these instructions:

1. **Prepare Your Worksheet**: Ensure your worksheet contains atleast one column with values (e.g., 1s for rows to aggregate and 0s for rows to leave unaggregated).
2. **Set the Column as a Dimension**: Configure this column as a dimension in Tableau, and set its data type to "String".
3. **Open SuperTables Configuration**: Navigate to the SuperTables configuration settings.
4. **Assign the Aggregation Flag Column**: Select the column you want to apply selective aggregation to, and set the "Column Flag" to the column with 1s and 0s.
5. **Set Aggregation Type**: For the measure you want to aggregate, choose the "Selective Aggregation" option under the aggregation type.
6. **Apply to Multiple Columns**: Repeat the steps for multiple columns if needed, following the same process.

The video below explains the whole process for 1 column but selective aggregation can be used with multiple columns.

<figure><img src="/files/CwV7dypNK7Hyw85Bsm7G" alt=""><figcaption></figcaption></figure>

{% file src="/files/1jvf2K82ZyE8kgBkXt1b" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.infotopics.com/supertables/guides/selective-aggregation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
