> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# MovingStddev

> The MovingStddev finds the standard deviation of a column within a moving window.

The **MovingStddev** finds the standard deviation of a column within a moving window.

## Syntax

```
MovingStddev(column, above, [below])
```

Function Arguments:

* **column** (required) - The column to be searched.
* **above** (required) - The first row to include, counting backward from the current row.
* **below** (optional) - The last row to include, counting forward from the current row. Defaults to 0 (current row will be the last row included).

When using this function without a sort enforced, there can be unexpected results. In order to ensure that the values are stable, verify that there is a sorted column within the table.

## Example

A table lists the weekly sales for the past year. The table is sorted ascending by the week. The **MovingStddev** function can be utilized in order to find the maximum value within specific windows.

```
MovingStddev([Weekly Sales], 4)
```

With \[Weekly Sales] as the **column** argument and 4 as the **above** argument, the standard deviation of the weekly sales is calculated for each week along with the four previous weeks. Since the **below** argument is not specified, it defaults to 0.  

![A table with Week of Date, Weekly Sales, and Moving Standard Deviation columns, highlighting the week of 2022-09-11 and the four previous weeks of sales that produce a moving standard deviation of 93,865.27 for that week.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/97d91a6365196bcc81d706b3163f58330a13460949a5929a904e1616a1bdf4c2/assets/docs-images/4d6cc13-1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260727%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260727T111834Z&X-Amz-Expires=604800&X-Amz-Signature=93ec594ff0b044ba562e6515c4d61093b95b1d84456c4ea64654cd0deb46fa00&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

```
MovingStddev([Weekly Sales], 0, 4)
```

Here, the **above** argument is 0, so no previous weeks are included in the standard deviation calculation. The **below** average is 4, so the standard deviation of the weekly sales is computed for each week along with the next 4 weeks.

![A table with Week of Date, Weekly Sales, and Moving Standard Deviation columns, highlighting the week of 2022-08-14 and the next four weeks of sales that produce a moving standard deviation of 93,865.27 for that week.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/eb3210fc46e79229197a34dbc0de9529880dacac67374bf04622eef4566f47c5/assets/docs-images/c395f9e-2.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260727%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260727T111834Z&X-Amz-Expires=604800&X-Amz-Signature=4d9c49ca4b26f1f1296021b93512502ff04e81053245377bc9d136dc2e4ab840&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

```
MovingStddev([Weekly Sales], 2, 2)
```

Here, the **above** argument is 2, so the previous two weeks are included in the standard deviation calculation. In addition, the **below** argument is 2, so the following two weeks are included as well.

![A table with Week of Date, Weekly Sales, and Moving Standard Deviation columns, highlighting the two weeks before and after 2022-08-28 that produce a moving standard deviation of 93,865.27 for that week.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/39c7a74906adda8df958b9f3a849d899ffb5161d884aa25ac5eabd3ed37d9e6e/assets/docs-images/e7f18d0-3.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260727%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260727T111834Z&X-Amz-Expires=604800&X-Amz-Signature=81bfc808cd0c96571830b7329fb0838861915d103af2c83e82da3b5483c8c579&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

```
MovingStddev([Weekly Sales], 8, -4)
```

Here is an example where the **below** parameter is negative. The **below** parameter can be negative as long as the value is less than that of the **above** parameter. In this example, each window begins 8 weeks before the current week and ends 4 weeks before the current week, inclusive.

![A table with Week of Date, Weekly Sales, and Moving Standard Deviation columns, highlighting the window from eight to four weeks before 2022-10-09 that produces a moving standard deviation of 93,865.27 for that week.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/e071b597d28f7a806bb6d328c35d49a18dcbf54d1a28ca2ca6c5cee60f1666e5/assets/docs-images/48f640d-4.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260727%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260727T111834Z&X-Amz-Expires=604800&X-Amz-Signature=fe61c0556033b217bd85759a7bb32a9cd0e1750b4305b4b408150aba683204ec&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

## Related resources

* [CumulativeStdDev](/docs/cumulativestddev)
* [StdDev](/docs/stddev)