> For the complete documentation index, see [llms.txt](https://doc.moost.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.moost.io/platform-manual/rules/rule-language/functions/quantile.md).

# QUANTILE

### Description

Calculates the quantile value on a set of numbers or event values, based on specified quantile.

Remark: to obtain the median value on an array, you can use the `QUANTILE` function with parameter `0.5` (i. e. the 50% quantile).

### QUANTILE(Vector\<Number/Event>, Scalar\<Number>)

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

#### 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><tr><td>quantile</td><td>Quantile of type &#x3C;Number>, with value range [0, 1]</td></tr></tbody></table>

#### Returns

Returns the quantile value as Scalar\<Number>

***

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

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

#### 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><tr><td>quantile</td><td>Quantile of type &#x3C;Number>, with value range [0, 1]</td></tr></tbody></table>

#### Returns

Returns the quantile value as Scalar\<Number>

***

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

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

#### 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><tr><td>quantile</td><td>Quantile of type &#x3C;Number>, with value range [0, 1]</td></tr></tbody></table>

#### Returns

Returns the quantile value as GroupedScalar\<any, Number>

***

### Examples

Retrieve the 50% percentile of the GridPowerConsumption time series.

```java
QUANTILE($GridPowerConsumption, 0.5)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/quantile.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.
