Skip to main content

Creating Donut and Sunburst chart in Tableau

 Are you bored of using a basic Pie chart in your visualization? Then this blog is for you. In today's blog, we will discuss step-by-step procedures to create a donut chart. Along with the donut chart, there is a much more so stick around. Let's start with a basic donut chart which proves to be the best alternative to the pie chart. A donut chart is a type of Pie chart where the center is carved out so that you display text in the carved-out space. 

Pro Tip-: Donut chart can be used to display your KPIs and you can use it to display ratios and percentages. But if you are trying to visualize more than 5 categories try to avoid the donut chart because it will hamper the quality of visualization. The stakeholders expect to see clear visualization where the graphs tell their story by themselves.

(For more pro tips do follow our blog )

So let's get started!!!! To create the donut chart we are using the sample superstore data and will highlight all the steps from scratch. 

To start off we are considering the orders table and create a calculated field (reference) that is 0. Take the calculated field in rows and in the marks pane select the pie. You can increase/decrease the size of the pie accordingly.


After getting the pie copy the calculated and paste it in the rows so that you will get two pies. Now you can get the essence of where this visualization is heading to and you can guess the next steps if you are aware of Tableau. We are looking to use the dual-axis with the two pies.





In the marks pane, you can see you have two calculated fields you need to select the second calculated field, and in the color, tab select white so that you get the carved out space. After that in the first calculated field add the region to colors. 

Let's consider the case where you have several levels of hierarchies and you need to show all of them in a single chart. In that case, you can't rely on a donut or a pie chart. You need to switch focus on the Sunburst chart. It is one of the best visualizations when it comes to hierarchical data. We will be creating it in Tableau with the sample superstore data.

We will take the categories and put them in the colors and select the pie in the marks pane. It will give you the basic pie chart and as with most visualizations, in Tableau, we are looking forward to doing a dual-axis. For that, we need two pie charts. In columns, we need to create SUM(0) and copy that. In the angle tab, you need to put the sales.




After getting the two pie charts in the marks pane select the SUM(0)_2 and add the subcategories in the color. You can see the reason because you get different categories in one of the pie charts and subcategories in another and eventually we will use dual-axis to merge them.



We are getting close to the final result and you can adjust the size of both pie charts accordingly. Now select the first SUM(0) in the marks pane and sort the subcategories with respect to the sales. The most important thing is we are sorting the subcategories in terms of the field and in descending order.


At last, we will select the right colors for the sunburst chart for that you need to edit the colors and a toggle will open where you need to select all the subcategories that come under a particular category. Like in our case we got 4 subcategories under the furniture category. We are selecting all the subcategories under furniture and assigning them blue colors. Similarly, you can do it for other categories. And after assigning the right colors you will get the sunburst chart.






Doesn't it look beautiful and provide more details when compared to donut charts and pie charts? You can add more details to this chart. The donut chart is a sunburst chart with no hierarchies in it. You can achieve the same visualization in Power BI too. Such a level of detail can lift up the standards of your dashboard and makes the task of the stakeholders much easier.



Thanks for Reading  Let's connect on  LinkedIn.



Comments

Popular posts from this blog

Ultimate Beginners Guide to DAX Studio

There are zillions of external tools available with Power BI but DAX Studio is one of the most commonly used tools to work with DAX queries. It is a perfect tool to optimize the DAX and the data model. In this blog let's shed some light on the basic functionalities that can take your report to the next level. ARE YOU READY?  To start you will need the latest version of the DAX Studio. You can download it from their website . Don't worry you don't have to pay for the license. Fortunately, DAX Studio is a free tool As a BI Developer, I am using DAX Studio regularly. Based on my experience I use it for several purposes but in this blog, I will highlight the most common ones. Extracting a dump of all the measures used in your PBIX. Why do we need to do this? It can be used for documentation purposes also sometimes we try to reuse the DAX and such a dump comes in handy in this scenario. How to achieve it? Open the DAX Studio it is located under the external tools once you open t

Append v/s Merge in Power BI

Let's discuss another problem of the week. As a Power BI user, there are times when you want to combine queries. What are the ways to do so? In most cases, you can attain it by using either append or merge and both serve different purposes. Let's understand what do these terms mean in Power BI and how they are functionally different from each other.  It is quite common to get data from various sources and you need to combine those data depending on a particular column which is common in both tables so that you can add extra information or column to your big table. In such cases, we use merge queries. How to perform merge queries? For instance, I am considering Sample Superstore data and we will merge the returns table to the order table. You will find both merge and append in the home tab in extreme right in the power query editor. ProTip - You will find two options when you click on the drop-down in merge which are merge queries and merge queries as new. When you use merge que

Use Relationship in DAX

Data modeling is an essential part of creating perfect visuals. While creating complex data models there can be a case where you can find an inactive relationship represented by dotted lines and it occurs because you already have an active relationship between the two tables. But as a developer, you need to use both the relationship. How can it be done? You can use "Use Relationship" in such cases. Use relationship can be added to your DAX and act as a modifier or enhancer for calculation. It activates the inactive relation. But make sure you have an inactive relationship in place before using the use relationship function. Let's see how it works on Sample Superstore data. In my fact table I have two dates- Order date and Ship date. I am making the two relations between my date table and fact table. The relation between the sample superstore (date) to date table (date) is active while the relation between the sample superstore (ship date) to date table (date) is inactive