# AnalyticsFilter Interface

> AnalyticsFilter interface in the Node.js JavaScript API: A source-specific filter. Filters affect analytics only and never worksheet AutoFilter or cell values.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Interface
- **Path:** TX Sheet Control > API Reference > JavaScript API > Node.js Server > AnalyticsFilter Interface
- **1386 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/llms-full.txt

---

A source-specific filter. Filters affect analytics only and never worksheet AutoFilter or cell values.

Package: `@txtextcontrol/tx-sheet-control-server`. This is a settings/result contract, not a runtime constructor.

### Members

| Property | Description |
|---|---|
| [sourceId](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/sourceid-property/llms-full.txt) | Configures sourceId on AnalyticsFilter; apply the complete settings object through its owning dashboard. |
| [field](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/field-property/llms-full.txt) | Configures field on AnalyticsFilter; apply the complete settings object through its owning dashboard. |
| [operator](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/operator-property/llms-full.txt) | Configures operator on AnalyticsFilter; apply the complete settings object through its owning dashboard. |
| [values](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/values-property/llms-full.txt) | Configures values on AnalyticsFilter; apply the complete settings object through its owning dashboard. |
| [dateGranularity](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/dategranularity-property/llms-full.txt) | Calendar periods: YYYY-MM-DD, YYYY-MM, or YYYY. Use between for inclusive bounds, or in/notIn for selected/excluded periods. Serial, ISO and dotted day.month.year dates are compared in UTC, including all times in each period. Other operators must omit this setting. |

### Examples

Configure a complete sales dashboard using this contract. Pass the workbook from your existing editor or server control.

```javascript
async function configureSalesDashboard(book) {
    const sheet = book.sheets.at(0);
    sheet.range('A1:G5').setValues([
        ['Region', 'Country', 'Customer', 'Revenue', 'Profit', 'Date', 'Units'],
        ['Europe', 'Germany', 'Studio', 42000, 12000, '2026-01-15', 12],
        ['Europe', 'France', 'Labs', 38000, 9000, '2026-02-15', 15],
        ['Americas', 'Canada', 'Partners', 31000, 8000, '2026-01-15', 9],
        ['Americas', 'United States', 'Design', 49000, 15000, '2026-02-15', 18]
    ]);
    book.analytics.setSource({ id: 'sales', name: 'Sales', sheetId: sheet.id, range: 'A1:G5', hasHeaderRow: true });
    const dashboard = book.dashboards.add('Sales Performance');
    dashboard.update({ sections: [{ id: 'summary', title: 'Executive Summary' }] });
    dashboard.addWidget({
        id: 'revenue', type: 'column', title: 'Regional Revenue',
        placement: { x: 0, y: 0, width: 8, height: 6 },
        query: { sourceId: 'sales', dimensions: ['Region'], measures: [
            { field: 'Revenue', aggregation: 'SUM', alias: 'Revenue' },
            { field: 'Profit', aggregation: 'SUM', alias: 'Profit' }
        ] }
    });
    const settings = {
        "sourceId": "sales",
        "field": "Region",
        "operator": "equals",
        "values": [
            "Europe"
        ]
    };
    dashboard.setFilters([settings]);
    const { writeFile: saveDashboard } = await import('node:fs/promises');
    await saveDashboard('sales-dashboard.svg', await dashboard.renderSvg());
}
```

---

## In This Section

- [AnalyticsFilter.dateGranularity Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/dategranularity-property/llms-full.txt): AnalyticsFilter.dateGranularity property in the Node.js JavaScript API, with its type 'day' | 'month' | 'quarter' | 'year' and a JavaScript example.
- [AnalyticsFilter.field Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/field-property/llms-full.txt): AnalyticsFilter.field property in the TX Sheet Control JavaScript API for Node.js, with its type string and a JavaScript example.
- [AnalyticsFilter.operator Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/operator-property/llms-full.txt): AnalyticsFilter.operator property in the TX Sheet Control JavaScript API for Node.js, with its syntax and a JavaScript example.
- [AnalyticsFilter.sourceId Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/sourceid-property/llms-full.txt): AnalyticsFilter.sourceId property in the TX Sheet Control JavaScript API for Node.js, with its type string and a JavaScript example.
- [AnalyticsFilter.values Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/values-property/llms-full.txt): AnalyticsFilter.values property in the TX Sheet Control JavaScript API for Node.js, with its type AnalyticsValue[] and a JavaScript example.

---

## Nearby

- **Previous:** [Worksheet.pivotTables Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/worksheet/pivottables-property/llms-full.txt)
- **Next:** [AnalyticsFilter.sourceId Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/nodejs/analyticsfilter/sourceid-property/llms-full.txt)
