ReOrc docs
Get ReOrc
English
English
  • About ReOrc
  • Set up and deployment
    • Set up organization
    • Install ReOrc agent
  • Getting started
    • 1. Set up a connection
      • BigQuery setup
    • 2. Create a project
    • 3. Create data models
    • 4. Build models in console
    • 5. Set up a pipeline
  • Connections
    • Destinations
      • Google Service Account
    • Integrations
      • Slack
  • Data modeling
    • Overview
    • Sources
    • Models
      • Model schema
      • Model configurations
    • Jinja templating
      • Variables
      • Macros
    • Materialization
    • Data lineage
    • Data tests
      • Built-in generic tests
      • Custom generic tests
      • Singular tests
  • Semantic modeling
    • Overview
    • Data Modelling vs Semantic Layer
    • Cube
      • Custom Dimension
      • Custom Measure
        • Aggregation Function
        • SQL functions and operators
        • Calculating Period-over-Period Changes
      • Relationship
    • View
      • Primary Dimension
      • Add Shared Fields
    • Shared Fields
    • Integration
      • Guandata Integration
      • Looker Studio
  • Pipeline
    • Overview
    • Modeling pipeline
    • Advanced pipeline
    • Job
  • Health tracking
    • Pipeline health
    • Data quality
  • Data governance
    • Data protection
  • Asset management
    • Console
    • Metadata
    • Version history
    • Packages and dependencies
  • DATA SERVICE
    • Overview
    • Create & edit Data Service
    • Data preview & download
    • Data sharing API
    • Access control
  • AI-powered
    • Rein AI Copilot
  • Settings
    • Organization settings
    • Project settings
    • Profile settings
    • Roles and permissions
  • Platform Specific
    • Doris/SelectDB
Powered by GitBook
On this page
  • Supported Aggregation Functions
  • Usage in Measures
  1. Semantic modeling
  2. Cube
  3. Custom Measure

Aggregation Function

Aggregation functions are essential for summarizing data in meaningful ways when creating a measure. These functions operate on a set of values and return a single summarized result.

Supported Aggregation Functions

ReOrc supports the following aggregation functions:

1. SUM

Calculates the total sum of a numeric field.

Example:

SUM(revenue)

Returns the total revenue across all records.

2. COUNT

Counts the number of records.

Example:

COUNT(order_id)

Returns the total number of orders.

3. COUNT DISTINCT

Counts the number of unique values in a field.

Example:

COUNT_DISTINCT(customer_id)

Returns the number of unique customers.

4. AVG

Computes the average value of a numeric field.

Example:

AVG(order_amount)

Returns the average order amount.

5. MIN

Finds the smallest value in a field.

Example:

MIN(price)

Returns the lowest product price.

6. MAX

Finds the largest value in a field.

Example:

MAX(price)

Returns the highest product price.

7. CUSTOM

Allows users to define their own aggregation logic using formulas.

Example:

SUM(revenue) / COUNT(order_id)

Calculates the average revenue per order.

Usage in Measures

When defining a measure, an aggregation function must be specified to determine how the data should be summarized. Below is an example of how an aggregation function is used to define a measure:

measures:
  - name: total_revenue
    label: "Total Revenue"
    type: number
    aggregation: SUM
    expression: "SUM(revenue)"

This measure calculates the total revenue by summing up all revenue values.

PreviousCustom MeasureNextSQL functions and operators

Last updated 15 days ago