Skip to main content

Introduction To Power BI Visuals - Part One - Stacked Bar Chart

Overview
I am writing an introductory series on all Power BI visuals for end-users or beginners to have a basic idea how visuals work. During this series of Power BI visuals, we will learn about each OOTB Power BI visual step by step.
In this article, we will talk about the following visual provided by Power BI Desktop OOTB.

Stacked Bar Chart
Let’s get started!
Stacked bar chart looks like this. This chart shows values (sum, count etc.) on the X-axis and group by data on the Y-axis.

 
Now, let’s understand each term in detail. We should set the following parameters to create a Stacked Bar Chart.

 
Let us learn this chart using Sales data which has the following columns. The data will look like this.

 

 
I want to prepare a chart for total sales done by the company sorted by region and item. I need total sales within a region and when I drill down through the region, it should show me sales data by item.
So, let’s get started!
Here, these are the most important properties to create this chart.

 
Axis
We want sales data by region, so I will drag the region first. I want to drill down the data item-wise so, I will add Item in the Axis field.
 
Values
Now, I want to show number of items sold in each region. For this, let's add Units field in values field.

 
After adding Axis and Values, my chart will look like this.

 
Legend
The Legend field is also a useful feature provided by Stacked Bar Chart. Suppose, sometimes we need to represent our bar in different colors with different categories ( For example, I want my first level drill down categorized with item count). So, I will select “Item” in Category field.

 

 
Tooltip
When you need to achieve the functionality on hover of the bar chart, tooltip is very useful.

 
Ex: On hovering over the bar chart, I want to show total and unit cost.
So, I will drag both the fields in my Stacked Bar Chart. After setting all these above properties, our chart will look like the following.

 
Now, let’s talk about design elements
It provides the following functionality.

 
General
Here, we can set height, width, X and Y position, alternative text etc. Recently, it has got one preview feature, i.e., Responsiveness.

 
Legend
From here, you can change the legend settings, like its color, font, font size, position, and title.

 
Y-axis
From here, you can hide or show the Y-axis. Here, you can also change the position of Y-axis to left or right.
We can also make formatting changes from here.

 
X-Axis
From here, you can hide or show the X-axis. Here, in Scale type, we have two options -
  • Linear
  • Scaler

In Start and End tab, we can set the figure manually if we wish. By default, Power BI automatically detects a range.
We can hide or show the title using this setting. We can also hide, show, and format the Gridlines from here.

 
Data colors
Power BI automatically adds data colors when we are adding a visual. If we want to change the data colors, we can change those using this option.
 

Data labels
Here, if we want to set the labels on bar, we can Switch-On this feature. If we enable the data label, it provides various formatting options.
 
Plot Area
This setting has an option for transparency for background. We can set the background transparency from here.

 
Title
Using this option, we can show or hide the Title. If we want to change or format a title, we can do that just in a few clicks.

 
Background
Using this option, we can set the background for our visual.
It provides two options.
  • Background Color
  • Transparency


 
Lock aspects
This feature is used to lock the proportion of the visual. If we resize the mouse, we will find our visual in the same proportion.

 
Border
As the name suggests, this option is used to apply border element around Power BI visual. We can also change the color property using this option.

 
Conclusion
This is how we can set Stacked Bar Chart in Power BI. In next part, we will talk about Stacked Column Chart in deep manner.
Hope, you loved this article!

Comments

Popular posts from this blog

How to partition or split DataTable in C#?

Today we will discuss how we can divide or split a very large data table into fixed size of chunks? Scenario: Suppose there is a data table which has 1000 Rows. When you perform for each loop on data table and read each row at that time it will take too much time. If we devide 1000 Rows datatable into 10 fixed sizes (e.g. 100 Rows) datatable, It will take less time. Let's check how to achieve it. Here is a code. private static List<DataTable> SplitTable(DataTable originalTable, int batchSize) { List<DataTable> tables = new List<DataTable>(); int i = 0; int j = 1; DataTable newDt = originalTable.Clone(); newDt.TableName = "Table_" + j; newDt.Clear(); foreach (DataRow row in originalTable.Rows) { DataRow newRow = newDt.NewRow(); newRow.ItemArray = row.ItemArray; newDt.Rows.Add(newRow); i++; if (i == batchSize) ...

How To Lock Objects In Power BI

Overview Sometimes, there is a situation where when we open a report and click on any visual it accidentally nudges a chart a little bit to the right or left. Sometimes, by mistake when viewing a report, the arrangement of visuals scatters a little bit. Microsoft rolls out one new amazing feature to resolve this issue, that is, Lock Objects in Power BI. Advantages of using this feature When our purpose is to only view a report, this feature is a boon for us. Visualization’s position is not changed. Saves a lot of the developer's time to resolve the position related issues. Note   -  This feature is not saved with the report. So, every time you open a report, you need to enable this feature. Now, let’s understand this feature in a brief manner. To understand this, I will first show you one report in which I have not enabled “Lock Objects” feature. Step 1 The below screenshot shows my report which doesn’t have the enabled Lock Objects feature. ...

Create Event Calendar In Power BI

Overview In this article, we will learn how we can create Event Calendar within Power BI. We have a requirement from many of my clients to show Events within the Calendar by Category Colors. In order to achieve that requirement, we can use the custom visual from the marketplace which is “ Calendar by MAQ Software ”. You can directly download it using   URL . At the end of the article, you are able to create Event Calendar as shown in the following screenshot. We have the following data to be shown in the event Calendar. Event Start Date Event End Date Description Category   For your practice, you can download sample data source file and Power BI file using   GitHub . Let’s get started! Step 1 Import “ Calendar by MAQ Software ” from Marketplace or download using the   URL . Once it is imported we can see the visual in visualization pane. Step 2 Drag the “ Calendar by MAQ Software ” visual and set the following property. ...