Defining Aggregates Yourself
You can define your own aggregates for use cases that fall outside of those covered by system-defined aggregates.
Prerequisites
Before defining aggregates for your models, you should familiarize yourself with the following:
- When to Define Your Own Aggregate Tables
- Partitioned User-Defined Aggregates
- About Incremental Rebuilds
If your aggregate definition will use one or more joins to dimensional datasets and the aggregate is allowed to be built with incremental builds, follow these steps before creating the aggregate:
- Read the section Incremental rebuilds of aggregates that use joins in About Incremental Rebuilds to ensure that you are aware of the special considerations for such aggregates.
- In Design Center, edit the fact dataset to enable the Allow incremental builds option. For more information, see About Incremental Rebuilds.
If you want instances of your aggregate definition to be partitioned:
- Verify that the
TABLES.CREATE.PARTITIONS.ENABLED
andAGGREGATES.CREATE.PARTITION.USERDEFINEDAGGREGATE.ENABLED
global settings are both enabled, as described in Aggregate Settings. - Set a partition key for the aggregate definition. For instructions, see Partitioned User-Defined Aggregates.
Defining aggregates for a model
To define aggregates for a model:
-
In Design Center, open the model you want to define aggregates for.
-
In the Model properties panel, under UDAs, click the + icon. The UDA properties panel opens.
-
In the Display Name field, enter a display name for the aggregate. This name will be used for the UDA in BI tools.
-
In the Unique Name field, enter a unique name for the aggregate. This must be unique within the model.
-
In the Dimensions section, select the dimensional attributes to include in the aggregate definition. You must select at least one.
These values are used to group the summarized metric data in the resulting aggregate table. Note that user-defined aggregate definitions are fixed: They do not include every level of a hierarchy unless they are explicitly defined.
-
In the Metrics section, select the metrics and calculations to include in the aggregate definition. This is the data that is summarized in the resulting aggregate table. You must select at least one.
-
Click Apply.
The UDA appears in the UDAs section of the Model properties panel and is automatically added to the model's underlying SML. You can further customize the aggregate via SML; for supported properties, see the AtScale SML Object Documentation on GitHub.
What to do next
The user-defined aggregate table is created the next time the model is deployed. You can check the status of the aggregate creation on the Aggregates page.