# Customizing Dashboard Tables

## Overview

There are a variety of options for customizing the tables you can create within a research dashboard. This article will guide you through the process of nesting rows, adjusting table display, and enabling stat testing within your dashboard tables.

## 1: Nesting Rows

Table rows can be nested to provide multiple levels on which users can drill-down to view data. To specify the top level of an hierarchy, set `rowlevel=1`

. Any filters under that one would be children of that filter, listed with numbers in ascending order for each new level (i.e., `rowlevel=2`

for children of `rowlevel=1`

, `rowlevel=3`

for children of `rowlevel=2`

, and so on).

When nested rows are applied to a table, children of a filter are hidden until users click on the nesting parent.

Note: When you are nesting rows, make sure that the dashboard's Compat is set to level 2+.

**Example**:

If you have a question with response options broken out across states and their respective counties, you could put `rowlevel=1`

on the state rows, and `rowlevel=2`

on your county rows so that they would be collapsed under the state rows:

Table TableDrillDown Demo With Row Levels row rowlevel=1 q1.r15 Oklahoma row rowlevel=2 q1.r2 Cleveland area row rowlevel=2 q1.r3 McClain area row rowlevel=2 q1.r4 Haskell area row rowlevel=1 q1.r5 Illinois row rowlevel=2 q1.r6 Lake area row rowlevel=2 q1.r7 Madison area row rowlevel=2 q1.r8 Kane area row rowlevel=1 q1.r9 Texas row rowlevel=2 q1.r10 Austin area row rowlevel=2 q1.r11 Dallas area row rowlevel=2 q1.r12 Houston area row rowlevel=2 q1.r13 San Antonio area row rowlevel=2 q1.r14 Other area

The code above creates a nested table like the one displayed below:

### 1.1: Adding a Net

The keyword `net`

adds a row that nets the response data for a specified count of the rows listed below it. If the count specified is negative, the net includes the rows listed above it.

net <count> [title]

**Example**:

If you have a question asking respondents for their favorite color, and want to know which two colors are the most popular and which two are the least popular, you might use the following code to add nets for the table’s “Top 2”/”Bottom 2” responses:

table Favorite Colors net 2 Top 2 rows Q11.r1-r5 net -2 Bottom 2

### 1.2: Adding a Sum

The keyword `sum`

adds a row that sums the response data for the next specified count of rows. If the count is negative, then `sum`

includes the previous rows. This option makes the most sense when trying to sum checkboxes, where respondents can select multiple responses in one question.

sum <count> [title]

**Example**:

If you have a question asking which colors respondents like, and want to see how many people overall are picking black and blue, you might use the following code:

table Likeable Colors row Q1.r1 Green row Q1.r2 Yellow row Q1.r3 Red row Q1.r4 Blue row Q1.r5 Black sum -2 Likes Black & Blue

### 1.3: Adding a Total

The keyword `total`

adds a row which will count respondents that fulfill the conditions for all other rows in the table. If a `title`

for the total is not specified, "Total" will be used.

total [title]

**Example**:

If you want to see the total number of respondents answering a gender question (rather than just a split between males and females), you might use the following code:

table Gender of Respondents rows Q1.r1-r2 total

## 2: Displaying a Grid Question Within a Table

It is possible to display a grid question within a single table. To create this display, you would use the `conds`

attribute on each row you would like to include and define multiple conditions for these rows that correspond to each segment of the table.

Note: For a chart, each row renders as a stacked bar and the columns renders in the relative color for each stacked bar.

**Example**:

If you wanted to view the data for a rating question evaluating your service’s “availability”, ”speed”, and ”stability”, you might use the following code, where the `conds`

attribute is used to specify the correct rows for each specific segment:

table Rating banner.local segment q3.r1.any "Availability" segment q3.r2.any "Speed" segment q3.r3.any "Stability" row conds="q3.c1.r1, q3.c1.r2, q3.c1.r3" q3.c1.any Poor row conds="q3.c2.r1, q3.c2.r2, q3.c2.r3" q3.c2.any Fair row conds="q3.c3.r1, q3.c3.r2, q3.c3.r3" q3.c3.any Good row conds="q3.c4.r1, q3.c4.r2, q3.c4.r3" q3.c4.any Excellent

This code should output the table below:

## 3: Adding Horizontal Percentages

By default, the vertical percentage in a table is generated by dividing the row count by the base. However, you can add a set of horizontal percentages to a table to view percentages based on a segment instead. The keyword `hp`

adds horizontal percentages based on the first banner segment in a dashboard, with the precision specified on a table or row. By default, this feature is off, but can be enabled simply by setting a precision.

hp <precision or off>

**Example**:

If you wanted to see the percentage of each gender answering additional questions in a table, you might add the following code:

table Gender of Respondents hp 2

## 4: Setting the Percentage Calculation

It is possible to change the base for the percentage calculation within a table to use survey logic. The keyword `base`

re-bases the percentage calculation using another specified condition. This overrides basing from the total row and banner segments and can be set to use any logic from within the survey.

base <condition>

**Example**:

If you want to view the top and bottom 2 choices from your favorite color question based on everyone who provided an answer to that question alone, you might use the following code:

table Favorite Color row base=Q2.any "Q2.r1 or Q2.r2" Top 2 Choices row base=Q2.any "Q2.r3 or Q2.r5" Bot 2 Choices

Note: This option should not be used when horizontal percentages are enabled. The base keyword is used to display vertical percentages only.

## 5: Enabling Statistical Calculations

The stat rows supplied in a table are calculated using the overall percentages for numeric data. If needed, though, you can change this method for each individual row. The keyword `stats`

enables the calculation of statistical data, rather than percentage, on numeric data.

stats <option>

The following options are available when using `stats`

:

mean |
The standard mean |

stddev |
The sample standard deviation (i.e., sigma-1) |

sum |
The total sum of all responses |

stderr |
The standard error |

median |
The median |

count |
The number of non-empty (zero/null) responses |

pct |
The count divided by base (e.g., 40% of all respondents answered this question) |

**Example**:

If you want to see the averages for TV and radio ownership based on your statistical data, rather than on a percentage of your overall respondent base, you might use the following code:

table Things Owned row stats=mean Q3.r1.val TVs row stats=mean,stddev Q3.r2.val Radios

### 5.1: Setting the Precision of Stat Values

You can also adjust the precision used when calculating the statistical data in your stat rows. The `stats.precision`

keyword is used to specify the decimal digit of precision for statistics.

**Example**:

If you want to view your TV/radio ownership calculations to the third decimal digit, you might use the following code:

table Things owned stats.prec 3 row stats=mean q1.r1.val TVs row stats=mean q1.r2.val Radios

## What's Next for Creating a Dashboard?

The following articles describe additional features that you can apply to your dashboard tables: