forums

Use these forums to ask questions and discuss Tableau.

Hide small values (for data protection purposes)

Hi,
We use Tableau to report on student numbers in our university (gender, ethnicity, domicile, etc.)

In order to comply with data protection laws if we are producing a table of ethnicity by Department, we need to "hide" any values that are less then or equal to 5 and replace it with an asterisk. The value DOES get included in the Totals for the row/column.

For example, say our Humanities division has three Chinese Asian people and 200 others. The Humanities row would have an asterisk in the Chinese Asian cell but the Grand Total would be 203.

I am pretty sure Tableau won't be able to do this - am I right?

Andy

Comments

Hi Andy,

Actually, I think I have a solution that will help you that involves writing a custom calculation. What you want to to do is create a calculation that returns Null when the number of students is less than or equal to 5.

Here's how it works:

  1. 1. Right-click on the data window and select Create Calculated Field.
  2. 2. In the Calculated Field dialog box, give the calculation a name (something like Number of Students).
  3. 3. Then type a formula like this:
    IF COUNT([Number of Records]) <=5 THEN NULL ELSE COUNT([Number of Records]) END
  4. 4. Check the Formula to make sure it is valid and then click OK.
  5. 5. Now create the table using that measure. For example, you may have Department on the Rows shelf, Ethnicity on the Columns shelf and the Number of Students measure on the Text shelf.

    You can see that any values less than or equal to 5 are left blank. So now you need to get that asterisk.

  6. 6. Right-click the Number of Students field on the Text shelf an select Format.
  7. 7. In the Format window, make sure you have the Pane tab selected. At the bottom there is a Special Values area where you can specify the text to show for Null values. Type an asterisk into that text box.
  8. 8. Now you need to the totals. Select Table > Grand Totals for Columns. The grand totals are based on the underlying data so it includes all the students (even though some are represented as asterisks).

I've attached a packaged workbook that uses a similar example except instead of ethnicity by department it shows gender by major. You can see the calculation I made by right-clicking the Number of Students measure in the Data window and selecting Edit.

Hope this helps!

AttachmentSize
Totals Example.twbx219.54 KB

That solution is perfect. I had been concerned that this would end up being a showstopper, but, well, once again, it all seems to have been thought of by Tableau!

I hadn't come across the Special Values area in the Format Pane tab - very useful!

Thanks