# MAX

The MAX function returns the largest number in a set of values. Node references are also accepted as arguments.

### Syntax

MAX(value1, ...valueN?) - > number

### Arguments

<table><thead><tr><th width="134">Arguments</th><th width="144">Data type</th><th width="448">Description</th></tr></thead><tbody><tr><td>value1</td><td>Number, Node reference</td><td>The nodes or numbers for which you want to evaluate the largest value.</td></tr><tr><td>...valueN?</td><td>Number, Node Reference</td><td>Additional nodes or numbers for which you want to evaluate the largest value. This is an optional argument.</td></tr></tbody></table>

### Example&#x20;

Consider the below example with a node that has the demand for a particular product for 12 months.

<figure><img src="/files/dpFswDRfJ98QroWMqV1g" alt=""><figcaption></figcaption></figure>

To calculate the maximum demand, the following formula should be written in the \[Maximum demand] node:

<mark style="color:blue;">**`MAX`**</mark>**`(`**<mark style="color:purple;">**`[Demand]`**</mark>**`.`**<mark style="color:blue;">**`ALL_PERIODS`**</mark>**`)`**

We are including [**.ALL\_PERIODS**](https://docs.valq.com/model/formula-functions/math-functions/pages/bd9R41FrVkmuCJPGQLmc#node-.all_periods) so that it will consider all the period values rather than one single period.

### Result

| **Maximum Demand** | 319 |
| ------------------ | --- |


---

# 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://docs.valq.com/model/formula-functions/math-functions/max.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.
