User Guide Release Primo
Admin GuidesAiimiVersions
  • Introducing Aiimi Insight Engine
    • Primo Release
    • Versions
  • Search
    • Introduction
    • Searching for Information
      • Ways to Search
      • Avanced Searches
      • 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
      • Multilingual Search
    • Search Results
      • Lenses and Result Views
        • Timeline
        • 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
        • Document Preview
        • Mark As Useful
        • Mark As Sensitive
      • Why These Results
        • Find Searched Terms
        • Why My Search Matched
      • Subject Matter Experts
    • 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
      • Sharing a Collection
      • Adding Comments to a Collection
  • Subject Access Request
    • Introduction
    • Creating or Receiving New SARs
      • Requests From The Portal
        • Creating a SAR from the Portal
        • Assigning a Request
      • Create a Manual Response
        • Searches
        • Subject
        • Collection Settings
        • Privacy Portal
      • Create and Manage Data Subject Types
    • Data for a SAR
      • Finding Information for a SAR
        • Payment Card Information (PCI)
        • Personally Identifiable Information (PII)
        • Redacting Sensitive Information
      • Messaging a SAR Requestor
      • Internal SAR Messaging
    • Completing a SAR
      • Finding a SAR
      • Getting Data Reviewed
        • Assigning Users to a SAR
      • Exporting a SAR Response
      • Disclosing to the Portal
  • 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