# Defining Column Filters

Canonical page: https://www.adaptabletools.com/docs/handbook-column-filter-defining

- Column Filters are defined inside a Layout
- They can be defined in both Table and Pivot Layouts

Column Filters can be provided at design-time in given Layouts via [Layout Initial State](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md).

Each Column Filter is an AdapTableQL Expression - from a simple comparison to a function-based rule.

- See [Defining Table Layouts](https://www.adaptabletools.com/docs/handbook-layouts-table/index.md) for details on defining Column Filters in Layouts
- The [AdapTableQL Expression Guide](https://www.adaptabletools.com/docs/adaptable-ql-expression/index.md) covers the functions and syntax available for writing Filter Expressions

### Defining Columns Filters in a Layout

Column Filters are provided in a Layout as follows:

Create a `ColumnFilters` property inside a Layout

This is an array with one item for each Column Filter to be provided

Supply the `ColumnId` for each Filter.

Create an `Expression` for each Filter.

This is an [AdapTableQL Expression](https://www.adaptabletools.com/docs/adaptable-ql-expression/index.md) boolean expression evaluated for each row.

It can be anything from a simple comparison to a function-based rule (e.g. a date comparison).

```ts [[1, 12, "ColumnFilters"],[2, 14, "ColumnId"],[2, 18, "ColumnId"],[2, 22, "ColumnId"], [3, 15, "Expression"],[3, 19, "Expression"],[3, 23, "Expression"]]
// Provide 3 Column Filters
// a. IN on currency Column for 'USD' and 'EUR'
// b. Greater than on price Column
// c. Date comparison on orderDate Column
const initialState: InitialState = {
  Layout: {
    CurrentLayout: 'Filtered Layout',
    Layouts: [
      {
        Name: 'Filtered Layout',
        TableColumns: ['currency', 'orderDate', 'github_watchers', 'price'],
        ColumnFilters: [
          {
            ColumnId: 'currency',
            Expression: '[currency] IN ("USD", "EUR")',
          },
          {
            ColumnId: 'price',
            Expression: '[price] > 500',
          },
          {
            ColumnId: 'orderDate',
            Expression: '[orderDate] > DATE("2019-09-21")',
          },
        ],
      },
    ],
  },
};
```
