Sometimes you may want to show the sample size of each category in the column headers of your table, and in turn, the axis or legend of a visualization. There is a built-in table rule that will add the Column Sample Size or Column Population to the headers of your table, which will also show the sample size alongside the categories in any visualization you create. This article describes how to go from a crosstab without sample size shown...
...to a table and visualization with the Column Sample Size displayed in the column labels:
and a visualization with the Column Sample Size shown in the legend:
Requirements
- A table with rows and columns, or a visualization with rows and columns.
- This does not apply to tables that do not have the Statistics > Below available.
- Note: You must apply the rule directly to the input table if you see a table icon in the Data > Data Source > Data field in the Properties
of a visualization.
You will also see a warning in the Rules section of Properties if you have applied a rule directly to a non-compatible visualization, and you will need to apply it to the input table instead. For example:
Method
- Select your table or visualization with nested table (the Data > Data Source is using the Rows and Columns fields instead of the Data field).
- From the Properties
, go to Data > Rules > + > Row/Column Labels > Add Sample Size to Column Labels.
- Enter the desired prefix text in Text to show in header that will appear in front of each sample size figure. By default, this is n =.
- OPTIONAL: Tick Show weighted sample size (Population) if you have a weight applied to your table and wish to display the Weighted Column Sample Size instead.
- Press OK.
- OPTIONAL: From the Properties, select Visualization > Bar > Bar (or whatever visualization you like) to create a visualization in place of the table, making it nested within the visualization. You will see that the sample size is shown in the legend of the visualization. To see the table again, click the Table toggle button in Properties.
Next
Caveats and Limitations for Rules