Pivot table

A table is a standard form of data representation with as many details as possible. Tables are most suitable for detailed analysis (a deep dive into figures) and problem detection. It is best to place tables at the end of a dashboard. Graphical representations are simpler for reading information, while tables take you deeper into the data and require more time to read.

Unlike a flat table, categories in a pivot table can be stored both in columns and rows. They may contain multiple categories, while cells at their intersection contain measure values.

Pivot tables make it easier to work with large amounts of data and let you analyze the relationship between different measures. For example, you can use this type of table to analyze product sales depending on the delivery type by brand and product category over a specific year.

pivot-table-chart

Source table
CategoriesProduct brandDelivery type2019202020212022
Household cleanersBioDomDelivery2861928362761398283952801
Household cleanersCity DriverDelivery2480206992841074216705072
Household cleanersMoydodyrDelivery1997375329971090102807578
Household cleanersChistyy DomDelivery400993101693016582541092608
Household cleanersBioDomPickup795267211245331383492184422
Household cleanersCity DriverPickup574643166566525440451843545
Household cleanersMoydodyrPickup503241145544924411031632025
Household cleanersChistyy DomPickup815338244613637105642837481
Household goods1001 necessary small thingsDelivery701548163096525927841947613
Household goodsCedar woodDelivery2574598299611226510873104
Household goodsRostov factoryDelivery111812220937584077272213
Household goodsHleb-SolDelivery557311127352323945721615675
Household goods1001 necessary small thingsPickup1499384388021062576654351725
Household goodsCedar woodPickup703202192295229355462323846
Household goodsRostov factoryPickup2152436191171078515780640
Household goodsHleb-SolPickup1053432346967252714663754047
Home appliancesKitchen&FoodDelivery30791992611814131741063128
Home appliancesTechBeautyDelivery2715537687931192747809543
Home appliancesRazumnyy DomDelivery828609232016037470592672810
Home appliancesFabrika KomfortaDelivery364309110370016742971146209
Home appliancesKitchen&FoodPickup803667225488530653832243507
Home appliancesTechBeautyPickup623684167560628913342029385
Home appliancesRazumnyy DomPickup1917822552061785384196468868
Home appliancesFabrika KomfortaPickup1072286217043141786902827290

Sections in the wizard

Section
in the wizard
Description
ColumnsDimensions.
StingsDimensions.
MeasuresMeasures. If you add more than one measure to a section, the Columns section contains the Measure Names dimension that defines the location of the measure headers. Measure Names can be moved to Rows.
ColorsMeasure. Affects shading of all cells containing indicators. It may only contain one measure.
SortingDimensions and measures specified in the Columns and Rows sections.
You can use multiple dimensions and measures.
The order of section fields affects the sorting order of table fields. The sorting direction is marked with an icon next to the field: ascending or descending. To change the sorting direction, click the icon. Sorting by measure only impacts a request to the source and does not affect the pivot table.
FiltersDimension or measure. Used as a filter.

Creating a pivot table

Note

Not supported in QL charts.

To create a pivot table:

  1. On the DataLens home page, click Create chart.

  2. Under Dataset, select a dataset for visualization.

  3. Select the Pivot table chart type.

  4. Drag a dimension from the dataset to the Columns section.

  5. Drag a dimension from the dataset to the Rows section.

    Note

    In the Columns and Rows sections, you can change the order of dimensions by dragging them.

  6. Drag a measure from the dataset to the Measures section. The values are displayed in the table cells.

  7. Drag a measure from the dataset to the Color section. Cells with the measure are filled in with a color from the color gradient, depending on the measure value.

Additional settings

Renaming table columns and rows

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

Setting up the width of table columns and rows

  1. In the top-right corner of the Columns or Rows section, click (the icon appears when you hover over the section).

  2. In the Column and row width window that opens, set up the width of columns and rows:

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

    The % and px options let you make a table cell break (by word). This may increase the number of rows in a cell.

    Note

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

  3. Click Apply.

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

Adding rows with subtotals

  1. Under Columns or Rows, click the icon in front of the field name.
  2. In the field settings window, enable Sub-totals.
  3. Click Apply.

The table will show columns and/or rows with Total .

To output the common Total row, enable Sub-totals in the settings for the first fields under Columns and Rows.

Pivot table with subtotals

pivot-table-totals

Note

Setting up a field fill color

  1. Under Columns, Rows, or Measures, click the icon to the left of the field name.

  2. In the window that opens, enable Column fill color.

  3. In the By field list, select the field whose values the fill will be based on.

  4. Set the Fill type:

    Note

    You can use the Palette type for dimensions and the Gradient type for measures.

    1. Click the color scheme selection field and set a color for each dimension value.
    2. Click Apply.
    1. Click the gradient selection field and set up:

      • Gradient type: Select 2 or 3 colors.

        • Gradient color: Select a color palette for the gradient from the list.
        • Gradient direction: Change the gradient direction using the icon.
      • Set threshold values: Set numeric thresholds for each color.

    2. Click Apply.

  5. Click Apply.

Adding a linear indicator to a column with a measure

  1. Under Measures, click the icon to the left of the measure name.

  2. In the window that opens, enable Linear indicator.

  3. 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 it 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.
    Sample linear indicator settings

    image

  4. Click Apply.

Recommendations

  • Use a pivot table to represent aggregate data in table format.

  • 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 easy to read.

  • Limit the size of your tables or use filters/sorting. Tables with too many rows or columns are hard to read.

  • You can color table cells depending on the values of a measure. This will help you to highlight the values.

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

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

    Setting up auto height

    pivot-table-auto-height

    If you use a filter, the table height will automatically adapt to the number of rows.

    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.

    pivot-table-auto-height-2

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

    pivot-table-auto-height-3

  • Represent totals (or subtotals) as a column. To do this, use calculated fields based on window functions or LOD expressions. For example:

    • Subtotal amount of sales by product category: the CategorySales measure with the formula SUM(SUM([Sales]) WITHIN [ProductCategory]).

    • Total sales: the TotalSales measure with the formula SUM(SUM([Sales]) TOTAL).

      Sample table

      pivot-table-sum

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

      Sample table

      pivot-table-count

  • Use sorting. This makes the data easier to comprehend.

  • Use the URL function in table cells to enable users to follow a link.

  • When displaying numeric data, specify units and the number of decimal places. For example, if you select Millions, M in the drop-down list of the Units field, the 10.3 M value is displayed instead of 10,345,234.23. If you set the Precision field value to 2, then 123.12 is displayed instead of 123.1234.

Previous