Where the Statistic shown on a table or a chart is naturally a percentage, you can use the in the Appearance > Appearance > Number Format menu to display or hide the percentage sign.
In some situations, such as when computing Net Promoter Score, the results of a calculation may be interpretable as percentages, but this button will not be available, as the statistic in which the outputs are stored, typically the Average, are not percentages.
This post contains the steps to go from a table showing the Average...
to a table with the same statistics renamed (to Net Promoter Score) and with percentages signs added:
Method
- Select the table.
- Go to Data > Statistics > Cells > select % Share.
- Go to Data > Rules > + > New Custom Rule (write your own JavaScript).
- Select Edit JavaScript.
- Input the below code:
//Hijack the % Share statistic to show the Average with %
The above code inserts the Average data into % Share. This code also renames the statistic as Net Promoter Score. You can amend the code to use a different statistic and label.
//Change if you want to show the "real" % Column Share in the table
//change that to a different % statistic you're not using
var pctstat="% Share";
//Change the text in "" below to the name you want for your statistic
var newname="Net Promoter Score";
//create variables for number of rows/columns for loop
var n_rows = table.numberRows; var n_columns = table.numberColumns;
//get the Average values shown in the table
var averages = table.get("Average");
//get the current percentage values to overwrite
var percents = table.get(pctstat);
//loop through the cells in each row/column
for (var r = 0; r < n_rows; r++) for (var c = 0; c < n_columns; c++)
//overwrite the percent value with the average value
percents[r][c] = averages[r][c];
//write the new values to the table
table.set(pctstat, percents);
//rename the percent statistic with what you want the new one called
form.setTranslation(pctstat,newname); - Select OK.
- Go to Data > Inputs > Statistics > Cells > deselect Average (the original statistic).
- Optionally, add the percentage symbols by selecting it in Appearance > Appearance > Number Format.