Example

Let's say I have some tabular data. This is a contrived short example, but imagine thousands of rows and a dozen columns.

Type Value
A Foo
A Bar
B Foo
B Bar

And you can filter this table by the values in each column. And in the menu for setting that filter, it's desirable to have a count of items that match that filter.

So clicking on "Type" would give a menu like:

• A (2)
• B (2)

And clicking on "Value" would show a menu like:

• Foo (2)
• Bar (2)

Now you click on "A" on the "Type" filter and only rows with a "Type" of "A" are shown.

What are the correct counts in the filter menus?

(Bold means selected)

Option 1: Never change the counts

• Type:
• A (2)
• B (2)
• Value
• Foo (2)
• Bar (2)

The counts don't change. No matter what filters are selected, show the number of matches for that filter item in the global unfiltered.

This make it easy to see that other filters may be hiding the data you want. If the number says (2) but there is only one record shown it's easy to understand that another filter may be at play.

But it may confusing when you click on a item with a large number and see a much smaller number of results. This could feel like a bug.

Option 2: Apply other filters, but not the one for this menu

• Type:
• A (2)
• B (2)
• Value
• Foo (1)
• Bar (1)

Here only the "Type" filter is set to "A", so the type menu shows that there are 2 A's and 2 B's.

However the "Value" filter now counts based on all other filters set. So since the type is constrained to "A", there is only one "Foo" and one "Bar" that matches that.

This is nice because when you click filter menu option, the number in the badge is how many items you will see. This informs you where you have data density given the current filter setup.

But it makes it harder to know what portion of the data you are actually seeing.

Option 3: Apply all filters to counts

• Type:
• A (2)
• B (0)
• Value
• Foo (1)
• Bar (1)

(This makes the least sense, I think, but here for completeness.)

Always apply all filters to the pool that gets counted. So because "A" is selected, there are zero "B"s that match that filter. Filtering on "A" and "B" both would change the "B" from a count of 0 to a count of 2. since both A's and B's now match, and they both have 2.

This could be nice because it provides a count of the current filter set, which breaks the table down by the count of unique values in.

This isn't great because clicking on something with a zero count, then shows more data and changes the count.

I suppose we could just hide the counts that are zero, but in that case may as well add a useful value instead?

Option 4: Hybrid counts

• Type
• A (2/2)
• B (0/2) or (1/2) maybe
• Value
• Foo (1/2)
• Bar (1/2)

Show both the counts that match the current filters and the counts that match the unfiltered set.

This gives a lot of detail, but is a lot noisier, and doesn't seem intuitive. But with some explanation and/or training, people could learn what it means and perhaps find it useful.

We have an application that currently uses Option #1, but there's some push for something closer to Option #2 or #3. Is there a best practice for this situtation?

I think you’ve answered yourself with Option 2:

• Pro: “Informs you where you have data density given the current filter setup.”

• Con: “It makes it harder to know what portion of the data you are actually seeing.”

For most filtering tasks, I’d say the user cares about the data density but not portion of the data. Why do users filter? Two main reasons:

• To limit the display to objects they’re interested in. In that case the numbers are useless. The user will filter as necessary, and the count or portion excluded is irrelevant. It is what it is.

• To reduce the objects to a reasonable number for inspection or comparison. In that case, the users care about how many they will get if they filter on a given attribute value.

So Option 2 is the answer. You want to display the current effect of the filtering control not the state of the filtering setting or the data as a whole.

In summary, I can see why the users want to know, “If I click this, how many objects will be displayed?” However, I can’t see why the users would want to know “With this filter, I’m showing about ½ of my objects with an X.” If you do have such a need, then Option 4 is worth pursuing.