You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/maker/data-platform/define-rollup-fields.md
+38-24Lines changed: 38 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Define rollup columns with Power Apps | MicrosoftDocs"
3
-
description: "Learn how to define rollup columns"
4
-
ms.date: 06/21/2022
3
+
description: "Learn how to define rollup columns."
4
+
ms.date: 02/15/2024
5
5
ms.topic: "conceptual"
6
6
applies_to:
7
7
- "Dynamics 365 (online)"
@@ -23,12 +23,12 @@ In more complex scenarios, you can aggregate data over the hierarchy of rows. As
23
23
24
24
## Rollup columns benefits and capabilities
25
25
26
-
The benefits and capabilities of rollup columns include the following:
26
+
The benefits and capabilities of rollup columns include:
27
27
28
28
- Visual editing is easy. You can create rollup columns by using the Column Editor, just like you do when you create a regular column.
29
29
- Wide selection of aggregate functions. You can aggregate data by using the following functions: `SUM`, `COUNT`, `MIN`, `MAX` and `AVG`.
30
30
- Full filter support for aggregation. You can set various filters for the source table or related table while setting multiple conditions.
31
-
- Seamless integration with the user interface. You can include the rollup columns in forms, views, charts and reports.
31
+
- Seamless integration with the user interface. You can include the rollup columns in forms, views, charts, and reports.
32
32
- Rollup columns are solution components. You can easily transport the rollup columns as components between environments and distribute them in solutions.
33
33
- Rollup columns and the calculated columns are complementary to each other. You can use a rollup column as a part of the calculated column, and vice versa.
34
34
- You can configure rollup columns to use custom controls.
@@ -73,30 +73,30 @@ To view rollup jobs:
73
73
74
74
### Mass Calculate Rollup Field
75
75
76
-
Mass Calculate Rollup Field is a recurring job, created for each rollup column. It runs once, after you create or update a rollup column. The job recalculates the specified rollup column value in all existing records that contain this column. By default, the job will run 12 hours after you have created or updated a column. When the column is modified, the job resets to run again in 12 hours after the update. The 12-hour delay is needed to assure that the Mass Calculate Rollup Field runs during the non-operational hours of the environment.
76
+
Mass Calculate Rollup Field is a recurring job, created for each rollup column. It runs once, after you create or update a rollup column. The job recalculates the specified rollup column value in all existing records that contain this column. By default, the job will run 12 hours after you have created or updated a column. When the column is modified, the job resets to run again in 12 hours after the update. The 12-hour delay is needed to assure that the Mass Calculate Rollup Field runs during the nonoperational hours of the environment.
77
77
78
-
We recommend that an administrator adjusts the start time of a Mass Calculate Rollup Field job after the rollup column is created or modified, in such a way that it runs during non-operational hours. For example, midnight would be a good time to run the job to assure efficient processing of the rollup columns.
78
+
We recommend that an administrator adjusts the start time of a Mass Calculate Rollup Field job after the rollup column is created or modified, in such a way that it runs during nonoperational hours. For example, midnight would be a good time to run the job to assure efficient processing of the rollup columns.
79
79
80
80
Notice that, when the situation occurs where the rollup column is never updated, the Mass Calculate Rollup Field job won't run again for that column until after 10 years have passed. This behavior is by design. When there aren't any updates in the underlying columns associated with the rollup field, there isn't any reason to run the job more frequently.
81
81
82
82
83
83
### Calculate Rollup Column
84
84
85
-
**Calculate Rollup Field** is a recurring job that does incremental calculations of all rollup columns in the existing rows for a specified table. There is only one **Calculate Rollup Field** job per table. The incremental calculations mean that the **Calculate Rollup Field** job processes the rows that were created, updated, or deleted after the last **Mass Calculate Rollup Field** job finished execution. The default minimum recurrence setting is one hour. The job is automatically created when the first rollup column on a table is created and deleted when the last rollup column is deleted.
85
+
**Calculate Rollup Field** is a recurring job that does incremental calculations of all rollup columns in the existing rows for a specified table. There's only one **Calculate Rollup Field** job per table. The incremental calculations mean that the **Calculate Rollup Field** job processes the rows that were created, updated, or deleted after the last **Mass Calculate Rollup Field** job finished execution. The default minimum recurrence setting is one hour. The job is automatically created when the first rollup column on a table is created and deleted when the last rollup column is deleted.
86
86
87
87
## Online recalculation option
88
-
The rollup column on the form displays a calculator image, rollup value, and the time of the last calculation. To recaclulate, select the calculator image, and then select the **Recalculate** button that appears.
88
+
The rollup column on the form displays a calculator image, rollup value, and the time of the last calculation. To recalculate, select the calculator image, and then select the **Recalculate** button that appears.
89
89
90
90
> [!div class="mx-imgBorder"]
91
91
> 
92
92
93
93
94
94
There are a few considerations you should keep in mind when using the online recalculation option (manual refresh on the form):
95
95
96
-
- You must have Write privileges on the table and Write access rights on the source row on which you are requesting the Refresh. For example, if you are calculating the estimated revenue from the open opportunities of an account, you don't have to have Write privileges on the opportunity table, only on the account table.
96
+
- You must have Write privileges on the table and Write access rights on the source row on which you're requesting the Refresh. For example, if you're calculating the estimated revenue from the open opportunities of an account, you don't have to have Write privileges on the opportunity table, only on the account table.
97
97
- This option is only available in the online mode. You can't use it while working offline.
98
-
- The maximum number of rows during the rollup refresh is limited to 50,000 rows. In case of the hierarchical rollup, this applies to the related rows across the hierarchy. If the limit is exceeded, you see an error message: *Calculations can't be performed online because the calculation limit of 50,000 related rows has been reached.* This limit does not apply when the rollup is automatically recalculated by the system jobs.
99
-
- The maximum hierarchy depth is limited to 10 for the source row. If the limit is exceeded, you see an error message: *Calculations can't be performed online because the hierarchy depth limit of 10 for the source row has been reached.* This limit does not apply when the rollup is automatically recalculated by the system jobs.
98
+
- The maximum number of rows during the rollup refresh is limited to 50,000 rows. In case of the hierarchical rollup, this applies to the related rows across the hierarchy. If the limit is exceeded, you see an error message: *Calculations can't be performed online because the calculation limit of 50,000 related rows has been reached.* This limit doesn't apply when the rollup is automatically recalculated by the system jobs.
99
+
- The maximum hierarchy depth is limited to 10 for the source row. If the limit is exceeded, you see an error message: *Calculations can't be performed online because the hierarchy depth limit of 10 for the source row has been reached.* This limit doesn't apply when the rollup is automatically recalculated by the system jobs.
100
100
101
101
## Modify rollup job recurrence
102
102
@@ -114,17 +114,17 @@ For the **Calculate Rollup Field** job, the available selections are: **Modify R
114
114
115
115
## Examples
116
116
117
-
Let's take a look at several rollup column examples. We'll aggregate data for a row from the related rows with and without using a hierarchy. We'll also aggregate data for a row from related activities and activities indirectly related to a row via the ActivityParty table. In each example, we define the rollup column by using the Column Editor. To open the Column Editor, open solution explorer and expand **Components** > **Tables**. Select the table you want and select **Columns**. Choose **New**. In the editor, provide the required information for the column, including the **Column Type** and **Data Type**. In the **Column Type**, select **Rollup**, after you have selected the data type. The data types include decimal or whole numbers, currency, and date/time. Choose the **Edit** button next to the **Column Type**. This takes you to the rollup column definition editor. The rollup column definition consists of three sections: **Source table**, **Related table** and **Aggregation**.
117
+
Let's take a look at several rollup column examples. We'll aggregate data for a row from the related rows with and without using a hierarchy. We'll also aggregate data for a row from related activities and activities indirectly related to a row via the ActivityParty table. In each example, we define the rollup column by using the Column Editor. To open the Column Editor, open solution explorer and expand **Components** > **Tables**. Select the table you want and select **Columns**. Choose **New**. In the editor, provide the required information for the column, including the **Column Type** and **Data Type**. In the **Column Type**, select **Rollup**, after you have selected the data type. The data types include decimal or whole numbers, currency, and date/time. Choose the **Edit** button next to the **Column Type**. This takes you to the rollup column definition editor. The rollup column definition consists of three sections: **Source table**, **Related table, and **Aggregation**.
118
118
119
119
- In the **Source table** section, you specify the table for which the rollup column is defined and whether or not you aggregate over a hierarchy. You can add filters with multiple conditions to specify the rows in the hierarchy you want to use for rollup.
120
120
121
-
- In the **Related table** section, you specify the table over which you aggregate. This section is optional when you choose to rollup over the hierarchy on the source table. You can add filters with multiple conditions to specify which related rows to use in the calculation. For example, you include the revenue from the open opportunities with an annual revenue greater than $1000.
121
+
- In the **Related table** section, you specify the table over which you aggregate. This section is optional when you choose to rollup over the hierarchy on the source table. You can add filters with multiple conditions to specify which related rows to use in the calculation. For example, you include the revenue from the open opportunities with an annual revenue greater than $1,000.
122
122
123
-
- In the **Aggregate** section, you specify the metric you want to compute. You can choose available aggregate functions, such as SUM, COUNT, MIN, MAX or AVG.
123
+
- In the **Aggregate** section, you specify the metric you want to compute. You can choose available aggregate functions, such as SUM, COUNT, MIN, MAX, or AVG.
124
124
125
125
### Aggregate data for a row from related rows
126
126
127
-
In this example, a hierarchy is not used. The total estimated revenue is calculated for an account, from the related open opportunities.
127
+
In this example, a hierarchy isn't used. The total estimated revenue is calculated for an account, from the related open opportunities.
128
128
129
129

130
130
@@ -142,7 +142,7 @@ In this example, we calculate the total estimated revenue of open opportunities
142
142
143
143
### Aggregate data for a row from all related activities
144
144
145
-
In this example, we calculate the total time spent and billed from all activities related to an account. This may include time spent on the phone, at appointments, or on custom activities.
145
+
In this example, we calculate the total time spent and billed from all activities related to an account. This might include time spent on the phone, at appointments, or on custom activities.
146
146
147
147
In earlier releases, you could define a rollup column for an individual activity, such as a phone call, fax, or appointment. But, to achieve the result of the example shown below, you had to total the data by using the calculated columns. Now, you can do it all in one step by defining one rollup column for the Activity table.
148
148
@@ -169,21 +169,35 @@ The following example shows how to calculate an average estimated revenue from r
169
169
170
170
<aname="BKMK_considerations"></a>
171
171
172
-
## Rollup column considerations
172
+
## Rollup column considerations
173
173
174
174
You should be aware of certain conditions and restrictions when working with rollup columns:
175
175
176
-
- You can define a maximum of 100 rollup columns for the organization and up to 10 rollup columns per table.
176
+
- You can define a maximum of 200 rollup columns for the environment and up to 50 rollup columns per table. The current default values and previous maximum are 100 per environment and 10 per table. More information: [Define the maximum number of rollup columns in an environment or table](#define-the-maximum-number-of-rollup-columns-in-an-environment-or-table)
177
177
- A workflow can't be triggered by the rollup column updates.
178
-
- A workflow wait condition cannot use a rollup column.
179
-
- A rollup over the rollup column is not supported.
178
+
- A workflow wait condition can't use a rollup column.
179
+
- A rollup over the rollup column isn't supported.
180
180
- A rollup can't reference a calculated column that uses another calculated column, even if all the columns of the other calculated column are on the current table.
181
-
- The rollup can only apply filters to the source table or related tables, simple columns or non-complex calculated columns.
181
+
- The rollup can only apply filters to the source table or related tables, simple columns or noncomplex calculated columns.
182
182
- A rollup can be done only over related tables with the 1:N relationship. A rollup can't be done over the N:N relationships.
183
183
- A rollup can't be done over the 1:N relationship for the Activity table or the Activity Party table.
184
-
- The business rules, workflows or calculated columns always use the last calculated value of the rollup column.
184
+
- The business rules, workflows, or calculated columns always use the last calculated value of the rollup column.
185
185
- A rollup column is aggregated under the system user context. All users are able to see the same rollup column value. You can control the rollup column visibility with the column level security (FLS), by restricting who can access the rollup column. More information [Column level security to control access](/dynamics365/customer-engagement/admin/field-level-security).
186
186
187
+
### Define the maximum number of rollup columns in an environment or table
188
+
189
+
You can define a maximum of 200 rollup columns for the environment and up to 50 rollup columns per table. The current default values and previous maximums are 100 per environment and 10 per table.
190
+
191
+
To increase the maximums, follow these steps:
192
+
193
+
1. Go to Power Apps (make.powerapps.com), select **Table** on the left navigation pane, and then open the **Organization** table.
194
+
1. Select the *n***more** list, and then type *maxr* in the **Search** box. Select the **MaxRollupFieldsPerOrg** and **MaxRollupFieldsPerEntity** columns, and then select **Save**.
195
+
:::image type="content" source="media/max-rollup-properties.png" alt-text="Select max rollup columns to increase values":::
196
+
1. Change the values for **MaxRollupFieldsPerOrg** (up to 200) and **MaxRollupFieldsPerEntity** (up to 50) that you want.
197
+
198
+
> [!IMPORTANT]
199
+
> Having more than 100 rollup columns for an environment might result in degraded performance of rollup columns and increased storage consumption.
200
+
187
201
### Precision rounding
188
202
189
203
If the precision of the aggregated column is greater than the precision of the rollup column, the aggregated column precision is rounded down to the precision of the rollup column, before the aggregation is performed. To illustrate this behavior, let's look at a specific example. Let's say that the rollup column on the account table, for calculating the total estimated revenue of the related opportunities, has a precision of two decimal points. The Est. Revenue column on the opportunity table is the aggregated column with the precision of four decimal points. In our example, the account has two related opportunities. The aggregated sum of the estimated revenue is calculated as follows:
@@ -196,12 +210,12 @@ As you can see, the precision rounding to two decimal points on the aggregated c
196
210
197
211
### Different behavior from Associated grids
198
212
199
-
Certain table forms, such as Account or Contact, out-of-the-box, contain the associated grids. For example, an Account form includes Contacts, Cases, Opportunities and other grids. Some of the rows shown in the Account form grids are directly related to the account row; others, indirectly, through the relationships with other rows. In comparison, the rollup column aggregation uses only direct relationships explicitly defined in the rollup column definition. No other relationships are considered. To illustrate the difference in behavior, let's look at the following example.
213
+
Certain table forms, such as Account or Contact, out-of-the-box, contain the associated grids. For example, an Account form includes Contacts, Cases, Opportunities, and other grids. Some of the rows shown in the Account form grids are directly related to the account row; others, indirectly, through the relationships with other rows. In comparison, the rollup column aggregation uses only direct relationships explicitly defined in the rollup column definition. No other relationships are considered. To illustrate the difference in behavior, let's look at the following example.
200
214
201
215
1. The account A1 has a primary contact, P1. The case C1 is associated with the account A1 (C1.Customer column = A1) and the case C2 is associated with the contact P1 (C2.Customer column = P1).
202
216
1. The **Cases** grid on the **Account** form for the A1 row, shows two cases, C1 and C2.
203
217
1. The rollup column on the account table, called Total Number of Cases, is used to count the cases associated with the account.
204
-
1. In the account rollup column definition, we specify the cases that have the Customer relationship with the account. After aggregation, the Total Number of Cases is equal to 1 (case C1). The case C2 is not included in the total, as it is directly related to the contact, not to the account, and can't be explicitly defined in the account rollup column definition. As a result, the total number of cases returned by rollup operation doesn't match the number of cases shown in the **Cases** grid.
218
+
1. In the account rollup column definition, we specify the cases that have the Customer relationship with the account. After aggregation, the Total Number of Cases is equal to 1 (case C1). The case C2 isn't included in the total, as it's directly related to the contact, not to the account, and can't be explicitly defined in the account rollup column definition. As a result, the total number of cases returned by rollup operation doesn't match the number of cases shown in the **Cases** grid.
0 commit comments