Use of aggregate, groupby in fetchxml query
In Microsoft Dataverse, FetchXML includes grouping and aggregation features that let you calculate sum, average min, max and count. groupby is used to get data from CRM and group it based on particular field value. To use group-by we need to use aggregate. e.g.; If we want to get group accounts based on country and we want count of those country in descending order then we will use fetchXML like below in c#. string accountNumber = "ANO10052023"; string fetchXML = @"<fetch aggregate='true' distinct='false' mapping='logical'> <entity name='account'> <attribute aggregate='countcolumn' alias='country_count' name='new_country'> <attribute alias='new_country' groupby='true' name='new_country'> <order alias='country_count' descending='true'/> <fi