I have a content type shortcut with the fields field_namespace and field_active. Additionally, I have a Taxonomy term vocabulary named namespace that is used in field_namespace.

Example content:

Title       | Namespace   | Active
Shortcut 1  | Namespace A | True
Shortcut 2  | Namespace A | False
Shortcut 3  | Namespace B | False

Now, I have a view displaying a list of these Taxonomy terms as a table. A column of this table display the number of Shortcuts tagged with the particular term. Example:

Namespace   | Shortcut count
Namespace A | 2
Namespace B | 1

I built this using a Views Relationship with Taxonomy term: Content with term. I used this relationship to add the Field Shortcut: Nid with the Aggregation Type COUNT DISTINCT.

What I now want: The Shortcut count shall only consider Shortcuts whose field_active is True, i.e. the output shall be:

Namespace   | Shortcut count
Namespace A | 1
Namespace B | 0

So the COUNT DISTICT aggregation shall be somehow filtered by the value in field_active.

Is there an UI way to do this? If not, which hook is appropriate to do it programmatically?

1 Answer 1


After having asked a friend, I can now answer the question myself.

The solution is pretty straightforward: At FILTER CRITERIA, I simply add field_active, with the operator "Is one of" checking the value "On".

I thought, FILTER CRITERIA may only be fields actually displayed, but this is not the case. It works for all fields being in any form used in the view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.