> 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.

# Example representation: Data model with a date range control

> Example Sigma code representation of a data model with a date range control.

This is an example representation of a data model, created using the [get a data model representation](/reference/getdatamodelspec) endpoint. Representations like this one can be used to create a data model from code using the [create a data model from a representation](/reference/createdatamodelspec) endpoint. Each page in this example library includes the code representation of the data model and step-by-step instructions to create it in the Sigma UI.

Consult this example and others in the [Data model representation example library](/docs/data-model-representation-example-library) to:

* Troubleshoot the formatting of a particular feature in code representation
* Relate a feature from the Sigma UI to its representation in code
* Provide context to AI tools used to create data models from code

This example representation cannot be used as-is. All identifying details, such as IDs, names, and URLs, have been replaced with randomized ID values or generic substitutions. The format of these contents, like the length of ID values, is preserved for demonstrative purposes. However, this representation cannot be directly used without modification to the base URL, connection details, and more. For more information, see [Create and manage data models from code](/docs/manage-data-models-as-code).

## System and user requirements

To complete the steps in this example, you must meet the user requirements listed below for creating the data model in the UI and creating it from code.

The ability to create this data model in the Sigma UI requires the following:

* You must be assigned an [account type](/docs/account-type-and-license-overview) with the **Create, edit, and publish data models** permissions enabled.
* You must have access to a connection to a data platform.

The ability to create a data model from code requires the following:

* You must be assigned the **Admin** [account type](/docs/account-type-and-license-overview).
* You must have developer credentials for the Sigma API. For more information, see [Get started with the Sigma REST API](/reference/get-started-sigma-api).

This example uses a table from the [Sigma Sample Connection](/docs/sigmas-sample-connection). Your organization might have disabled access to the Sigma sample connection. If so, you can contact an admin to enable it, or use a table from another connection to follow along with this example.

## Create the example data model in the Sigma UI

This example shows a simple data model with a single table element, sourced from a warehouse table, and a date range control.

To create this data model in the Sigma UI:

1. Go to the **Home** page.

2. Select <img src="https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/button-add.svg" alt="" /> **Create New** > **Data model**.

   A new data model opens.

3. From the **Add element** bar, select **Data** > **Table**.

4. In the **Select source** modal, search for the table `PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA` in the `EXAMPLES.PLUGS_ELECTRONICS` schema.

5. Select the table to add it to the data model.

   The table appears in the data model.

6. Select the table element.

7. Select <img src="https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/filter.svg" alt="" /> **Filters** > <img src="https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/add.svg" alt="" /> **Add filter...**.

8. In the **Select column** modal, select the *Date* column.

9. Select **Filter options** > **Convert to page control**.

   A date range control appears above the table.

10. Select the date range control.

11. Set the control to filter for rows with a *Date* value **Between** the dates `01/01/2026` and `01/15/2026`.

12. Select **Publish**.

## Get a JSON representation of this data model

To get a JSON representation of this data model, follow the steps in [Get the code representation of a data model](/docs/get-the-code-representation-of-a-data-model).

The JSON representation of this data model appears like the following:

#### JSON representation

```json
{
  "dataModelId": "982fff5e-1fdf-49c5-affc-8da408e7412c",
  "name": "date-range-control",
  "url": "https://aws-api.sigmacomputing.com/org-name/data-model/date-range-control-me2J1rfJYgXgVHZ6QjKttA",
  "documentVersion": 2,
  "latestDocumentVersion": 2,
  "ownerId": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
  "folderId": "fcb10706-125c-4a83-83d1-2977c8d963a0",
  "createdBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
  "updatedBy": "fOsrWKBxSMe8HqLmT0nXESkGLpkIc",
  "createdAt": "2026-01-15T20:26:17.946Z",
  "updatedAt": "2026-01-22T17:58:53.339Z",
  "schemaVersion": 1,
  "pages": [
    {
      "id": "WzzXxAUsbt",
      "name": "Page 1",
      "elements": [
        {
          "kind": "control",
          "controlId": "Date",
          "id": "s83EKeGBXFpF9",
          "filters": [
            {
              "source": {
                "kind": "table",
                "elementId": "AXzaeEv0gK"
              },
              "columnId": "inode-5FCsrDpnzcdw5YYJRBbY6l/DATE"
            }
          ],
          "controlType": "date-range",
          "mode": "between",
          "startDate": "2026-01-01T07:00:00Z",
          "endDate": "2026-01-16T06:59:59Z",
          "includeNulls": "when-no-value-is-selected"
        },
        {
          "id": "AXzaeEv0gK",
          "kind": "table",
          "source": {
            "connectionId": "9ad28df9-5f5f-4bae-8985-bb12d25829de",
            "kind": "warehouse-table",
            "path": [
              "EXAMPLES",
              "PLUGS_ELECTRONICS",
              "PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA"
            ]
          },
          "columns": [
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/ORDER_NUMBER",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Order Number]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/DATE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Date]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/SKU_NUMBER",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Sku Number]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/QUANTITY",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Quantity]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/COST",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Cost]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/PRICE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Price]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_TYPE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Product Type]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_FAMILY",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Product Family]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_LINE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Product Line]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/BRAND",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Brand]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_NAME",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Product Name]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_NAME",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Name]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_KEY",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Key]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_REGION",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Region]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_STATE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store State]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_CITY",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store City]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_ZIP_CODE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Zip Code]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_LATITUDE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Latitude]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/STORE_LONGITUDE",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Store Longitude]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/CUST_KEY",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Cust Key]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/CUSTOMER_NAME",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Customer Name]"
            },
            {
              "id": "inode-4exq8bsACBpDyQUvKGGTO0/CUST_JSON",
              "formula": "[PLUGS_ELECTRONICS_HANDS_ON_LAB_DATA/Cust Json]"
            }
          ],
          "order": [
            "inode-4exq8bsACBpDyQUvKGGTO0/ORDER_NUMBER",
            "inode-4exq8bsACBpDyQUvKGGTO0/DATE",
            "inode-4exq8bsACBpDyQUvKGGTO0/SKU_NUMBER",
            "inode-4exq8bsACBpDyQUvKGGTO0/QUANTITY",
            "inode-4exq8bsACBpDyQUvKGGTO0/COST",
            "inode-4exq8bsACBpDyQUvKGGTO0/PRICE",
            "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_TYPE",
            "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_FAMILY",
            "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_LINE",
            "inode-4exq8bsACBpDyQUvKGGTO0/BRAND",
            "inode-4exq8bsACBpDyQUvKGGTO0/PRODUCT_NAME",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_NAME",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_KEY",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_REGION",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_STATE",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_CITY",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_ZIP_CODE",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_LATITUDE",
            "inode-4exq8bsACBpDyQUvKGGTO0/STORE_LONGITUDE",
            "inode-4exq8bsACBpDyQUvKGGTO0/CUST_KEY",
            "inode-4exq8bsACBpDyQUvKGGTO0/CUSTOMER_NAME",
            "inode-4exq8bsACBpDyQUvKGGTO0/CUST_JSON"
          ]
        }
      ]
    }
  ]
}
```

## Representing date range controls

In this representation, the date range control is represented by this object in the `elements` array of the table element:

#### Date range control representation

```json
...
{
  "kind": "control",
  "controlId": "Date",
  "id": "s83EKeGBXFpF9",
  "filters": [
    {
      "source": {
        "kind": "table",
        "elementId": "AXzaeEv0gK"
      },
      "columnId": "inode-5FCsrDpnzcdw5YYJRBbY6l/DATE"
    }
  ],
  "controlType": "date-range",
  "mode": "between",
  "startDate": "2026-01-01T07:00:00Z",
  "endDate": "2026-01-16T06:59:59Z",
  "includeNulls": "when-no-value-is-selected"
}
...
```