# Dynamic Aggregation

{% hint style="info" %}
This guide is for **Tableau** only.
{% endhint %}

We combine the power of Tableau Parameters and visible columns in SuperTables. By doing this we will automatically remove / add detail from the datasheet which results in a different level of aggregation. With this incredible feature you only query the data you are looking at, and Table Calculations / LOD calculations will also keep working like you expect! On top of that you benefit from a performance boost!

#### Dynamic Aggregation V2 (SuperTables 5.5.1+)&#x20;

We have introduced an easier and faster way of setting up dynamic aggregation which only requires 1 parameter! Please find attached workbook for an example:

{% file src="<https://1304574535-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe2zyseN6XFBaLs6YTcnd%2Fuploads%2FJDs41JN8x3QgdYuvMN5a%2Fdynamic_aggregation_v2_example.twbx?alt=media&token=4c49ac12-6fb0-4a98-bef1-b3ec53e87692>" %}

#### Set up Dynamic Aggregation V2

* 1\. Create a string parameter with allowable values on 'All', and select it in the dropdown above. For example: My Parameter
* 2\. Create a calculated field for the dimension you want to auto aggregate. For example: 'My Ship Mode'
* 3\. Use this calculation:\
  IIF(CONTAINS(\[My Parameter], "|My Ship Mode|"), \[Ship Mode], "\_")\
  Optional: Surround the name of the calculation in "|" to ensure unique column selection
* 4\. Remove the original \[Ship Mode] from the datasheet.
* Tip: If you want to reuse your current \[Ship Mode] column configuration, rename \[Ship Mode] to something else (i.e. 'Original Ship Mode') and name you calculated field 'Ship Mode'.

####

####

#### Set up Dynamic Aggregation V1 (deprecated)

Enter the configuration screen of SuperTables and head to the **Appearance** tab. Under Layout Options tick ‘Enable auto aggregation based on the visible columns in the table’

<figure><img src="https://appsfortableau.infotopics.com/wp-content/uploads/2022/09/SuperTables-Dynamic-Aggregation.png" alt=""><figcaption></figcaption></figure>

**Our example:**

1\. Create a string parameter with the exact same name as your column. For example: ‘Category’\
2\. Create a calculated field with the same name as the parameter in step 1.\
3\. Use this calculation: IIF(\[parameter\_name] = ‘true’, \[name\_of\_the\_dimension], ‘\_’)\
4\. Check if the parameter updates when you show/hide the column. In this example the column ‘Category’.

Next create a parameter of type ‘string’ with the current value ‘true’ as next we will be creating a calculated field. Follow our GIF to set up the calculated field.

**Parameter:**

<figure><img src="https://appsfortableau.infotopics.com/wp-content/uploads/2022/09/SuperTables-Parameter.gif" alt=""><figcaption></figcaption></figure>

**Calculated Field:**

<figure><img src="https://appsfortableau.infotopics.com/wp-content/uploads/2022/09/SuperTables-Calculated-Field-2.gif" alt=""><figcaption></figcaption></figure>

All done, reload the extension to implement the dynamic aggregation to your SuperTable!

<figure><img src="https://appsfortableau.infotopics.com/wp-content/uploads/2022/09/SuperTables-Dynamic-Aggregation-Front-End.gif" alt=""><figcaption></figcaption></figure>
