---
agentTools:
  projectIndex: https://docs.siffletdata.com/llms.txt
---

# Advanced Flexibility for Metrics and Custom Conditions Monitors

We’ve introduced two major enhancements to our custom monitoring capabilities, giving you granular control over how you aggregate metrics and define row-level failure conditions using SQL.

### What’s New?

* **Custom Aggregation for Metrics Monitors**: You are no longer limited to built-in functions like SUM or AVG. You can now write custom SQL aggregations to calculate unique numerical values, such as MEDIAN() or complex ratios across joined datasets (e.g., SUM(datasetA:field1) / SUM(datasetB:field2)).

<Image align="center" border={false} src="https://files.readme.io/c9a8a66a281b928fc923d66aca949279d3858817f9301b69aed874b13a1a0d4f-image.png" />

* **SQL Condition Custom Monitor:** For complex logic that goes beyond our No-Code Condition builder, the new SQL Condition monitor allows you to define failure criteria using a SQL boolean expression. If a row evaluates to TRUE, an anomaly is triggered.

  Unlike the SQL Query Custom monitor, this monitor benefits from the same features as the other monitor types : Time Settings, Where Clause, Group By,...

<Image border={false} src="https://files.readme.io/3e4329b6da3f810863e68d8ba33144951860986fb0696cd2c499f7a600743bff-image.png" />

### ℹ️ Key Technical Notes:

**Field Formatting:** To reference fields in these SQL editors, use the format datasetId:fieldName.

**UI Autocomplete:** Simply start typing your table or field name in the editor, and Sifflet will automatically suggest the correctly formatted ID for you.

**Scope**: Queries must be performed on the datasets already selected in your join clause; querying external tables within the SQL snippet is not supported.

Version:v608

<br />