Common Pie Chart scenarios: Displaying numbers and percentages in a pie chart legend

Some formulas are used more often than others when building Klips. In this series of articles, a Klip is built using a common set of formulas to give a better understanding of how these formulas work within a sample data set.

The pie chart component allows you to compare individual values in relation to the whole.

In this example, the total values for each fruit type are displayed as a number and a percentage in the legend of a pie chart.

This article is rated Intermediate.

You can click the following link to download the sample data set for this Klip.

https://static.klipfolio.com/images/saas/answeredadvancedpiedata.xlsx

Summary of formulas

For the Values sub-component:

GROUPBY( A:A , B:B ) / SUM( B:B , data)...

For the Labels sub-component:

CONCAT( GROUP( A:A ), "(" , NUMBERFORMAT( GROUPBY( A:A , B:B , method ) , 0 , separator ) ")" , data )

Step 1: Building and configuring a pie chart

  1. Click the Build a New Klip button.
  2. Select the Pie Chart component.
  3. Select Use an existing data source form the library and select our sample data set.
  4. Select the Klip component and in the Properties panel, enter a name for the Klip Title.

CONCAT( GROUP( A:A ), "(" , NUMBERFORMAT( GROUPBY( A:A , B:B ) , 0 , separator ) , ")" , data )

Step 2: Setting property formats

  • Select the Values sub-component, Properties panel, for Format as, select Percentage.
  • Select the Labels sub-component, Properties panel, for Format as, select Text.

Step 3 : Setting the Pie Chart properties

  • Select the Pie Chart component, Properties panel, select an option for Size, Max Slices, Sort Order, and Labels.

Step 4: Troubleshooting

  • Use the Evaluate current selection button to verify that columns A and B contain the same number of items.
  • If the data source contains a row header, wrap all references to columns in the SLICE function. For more information, see Slice Function