What is a Pie-chart
Pie charts are used to represent the proportion or ratio of categories against the whole. For example, if total Sale of a company is 100k and user want to know what percentage of each category (of products) contributed to this sale then you can use a pie-chart.
*Checkout pie challenge at the bottom of this article and win
Is Pie-chart useful
There is lot of debate on the usability of a pie-chart. This is due to the fact that if number of categories or segments in your data is huge then it will be difficult to get any useful information from the pie-chart.
Even though there are draw backs, Pie-chart is still useful in the business world.
How to Create a Pie-chart
- I will load the tables Category,Product and OrderDetails. I am using these tables from Northwind database. This database is available for free online. Let me know in case you need the data. I have these tables in excel format. To learn about loading excel files in QlikView, visit connecting to excel file
- I have also created a calcualted field in OrderDetails table. This field will calculate the Sales (Quantity * UnitPrice) As Sales
- Once these tables are loaded, i get a synthetic key between OrderDetails and Product table as multiple fields are common between these tables. To resolve synthetic key, i commented UnitPrice in the Product table and executed the script. To learn more about synthetic keys, visit resolving Synthetic key
- My script looks like the one below
Creating Pie Chart
- Once the data is loaded, right click on the white space on the sheet and select New Sheet Object > chart. From the general tab, select Pie-chart.
- Under the Dimensions tab, select CategoryName as Used Dimensions.
3. Under the Expressions tab, write the expression as Sum(Sales). Make sure to check Relative check box. Relative option will display numbers as percentages.
4. Under the presentation tab, check the option for Show Legend
5. Pie chart is created. Explore different option on the Expression and other tabs to see other available options.
6. Since each color of of pie represent a percentage, would it be better to show the percentages with the legends to make it more readable. Right click on the chart and to the Presentation tab. Under Presentation, check the option for “Show Numbers in Legend”. You will get a chart like the following – with percentages for each category displayed.
*First participant to post the correct solutions to the below 2 questions – will receive either the value or the kindle version of the book QlikView Questions And Answers .
You can post your solutions by providing detailed steps in the comments section or by sending your qvw or screen shots at firstname.lastname@example.org.
- Pie represents the “Percentage of the Total”, it will make the chart more useful, if in the above chart we can display the Total sales. Can you take up this challenge and post the steps to display the Total Sales in the above chart. It will look like the screen shot below.
2. Can you make pie chart more elegant and user-friendly. Provide steps to make the chart look like the one below