Skip to content

Commit ce41d27

Browse files
Live Publish (04/11/2025 06:30:00 PM)
2 parents 918babf + 820dcbb commit ce41d27

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

powerapps-docs/developer/data-platform/org-service/queryexpression/aggregate-data.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
---
22
title: Aggregate data using QueryExpression
33
description: Learn how to use QueryExpression to retrieve aggregated data from Microsoft Dataverse.
4-
ms.date: 05/12/2024
4+
ms.date: 04/11/2025
55
ms.reviewer: jdaly
66
ms.topic: how-to
7-
author: pnghub
7+
author: olegovanesyan
88
ms.subservice: dataverse-developer
9-
ms.author: gned
9+
ms.author: olegov
1010
search.audienceType:
1111
- developer
1212
contributors:
1313
- JimDaly
14+
- daryllabar
1415
---
1516
# Aggregate data using QueryExpression
1617

@@ -56,6 +57,7 @@ The types of aggregation you can do are members of the [XrmAggregateType enum](x
5657
Note the following points:
5758

5859
- Null values aren't considered when calculating aggregate values.
60+
- Aggregated data is returned as an [AliasedValue](xref:Microsoft.Xrm.Sdk.AliasedValue).
5961
- You can use data from tables joined using the [LinkEntity class](xref:Microsoft.Xrm.Sdk.Query.LinkEntity).
6062
- You can apply filters to limit the results as with any query.
6163

@@ -65,7 +67,7 @@ Let's say you have 10 account records with the following data:
6567

6668
|Number of Employees|Name|Address 1 City|Created On|
6769
|---------|---------|---------|---------|
68-
|NULL|Example Account|NULL|8/25/2023|
70+
|NULL|Example Account|NULL|8/27/2023|
6971
|1,500|Contoso Pharmaceuticals (sample)|Redmond|3/25/2023|
7072
|2,700|Fabrikam, Inc. (sample)|Lynnwood|3/25/2023|
7173
|2,900|Blue Yonder Airlines (sample)|Los Angeles|3/25/2023|
@@ -142,6 +144,8 @@ Group the results of an aggregate query by adding an [XrmAttributeExpression](xr
142144

143145
When grouping, you should specify a [QueryExpression.Orders](xref:Microsoft.Xrm.Sdk.Query.QueryExpression.Orders) with an [OrderExpression](xref:Microsoft.Xrm.Sdk.Query.OrderExpression) that has the [Alias property](xref:Microsoft.Xrm.Sdk.Query.OrderExpression.Alias) set to the alias of the group.
144146

147+
If a grouped by value is null, it doesn't appear in the results.
148+
145149

146150
For example the following query returns the sum of employees, and count by city:
147151

0 commit comments

Comments
 (0)