Aggregates

Article author
Ryan
  • Updated

Please Note - This article is archived. Please refer to Report Query Builder - Report on Invoices using Aggregates – Meddbase Help Center.

You will notice that for the alias we have created a drop-down box labelled ‘Aggregate’ is available in the ‘Details’ section. This box is an option for all one-to-many columns and defines which data from a dataset is displayed. The options immediately available to you are as follows: 

  • Count - Provides a count of the dataset, for example, if our patient had seen three clinicians this would return the value ‘3’.
  • Default - Returns the first entry in the dataset, if there is no entry in this set it will return the ‘default’ value for this data type (For example, if the data were a number it would return 0, if boolean (True/False) it would return FALSE)
  • First - Returns the first entry in the dataset, if the patient had seen three separate clinicians the query would return the first clinician the patient was seen by.
  • Max - Returns the highest number in a dataset, only valid for number type datasets.
  • Min - Returns the lowest number in a dataset, only valid for number type datasets.
  • Last - Returns the last entry in the dataset, if the patient had seen three separate clinicians the query would return the most recent clinician.
  • Sum - Returns the sum of all values within a dataset, only valid for number type datasets.

 There is a further aggregate that must be activated manually by clicking on the ‘Advanced Settings’ button on the top bar. You will be given the option to activate the ‘combine’ aggregate. This is an intensive action and as such will cause the query to run much more slowly. 

  • Combine - Returns all values within the dataset as a comma separated list, if the patient had seen three separate clinicians the query would return the value “Clinician 1, Clinician 2, Clinician 3”