KNOWLEDGE BASE

How to calculate the number of data excluded by filter and the number of data displayed.


Published: 10 Apr 2023
Last Modified Date: 11 Apr 2023

Question

How to calculate the number of data excluded by filter and the number of data displayed.

<Example>
In the case, [Sub-Category] field have 17 data and if 5 data are selected in the [Sub-Category] filter.
The Number of Data Excluded = 12
The Number of Data Displayed = 5
User-added image
 

Environment

  • Tableau Desktop

Answer

1. Connect to Sample Superstore from Tableau Desktop.
2. Create a new calculated field as following.
     Name : Number of Data Displayed
     Calculation : WINDOW_SUM(COUNTD([Sub-Category]))
3. Create a new calculated field as following.
     Name : Number of Data Excluded
     Calculation : ATTR({FIXED : COUNTD([Sub-Category])})-[Number of Data Displayed]
4. Drag [Sub-Category] to Filter pane -> Check in 5 data.
User-added image
5. Drag [Number of Data Displayed] to Text on Marks.
User-added image
6. Drag [Number of Data Excluded] to the view as following.
User-added image
Did this article resolve the issue?