Displaying poll results using a pie chart

Displaying poll results using a pie chart

A few days ago, our support team came upon an interesting question of how to display poll results using a pie chart. In particular, how to tally results where each vote is considered a separate record and each result is recorded as text. Here's what the data source may look like:

1 Date Poll Result
2 3/18/2013 Yes
3 4/18/2013 Yes
4 4/18/2013 Yes
5 4/18/2013 No
6 5/18/2013 Not Sure
7 5/19/2013 Not Sure
8 6/19/2013 Not Sure

How do we visualize this data?

The challenge most folks face with a data set like this is knowing how to tally up the results. The trick is using the Klip Editor to format this data so the dashboard understands what you want from the data. To do this, we are going to use two functions: CountDistinct and Group.

Tallying the results

The first step is to tally up the values so we can have a running total for each result type. The CountDistinct function counts or tallies each unique value in a column or array. So, if I select column B:B, I will see that I have 3 yes, 1 no, and 3 not sure votes. Notice that I am using a Slice function within the Count Distinct function. By default, the Slice function will remove the first value from your selection meaning I don't have to worry about accidently including the column header as a result in my pie chart.

CountDistinct tallies unique values such as text or numbers

Labelling the results

The next step is to label the results so we know what we are looking at in the pie chart. The Group function eliminates duplicate values from a column and can be used to reduce a list of repeating elements to only one of each name. Since column B:B also provides the description for the results, we will select that column. Again, I'm using a Slice function to remove the column header from my pie chart.

Group eliminates duplicate values from a column

The finished chart

The end result is a simple pie chart:

Group eliminates duplicate values from a column

What if I don't want to use a Pie Chart?

This method works well with the bar/line chart component. To use this method in a bar/line chart, assign the CountDistinct function to the first series sub-component, and then assign the Group function to the X Axis sub-component. Since you only need a single series of data in this chart, I would also invert the X and Y axis by opening the Properties tab associated with the Chart component.

Use a Bar Chart instead of a Pie Chart

Where will I encounter this type of data?

I find this type of data is common with iFormBuilder as each record is populated based on the unique identity of the person casting the vote, rather than summing up votes such as a service as PollDaddy.


Topics: Features

Originally published May 9, 2013, updated Jun, 18 2019

Related Articles

Words Have Power - A diverse group of people working on laptops

The Power of Words

By Holly EbbsAugust 12, 2020

Start building dashboards for your team and your clients.