# AVG

### Description

Calculates the average on a set of numbers or event values

### AVG(Vector\<Number/Event>)

```java
AVG(vector: Vector<Number/Event>): Scalar<Number>
```

Calculate the average as Scalar\<any> from the given parameter.

#### Parameters

<table><thead><tr><th width="172">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>vector</td><td>A vector of type &#x3C;Number/Event></td></tr></tbody></table>

#### Returns

Returns the average as Scalar\<Number>

***

### AVG(GroupedScalar\<any, Number/Event>)

```java
AVG(group: GroupedScalar<any, Number/Event>): Scalar<Number>
```

Calculate the average as Scalar\<any> from the given parameter.

#### Parameters

<table><thead><tr><th width="172">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>group</td><td>A GroupedScalar of type &#x3C;any, Number/Event></td></tr></tbody></table>

#### Returns

Returns the average as Scalar\<Number>

***

### AVG(GroupedVector\<any, Number/Event>)

```java
AVG(group: GroupedVector<any, Number/Event>): GroupedScalar<Number>
```

Calculate the average as GroupedScalar\<any> from the given parameter.

#### Parameters

<table><thead><tr><th width="219">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>group</td><td>A GroupedVector of type &#x3C;any, Number/Event></td></tr></tbody></table>

#### Returns

Returns the average as Scalar\<Number>

***

### Examples

Retrieve the average of the GridPowerConsumption time series.

```java
AVG($GridPowerConsumption)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.moost.io/platform-manual/rules/rule-language/functions/avg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
