[Yandex Cloud documentation](../../index.md) > [Yandex DataLens](../index.md) > Charts > [Visualization reference](index.md) > Table

# Table ![](../../_assets/datalens/table-chart.svg) in Yandex DataLens

A table is a standard form of presenting data with the maximum level of detail. 

### What you need to know {#what-to-know}

It stores data as a two-dimensional array that consists of columns and rows. Table column headers show dimension or measure names, while cells contain their values. Each row is a set of cells with each column's value. A table may also contain a row with results.

{% note tip %}

It is best to place tables at the end of a dashboard.

Graphics are easier to "read", whereas delving into tabular data requires more time and attention.

{% endnote %}

Tables are most suitable for detailed analytics (a deep dive into figures) and problem detection.

A table is a good choice for quantitative comparison, where you can see different values of multiple categories or dimensions. The table below shows three different measures by three categories.

{% list tabs %}

- Visualization

  ![table-chart](../../_assets/datalens/visualization-ref/table-chart/table-chart.png =800x)

- Source table

  Categories |	Subcategories |	Delivery type |	Sales |	Number of customers |	Number of orders
  ---------|---------|---------|---------|---------|---------				
  Household cleaners |	Detergents |	Delivery |	597,729 |	250 |	256
  Household cleaners |	Detergents |	Pickup |	1,352,690 |	521 |	550
  Household cleaners |	Cleaners |	Delivery |	541,911 |	225 |	230
  Household cleaners |	Cleaners |	Pickup |	1,348,868 |	493 |	518
  Household goods |	Beauty and health products |	Delivery |	263,891 |	132 |	134
  Household goods |	Beauty and health products |	Pickup |	706,423 |	321 |	333
  Household goods |	Kitchen products |	Delivery |	671,566 |	165 |	167
  Household goods |	Kitchen products |	Pickup |	1,283,731 |	289 |	297
  Household goods |	Non-essential goods |	Delivery |	701,818 |	210 |	213
  Household goods |	Non-essential goods |	Pickup |	1,521,937 |	447 |	475
  Home appliances |	Kitchenware |	Delivery |	829,157 |	213 |	218
  Home appliances |	Kitchenware |	Pickup |	2,048,211 |	482 |	513
  Home appliances |	Health and beauty equipment |	Delivery |	944,770 |	255 |	258
  Home appliances |	Health and beauty equipment |	Pickup |	2,387,410 |	550 |	581

{% endlist %}

* [What you need to know](#what-to-know)
* [Wizard sections](#wizard-sections)
* [How to create a table](#create-diagram)
* [Additional settings](#additional-settings)

## Wizard sections {#wizard-sections}

Wizard<br/> section| Description
----- | ----
Columns | Dimensions and measures that will be used as columns. The field name appears in the column header. You can use [markup functions](../function-ref/markup-functions.md) in columns.
Colors | Measure. Affects color fill of all cells within a row. It may only contain one measure.
Sorting | Dimensions and measures specified in the **Columns** section.<br/>You can use multiple dimensions and measures.<br/>The order of section fields affects the sorting order of table fields. The sorting direction is marked with an icon next to the field: ![image](../../_assets/console-icons/bars-ascending-align-left.svg) for ascending or ![image](../../_assets/console-icons/bars-descending-align-left.svg) for descending. To change the sorting direction, click the icon.
Filters | Dimension or measure. Used as a filter.

## How to create a table {#create-diagram}

To create a table:


{% note warning %}

If you use the new DataLens object model with [workbooks and collections](../workbooks-collections/index.md):


1. Go to the DataLens [home page](https://datalens.ru/?skipPromo=true). In the left-hand panel, select ![collections](../../_assets/console-icons/rectangles-4.svg) **Collections and workbooks**.


1. Open the workbook, click **Create** in the top-right corner, and select the object you need.

Follow the guide from step 4.

{% endnote %}


1. Go to the DataLens [home page](https://datalens.ru/?skipPromo=true).
1. In the left-hand panel, select ![chart](../../_assets/console-icons/chart-column.svg) **Charts**.
1. Click **Create chart** → **Chart**.
1. At the top left, click ![image](../../_assets/console-icons/circles-intersection.svg) **Select dataset** and specify the dataset to visualize. If you do not have a dataset, [create one](../dataset/create-dataset.md#create).
1. Select **Table** as the chart type.
1. Drag a dimension or measure from the dataset to **Columns**. The field is displayed as a column.

   {% note info %}

   * After dragging a **Tree of strings** dimension to the **Columns** section, you will see a [tree hierarchy](../dataset/data-types.md#how-to-create-tree) in the visualization area.
   * You can change the order of columns by dragging dimensions in the **Columns** section.

   {% endnote %}

## Additional settings {#additional-settings}

{% cut "Setting up table size" %}

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Select the table size:

   * `L`: Large (default)
   * `M`: Medium
   * `S`: Small

1. Click **Apply**.

Depending on the size you select, the table will adjust its font size, line spacing, and indentation within cells.

{% endcut %}

{% cut "Renaming columns" %}

1. Under **Columns**, click the icon to the left of the dimension or measure name.
1. In the window that opens, change the **Name** field value and click **Apply**.

{% endcut %}

{% cut "Adding tooltips to table headers" %}

1. Under **Columns**, click the icon to the left of the dimension or measure name.
1. In the window that opens, enable the **Tooltip** option, enter the text in the field below, and click **Apply**. By default, with this option enabled, the tooltip text is taken from the field description in the [dataset](../dataset/index.md).

When the option is enabled, the ![image](../../_assets/console-icons/circle-question.svg) icon appears next to the table column header. Hover over the icon to bring up the tooltip.

{% endcut %}

{% cut "Setting up table data sorting by multiple columns" %}

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Disable **Pagination** and click **Apply**.
1. Press and hold **Ctrl** while clicking the headers of columns to change the sorting for.

{% endcut %}

{% cut "Setting up column width" %}

1. In the top-right corner of the **Columns** section, click ![image](../../_assets/console-icons/gear.svg) (the icon is displayed when you hover over the section).
1. Under **Width**, select the values for columns and rows:

   * `Auto`: Automatic column width.
   * `%`: Column width as a percentage of the table's total width.
   * `px`: Column width in pixels.

   The `%` and `px` options allow you to break text within cells by word. Thus the number of rows in a cell may grow.

   {% cut "Example of column width settings" %}

   ![image](../../_assets/datalens/operations/chart/table-column-setting.png)

   {% endcut %}

   {% note info %}

   The total width of a table always takes up 100% of available space regardless of the specified width of individual columns.

   {% endnote %}

1. Click **Apply**.

To set the width of any column to `Auto`, click **Reset**.

{% endcut %}

{% cut "Freezing table columns" %}

1. In the top-right corner of the **Columns** section, click ![image](../../_assets/console-icons/gear.svg) (the icon is displayed when you hover over the section).
1. In the **Freeze** window that opens, enter the number of columns to freeze. These columns will stay in place as you scroll horizontally.
1. Click **Apply**.

{% endcut %}

{% cut "Changing the number of rows" %}

Use the **Pagination** and **Limit** [settings](../concepts/chart/settings.md#common-settings) to manage the number of rows displayed on the screen and exported from the chart. To change the number of rows:

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Enable pagination and set the number of rows per page or disable pagination.
1. Click **Apply**.

By default, tables come with pagination on and a limit of `100` rows per page. With pagination off, the whole table will be displayed within the [display limits](../concepts/limits.md#datalens-chart-data-limits). Pagination is not available if only one page is displayed or there is no data.

With pagination on, only table data from the current page will be exported. To save the whole table within the [chart export size limit](../concepts/limits.md#datalens-common-limits), disable pagination.


If you need to export a large amount of data, use [background export](../concepts/chart/data-export.md#background-export).


{% endcut %}

{% cut "Enabling pagination" %}

Enable pagination if your table has many rows:

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Enable **Pagination** and click **Apply**.

This option is not available if only one page is displayed or there is no data.

{% endcut %}

{% cut "Adding a row with totals" %}

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Enable **Totals** and click **Apply**.

The **Total** row will now appear in the table. Values in the row are calculated using the same formulas as [aggregation](../dataset/data-model.md#aggregation) in the measure.

{% note info %}

* Values in the **Total** row are calculated only for measures. For dimensions, the row is empty.
* If the **Pagination** option is selected, the **Total** row is placed on the last page.
* If a table consists of a single entry, the **Total** row is not displayed.
* The row with totals does not display results calculated using [LOD expressions](../concepts/lod-aggregation.md), [window functions](../function-ref/window-functions.md), and [time series functions](../function-ref/time-series-functions.md).

{% endnote %}

{% endcut %}

{% cut "Preserving spaces and line breaks" %}

1. At the top of the screen, click ![image](../../_assets/console-icons/gear.svg) next to the chart type.
1. Enable **Preserve spaces and line breaks** and click **Apply**.

With this option on, the text will feature the same spaces and line breaks as in the source data.

{% endcut %}

{% cut "Adding row color" %}

1. Drag a measure to the **Color** section.
1. In the top-right corner of the **Colors** section, click ![image](../../_assets/console-icons/gear.svg) (the icon is displayed when you hover over the section).
1. Set up colors:

   * **Gradient type**: Select two or three colors.

     * Gradient color: Select a color palette for the gradient from the list.
     * Gradient direction: Change the gradient direction using the ![image](../../_assets/console-icons/arrow-right-arrow-left.svg) icon.

   * **Set threshold values**: Set numeric thresholds for each color.

{% endcut %}

{% cut "Setting field fill color" %}.

1. Under **Columns**, click the icon to the left of the dimension or measure name.
1. In the window that opens, enable **Column fill color**.
1. In the **By field** list, select the field whose values the fill will be based on.
1. Set the **Fill type**:

   {% note info %}

   * You can use the **Palette** type for dimensions and the **Gradient** type for measures.
   * Fill is not supported for the **Total** row.

   {% endnote %}

   {% list tabs group=fill %}

   - For a dimension {#measure}

     1. Click the color scheme selection field and set a color for each dimension value.
     1. Click **Apply**.

   - For a measure {#indicator}

     1. Click the gradient selection field and set the following properties:

        * **Gradient type**: Select two or three colors.

          * Gradient color: Select a color palette for the gradient from the list.
          * Gradient direction: Change the gradient direction using the ![image](../../_assets/console-icons/arrow-right-arrow-left.svg) icon.

        * **Set threshold values**: Set numeric thresholds for each color.

     1. Click **Apply**.

   {% endlist %}

1. For the **Gradient** fill type, specify the coloring option for `null` values: `Do not color` or `Color as 0`.
1. Click **Apply**.

{% endcut %}

{% cut "Adding a linear indicator to a column with a measure" %}

1. Under **Columns**, click the icon to the left of the measure name.
1. In the window that opens, enable **Linear indicator**.
1. Specify the indicator settings:

   * **Fill type**: Type of fill color for the indicator.
   * **Positive values**: Indicator color for positive values.
   * **Negative values**: Indicator color for negative values.
   * **Show labels**: This option enables displaying measure values in a cell.
   * **Show in totals**: This option enables displaying the indicator in cells with totals.
   * **Align**: Left or right alignment of the indicator position in a column. Only applies if all numbers in a column are either positive or negative.
   * **Scale**: Sets the indicator scale. If you set a scale manually, specify the **min** and **max** values. Make sure the **min** value is less than or equal to `0` and the **max** value is larger than or equal to `0`.

   {% cut "Example of linear indicator settings" %}

   ![image](../../_assets/datalens/operations/chart/table-linear-indicator-setting.png)

   {% endcut %}

1. Click **Apply**.

{% cut "Example of a chart with a linear indicator" %}

![image](../../_assets/datalens/operations/chart/table-linear-indicator.png)

{% endcut %}

{% endcut %}

## Recommendations {#recomendations}

{% note tip %}

Use tables for their intended purpose only. Do not replace all data visualization types with them.

{% endnote %}

* **Sizes.** Limit the size of your table or use filters and sorting. Tables with too many rows or columns are hard to read.
* Place dimensions on the left and measures on the right. This makes the data easier to comprehend.
* Make sure column names you use are short and readable.
* **Totals.** Enable totals at the bottom of the table.

  {% cut "Table with totals and pagination" %}

  ![table-pagination](../../_assets/datalens/visualization-ref/table-chart/table-pagination.png)

  {% endcut %}

* **Totals.** Present totals as a column (or subtotals as a column). To do this, use calculated fields based on [window functions](../concepts/window-function-tutorial.md) or [LOD expressions](../concepts/lod-aggregation.md). For example:

  * Sales subtotal by product category: `CategorySales` with the `SUM(SUM([Sales]) WITHIN [ProductCategory])` formula.
  * Total sales: `TotalSales` with the `SUM(SUM([Sales]) TOTAL)` formula.

    {% cut "Table example" %}

    ![table-sum](../../_assets/datalens/visualization-ref/table-chart/table-sum.png)

    {% endcut %}

  * Maximum order count per month grouped by product category: `MaxCountByCategory` with the `MAX(COUNTD([OrderID] INCLUDE [ProductCategory]))` formula.

    {% cut "Table example" %}

    ![table-count](../../_assets/datalens/visualization-ref/table-chart/table-count.png)

    {% endcut %}

{% note tip %}

Use sorting. This makes the data easier to comprehend.

{% endnote %}

* Use the [URL](../function-ref/URL.md) function in table cells to enable users to follow a link.

* **Auto height.** When placing a table on a dashboard, enable auto height in the widget settings. This will help you save dashboard space. 

  {% cut "Setting up auto height" %}
  
  ![table-auto-height](../../_assets/datalens/visualization-ref/table-chart/table-auto-height.png)

  {% endcut %}
  
  If you use a filter, the table height will automatically adapt to the number of rows.
  
  {% cut "Using a filter with the auto height option enabled" %}
  
  If no value is set in the filter, a table displays all rows depending on the limit to the number of rows per page.
  
  ![table-auto-height-2](../../_assets/datalens/visualization-ref/table-chart/table-auto-height-2.png)

  If the number of displayed rows decreases when using the filter, the table height is reduced automatically.

  ![table-auto-height-3](../../_assets/datalens/visualization-ref/table-chart/table-auto-height-3.png)

  {% endcut %}

* If a table cell contains a long text, use the column width [settings](#additional-settings) to enable a line break in cells.

  {% cut "Setup example" %}

  ![table-column-width](../../_assets/datalens/visualization-ref/table-chart/table-column-width.png)

  {% endcut %}

* When displaying numeric data, specify the dimension and the number of decimal places. For example, if you select `Millions, M` in the **Dimension** drop-down list, you will see `10,3 M` rather than `10 345 234.23`. If you set the `Decimal places` field to `2`, you will see `123.12` rather than `123.1234`.

#### Useful links {#see-also}

* [Creating a dashboard in Yandex DataLens](../operations/dashboard/create.md)
* [Adding a chart to a dashboard in Yandex DataLens](../operations/dashboard/add-chart.md)
* [Adding a selector to a dashboard in Yandex DataLens](../operations/dashboard/add-selector.md)