# pivot-table properties

Information noteSTABLE.   
  
This API is reliable and breaking changes are unlikely.

pivot-table()

These are the properties used by Qlik Sense pivot tables.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | 2.2 |

## Properties

### showTitles

Type: Boolean

Show title for the visualization.

Default: true.

### showDetails

Type: Boolean

Sets if visualization details should be shown.

Default: false

### title

Type: String | qStringExpression

Visualization title shown if "showTitles": true.

### subtitle

Type: String | qStringExpression

Visualization subtitle shown if "showTitles": true.

### footnote

Type: String | qStringExpression

Visualization footnote shown if "showTitles": true.

### disableNavMenu

Type: Boolean

Disables the hover menu in the visualization.

Default: false

### qHyperCubeDef

Type: Object

The hypercube definition used by most visualizations.

A subset of the properties available in the qHyperCubeDef is presented here. For complete documentation of all available properties, see [Engine API: HyperCubeDef](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-hypercubedef.htm).

Additional properties:

#### columnWidths

Type: Array

Array of one value determining the column widths. If omitted, a default value is used.

-1 equals auto.

#### qDimension

Type: Array

Extends NxDimension, see [Engine API: NxDimension](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxdimension.htm).

Additional properties

* **qDef**

  Type: Object

  Description: Extends NxInlineDimensionDef, see [Engine API: NxInlineDimensionDef](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxinlinedimensiondef.htm).

  qDef properties

  | Name | Type | Description |
  | --- | --- | --- |
  | autoSort | Boolean | Set to automatically sort the dimension.<br><br>Default: true |
  | cId | String | ID used by the client. Must be unique within the current chart. |
  | textAlign | Object | **auto**: Type: Boolean. Set to auto-align text.<br><br>Default: true<br><br>**align**: Type: String. Set to manually align text. Can be set as :<br><br><ul><li><span>left</span></li><li><span>right</span></li><li><span>center</span></li></ul><br><br><br>Default: left |
  | othersLabel | StringExpressionContainer | String expression container. |

* **qAttributeDimensions**

  Type: Array

  Description: Extends NxAttrDimDef, see [Engine API: NxAttrDimDef](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxattrdimdef.htm).

  id

  Type: String

  One of:

  * colorByAlternative: colors the chart using different dimensions. Can be used together with color.mode="byDimension" for attribute dimensions.
  * colorByExpression: used together with color.mode="byExpression".

#### qMeasures

Type: Array

Description: Extends NxMeasure, see [Engine API: NxMeasure](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxmeasure.htm).

Additional properties

* **qDef**

  Type: Object

  Description: Extends NxInlineMeasureDef, see [Engine API: NxInlineMeasureDef](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxinlinemeasuredef.htm).

  qDef Properties

  | Name | Type | Description |
  | --- | --- | --- |
  | autoSort | Boolean | Set to automatically sort the measure.<br><br>Default: true |
  | cId | String | ID used by the client. Must be unique within the current chart. |
  | numFormatFromTemplate | Boolean | When enabled, the number format to use can be selected from multiple predefined formats based on the desired type: number or date.<br><br>Default: true |
  | isCustomFormatted | Boolean | Set to true to toggle off the default client formatting. |
  | textAlign | Object | **auto**: Type: Boolean. Set to auto-align text.<br><br>Default: true<br><br>**align**: Type: String. Set to manually align text. Can be set as :<br><br><ul><li><span>left</span></li><li><span>right</span></li><li><span>center</span></li></ul><br><br><br>Default: left |

* **qAttributeExpressions**

  Type: Array

  Extends NxAttrExprDef, see [Engine API: NxAttrExprDef](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/models-nxattrexprdef.htm).

  id

  Type: String

  One of:

  * cellBackgroundColor: for attribute expression, expression for background color of table cell.
  * cellForegroundColor: for attribute expression, expression for text color of table cell.

#### qLayoutExclude

Type: Object

#### customErrorMessage

Type: Object

Set to define custom error messages.

* **calcCondition**

  Type: String

  Description: Deprecated. Use qCalcCondition.qMsg instead. Set to customize the calculation condition unfilled message.

### search

Type: Object

Search settings.

Additional properties:

#### sorting

Type: String

The settings for sorting the values of a dimension.

sorting properties

| Name | Type | Description |
| --- | --- | --- |
| auto | Boolean | Specifies if the search values of a dimension are auto sorted alphabetically or numerically in ascending order.<br><br>Default: true |
| inherit | Boolean | Specifies if the sort settings are inherited from the dimension selected by the user. |

### sort

All dimension values are sorted by the numeric value of the first measure in a pivot table by setting the property qSortbyYValue in the definition of the hypercube. The sort order affects all dimensions and have precedence before any other sort order defined under the dimensions. It may result in different sort orders for the 2nd and higher dimensions in different branches, depending on their values.

Limitations

* Only supported if subtotals are calculated.
* Only supported if all dimensions are vertical (in the row section), and the array of measures is horizontal (all measures are in the column section).
* Not supported for calculated dimensions.

### components

Type: Array

Component settings. All theme component properties are unset (null) when creating a chart. The values for each attribute are fetched from the current theme. Setting any property here will override the theme used.

Additional properties:

#### key

Type: String

Determines which component the settings apply to.

Default: theme

#### content

Type: Object

Content font and interaction settings.

content properties

| Name | Type | Description |
| --- | --- | --- |
| fontSize | Integer | Font size of pivot table content text.<br><br>Default: unset |
| fontColor | Object | Set to specify color:<br><br>{index: 2, color: '#ff0055'}<br><br>Default: unset |
| hover | Object | Set to specify color when hovering over a row.<br><br><ul> <li>backgroundColor: (String)<p>Background color when hovering</p><p>Default: <span>unset</span></p></li> <li>color: (String)<p>Font color when hovering.</p><p>Default: <span>unset</span></p></li> </ul> |

#### header

Type: Object

Header object font settings.

header properties

| Name | Type | Description |
| --- | --- | --- |
| fontSize | Integer | Font size of pivot table header text.<br><br>Default: unset |
| fontColor | Object | Set to specify color:<br><br>{index: 2, color: '#ff0055'}<br><br>Default: unset |

#### scrollbar

Type: Object

Scroll bar settings.

scrollbar properties

| Name | Type | Description |
| --- | --- | --- |
| size | String | Sets the width of the scroll bar.<br><br>Information noteIn touch screen mode, the scroll bar always has a standard size.<br><br>Possible values:<br><br><ul> <li>small</li> <li>medium</li> <li>large</li> </ul><br><br>Default: unset<br><br>The default is inherited from Theme. If Theme is not set, small becomes the default. |

## Example using Visualization API

Tip noteFor more examples of how to create pivot tables on the fly, see [Mashups: Creating pivot tables](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/Mashups/Content/Sense_Mashups/Create/Visualizations/Pivot-table/create-pivottable.htm).

In this example we create a basic pivot table, containing two dimensions (Year and Quarter) and three measures. The measures have basic number formatting applied and a title is added to the pivot table.

```
app.visualization.create(
  'pivot-table',
  [
    {
      "qDef": {
        "qFieldDefs": [
          "Date.autoCalendar.Year"
        ],
        "qFieldLabels": [
          "Year"
        ]
      },
      "qNullSuppression": true
    },
    {
      "qDef": {
        "qFieldDefs": [
          "Date.autoCalendar.Quarter"
        ],
        "qFieldLabels": [
          "Quarter"
        ]
      },
      "qNullSuppression": true
    },
    {
      "qDef": {
        "qLabel": "FIR%",
        "qDef": "Avg(FwHit)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        }
      }
    },
    {
      "qDef": {
        "qLabel": "GIR%",
        "qDef": "Avg(GIR)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        }
      }
    },
    {
      "qDef": {
        "qLabel": "Putt avg",
        "qDef": "Avg(Putts)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "#,##0.00",
          "qDec": ".",
          "qThou": ","
        }
      }
    }
  ],
  {
    "showTitles": true,
    "title": "Golf statistics"
  }
).then(function(vis){
  vis.show("QV01");
});
```