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.
You may choose to show weighted sample sizes (Column Population) rather than Column n.
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 object inspector of a visualization.
You will also see a warning in the Rules section of the object inspector 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
- From the object inspector, 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 sample size instead.
- Press OK.
- OPTIONAL: From the object inspector, select Visualization > Bar > Bar (or whatever visualization you like) to create a visualization from the table. You will see that the sample size is shown in the legend of the visualization.
Next
Caveats and Limitations for Rules
How To Create a QScript To Insert a Custom Rule
How to Add Column Letters to Column Labels
UPCOMING WEBINAR: 10 Market Research Predictions Over the Next 4 Years