> ## Documentation Index
> Fetch the complete documentation index at: https://docs.equals.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Date filters

## Enable date filters for Dashboards

For a smooth experience filtering your dashboard filter on date fields, Equals provides dedicated formulas to build summary tables and charts which automatically adjust to the filter period, breaking down your data by year, month, week, or day depending on the date range.

To build a summary table that dynamically adjusts as date fields are filtered, drive its date headers with `FLEXHEADERS` and its body with `FLEXMATCH`. Tables built this way are called **flex tables**.

#### 1. Use `FLEXHEADERS` for your date headers

Put `FLEXHEADERS` in the first cell of your header row. It reads a date column and spills out period-start dates across the row (or column, if the vertical direction is specified).

`=FLEXHEADERS(date_column, granularity, [num_periods], [start_date], [include_partial], [direction])`

Examples:

`=FLEXHEADERS(Sales!$A:$A, "month", 12)               // last 12 months`

`=FLEXHEADERS(Signups!$A:$A, "week")                  // every week in the dataset`

`=FLEXHEADERS(Sales!$A:$A, "month", 6, , FALSE)       // last 6 completed months (drops the in-progress one)`

`=FLEXHEADERS(Sales!$A:$A, "day", 30, "2025-01-01")   // 30 days starting Jan 1`

`=FLEXHEADERS(Sales!$A:$A, "day",365,,,"vertical") // The last 365 days in the data, laid out vertically.`

granularity is one of "day", "week", "month", "year".

#### The range moves with the data

`FLEXHEADERS` is anchored to the data, not to a fixed window. As new rows arrive and time passes, the header row shifts forward — a "last 12 months" table always shows the 12 months ending at the most recent date in the column, without you editing anything.

Pass `include_partial=FALSE` when you want to exclude the in-progress current period (e.g. "last 6 completed months" run mid-April returns Oct–Mar, dropping April).

#### 2. Use `FLEXMATCH` in the body formulas

In the body cells of your table, use `FLEXMATCH(header_ref)` inside `SUMIFS` / `COUNTIFS` / `AVERAGEIFS` in place of the usual `">="&B$1, "<"&EDATE(B$1,1)` pair.

`=SUMIFS(Sales!$C:$C, Sales!$A:$A, FLEXMATCH(B$1), Sales!$B:$B, $A2)`

`FLEXMATCH` automatically tracks whatever granularity `FLEXHEADERS` is currently rendering — day, week, month, or year — so the same template keeps working when the granularity changes.

You only need to enter the template in one cell per row (or the top-left cell of the body, if both of your header axes are generated by a formula as shown below). The table tracks the body template and fills the rest of the table for you.

#### 3. Tables will automatically update

Once a summary table is backed by `FLEXHEADERS` + `FLEXMATCH`, you get a few things for free:

* **It grows and shrinks automatically.** As the underlying data expands, the table adds columns; as it contracts (or is filtered), columns fall away. The formulas in the body re-evaluate on every change, and other content in the sheet will be moved to accommodate the new table size.
* **Formulas that point into the table keep working.** References to cells inside the table follow rows and columns as the table reflows, so downstream formulas don't break.
* **Charts follow the table.** A chart built from a flex table's range updates its series automatically as the table resizes — no need to re-select ranges after a filter is applied or new data arrives.

#### 4. Add your date filters

Date filters will be enabled for all dashboards on your workbook as soon as a table backed by `FLEXHEADERS` is created.

When viewing the dashboard in View Mode, when a viewer picks a date range:

* The flex table re-evaluates against the filtered data.
* `FLEXHEADERS` recomputes its header row and will “zoom in” or “zoom out” where appropriate — e.g. a monthly table filtered down to a single month will flex to daily values.
* The rest of the summary table, as well as any charts built on it, will adjust automatically. These changes are only for the viewer that filtered the data; the workbook will return to its original state when it is opened without a filter.

If your dashboard includes a summary table or chart that doesn't use `FLEXHEADERS`, the underlying data is still filtered — but the table's header range stays static,so time periods where data has been filtered out will show zeros. Swap the static headers for `FLEXHEADERS` to make the table fully responsive.
