User Guide Española
Admin GuidesVersionsAiimi
  • Introducing Aiimi Insight Engine
    • Española Release
    • Versions
  • Search
    • Searching for Information
      • Advanced Searches
      • Search Focus
      • Folder Browsing
    • Saved Searches
      • Saving a Search Query
      • Accessing Saved Searches
      • Bulk Search
        • Use Cases
        • Create a Bulk Search
          • Search Details
          • Map Fields
          • Review Search
          • Notifications
        • Bulk Search Template
    • Search Results
      • Lenses and Result Views
        • Map Lens
        • Timeline Lens
        • Relationship
          • Finding Result Connections
          • Minimum Results
          • Relationship Type
          • Accessible Relationship Map
        • Related Result Connections
          • Understand Connections
          • Adding card details
          • Explore More Connections
      • Filtering Results
        • Using Minimum Matching Terms
        • Using Synonyms
      • Sorting Results
      • Quick Actions
      • Why These Results
        • Find Searched Terms
        • Why My Search Matched
      • Related Results
      • Watermarking
    • Item Classification
      • Editing a Classification
    • AI Helper
    • Item Previews
      • Inline Preview
      • Full Screen Preview
  • Collections
    • What is a Collection?
      • Collection Types
    • Manage Collections
      • Create a Collection
      • Status Management
      • Edit, Delete or Merge
    • Using a Collection
      • Add Items to a Collection
      • Import Items to a Collection
      • Sharing a Collection
      • Adding Comments to a Collection
      • Redacting Collection Information
      • Exporting a Collection
  • Subject Access Request
    • Subject Access Requests
    • Create or Receive Data Requests
      • Create a Request From The Portal
      • Assigning a Request
      • Create a Manual Request
      • Create and Manage Data Subject Types
    • Finding a Request
    • Items for a Request
      • Redacting Sensitive Information
      • Getting Items Reviewed
    • Completing a Request
    • Assigning Users to a SAR
    • Message the Requestor
    • Internal Messaging
  • Profile
    • Profile Pictures
  • Help and Support
    • Leaving Feedback
    • Accessibility Statement for Aiimi Insight Engine
  • Advanced Applications
    • Metrics
    • Manage Collection Type
      • Create a Collection Type
    • Using The Manage Chart
    • OData API
      • Set Access
      • Aggregating Results
      • Query Parameters
Powered by GitBook
On this page
  • Aggregate a Single Property
  • Group By Aggregations
  • Value aggregations on Grouped Buckets.
  1. Advanced Applications
  2. OData API

Aggregating Results

You can request data aggregations through your OData API query. This groups data and performs functions to summarise specific fields. The aggregated data can then be used for statical analysis. or as a summary.

Aggregations are performed using the query parameter $apply. This parameter can be added as part of the query parameter.

apiUrl/odata/entitySetName?username=username&api-key=key&$apply= ...

Aggregate a Single Property

$count - Returns the total number of results for a query.

$apply=aggregate($count as TotalResults)

Non Array Type Aggregation Functions

Max - Returns the highest value from your results. Numeric fields only.

$apply=aggregate(Rating with max as MaxRating)

Min - Returns the lowest value from your results Numeric fields only.

$apply=aggregate(Rating with min as MinRating)

Sum - Adds together all the values of a field. Numeric fields only.

$apply=aggregate(OrdersValue with sum as TotalOrdersValue)

Average - Returns the mean of all the values. Numeric fields only.

$apply=aggregate(OrderValue with average as AverageOrderValue)

countdistinct - Returns the total number of unique results for a field. $apply=aggregate(OrderNumber with countdistinct as TotalUniqueOrders)

Combine aggregations - Combine aggregations in 1 query using commas to separate them. $apply=aggregate(Rating with max as MaxAge, PersonAge with average as AverageAge)


Group By Aggregations

GroupBy - Group the results of a field and return the unique values as buckets. When grouping you must use double brackets.

$apply=groupby((OrderNumber))

It is possible to group by multiple properties and this will return buckets for each distinct combination of values. These are separated by commas:

Combined GroupBy Group the results of 2 fields and return the unique values as buckets. Each field must be separated by commas. When grouping you must use double brackets.

 $apply=groupby((OrderNumber,Customer))

Value aggregations on Grouped Buckets.

You can combine groupby and aggregate functions to perform aggregations on each bucket.

$apply=groupby((CustomerNumber), aggregate(OrderValue with average as AverageOrderValue))

This will return a bucket per unique value in CustomerNumber and the average order value for each as AverageOrderValue.

PreviousSet AccessNextQuery Parameters