Help: how to calculate most common answer?

We have an app that handles surveys and at the end of the survey there’s a report.

We want to show the most common reponse on screen.

So we need to count the response grouped by answer, find the max from that set, then find the response(s) whose count maches with the max count.

We’re banging our heads on the keyboard trying to find out how to do that. It’s got to be done on the UI and not database because it will depend on each user.

How do we go about doing this?

Why is it that the answer comes by itself right after posting on the forum?

Answer:

  1. Make a repeating group: do a search of answers, group by category, and create a count aggregation.
  2. Then in another group/input: take the list from the repeating group and filter by count = repeating group’s list of count:max.

This will narrow down to only the questions whose count = max, aka most frequent.

This topic was automatically closed after 70 days. New replies are no longer allowed.