---
schema_version: "1"
id: 3af009fdf1c2764807304954bf523dc5a161e045f05472fbde56dfa0a0683c10
title: ProjectionNode Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_wave_ProjectionNode.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 75929824dc3cc1e273691fb505845e27b4c08dbe635df75887e873716d5d6f6a
description: Add aggregate functions to the query, or define an alias.Returns the sum of a numeric field.Returns the average value of a numeric field.Returns the minimum value of a field.Returns the maximum value of a field.Returns the number of rows that match the query criteria.Returns the count of unique values.Define output column names.
---
# ProjectionNode Class

Add aggregate functions to the query, or define an alias.

## Namespace

[wave](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_wave.htm#apex_namespace_wave "The classes in the Wave namespace are part of the CRM Analytics Analytics SDK, designed to facilitate querying CRM Analytics data from Apex code.")

## Usage

Refer to the QueryBuilder example.

- **[ProjectionNode Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_methods)**

## ProjectionNode Methods

The following are methods for ProjectionNode.

- **[sum()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_sum)**  
    Returns the sum of a numeric field.
- **[avg()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_avg)**  
    Returns the average value of a numeric field.
- **[min()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_min)**  
    Returns the minimum value of a field.
- **[max()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_max)**  
    Returns the maximum value of a field.
- **[count()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_count)**  
    Returns the number of rows that match the query criteria.
- **[unique()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_unique)**  
    Returns the count of unique values.
- **[alias(name)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_wave_ProjectionNode.htm#apex_wave_ProjectionNode_alias)**  
    Define output column names.

### sum()

Returns the sum of a numeric field.

#### Signature

public wave.ProjectionNode sum()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### avg()

Returns the average value of a numeric field.

#### Signature

public wave.ProjectionNode avg()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### min()

Returns the minimum value of a field.

#### Signature

public wave.ProjectionNode min()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### max()

Returns the maximum value of a field.

#### Signature

public wave.ProjectionNode max()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### count()

Returns the number of rows that match the query criteria.

#### Signature

public wave.ProjectionNode count()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### unique()

Returns the count of unique values.

#### Signature

public wave.ProjectionNode unique()

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")

### alias(name)

Define output column names.

#### Signature

public wave.ProjectionNode alias(String name)

#### Parameters

- **name**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The name to use for this column. For example, this code defines the alias c:
    
    Wave.ProjectionNode\[\] projs = new Wave.ProjectionNode\[\]{Wave.QueryBuilder.count().alias('c')};

#### Return Value

Type: [wave.ProjectionNode](#apex_class_wave_ProjectionNode "Add aggregate functions to the query, or define an alias.")