0

I have a content type with 6 select-list fields. Each field has several available values, multiple selections allowed via checkboxes. A group of users each submit the content once.

Select List Field 1

user001 answered     | user002 answered     |user003 answered
1|oranges            | 1|oranges (x)        | 1|oranges (x)
2|apples (x)         | 2|apples (x)         | 2|apples
3|bananas (x)        | 3|bananas            | 3|bananas
4|mangos             | 4|mangos (x)         | 4|mangos (x)

Select List Field 2

user001 answered     | user002 answered     |user003 answered
1|eggs               | 1|eggs (x)           | 1|eggs (x)
2|fish (x)           | 2|fish (x)           | 2|fish (x)
3|nuts (x)           | 3|nuts               | 3|nuts
4|berries            | 4|berrries (x)       | 4|berries (x)

Views, showing Content of type, contextually filtering on the group id, displays selections from each user in the group. A list of all selected values is shown, including many duplicates.

Apples
Bananas
Fish
Nuts

Oranges
Apples
Mangos
Eggs
Fish
Berries

Oranges
Mangos
Eggs
Fish
Berries

Instead of showing this list (above), I would like to display the number of times each value was selected in total by that group of users.

Fish     (3)
Apples   (2)
Berries  (2)
Eggs     (2)
Mangos   (2)
Oranges  (2)
Bananas  (1)
Nuts     (1)

I have tried Views aggregation, but so far have only been able to count how many values were chosen for a given field, instead of counting how many times each specific value was selected.

It seems like this should be easy to accomplish, like I am missing something simple. How can I achieve this?

  • Are you using 7 or 8? – Matt Jul 31 '18 at 17:56
  • This is in D7, using Views 3x. – Jamie Aug 1 '18 at 1:59
0

I ended up:

Creating a Content Pane for each question.

Added a duplicate set for each field result in the that pane.

For instance one, I set aggregation to "Group results together", which gave me the labels.

For instance two of that same field, I set the aggregation to "Count", which gave me the number of times that value has been selected.

Excluded the above fields from display.

Added a Global Text field for styling, using the tokens from the above fields for Label: (Value)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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