# Ex4# Bar and Column Charts in Power BI

### Introduction

Bar and column charts are some of the most widely used visualization charts in Power BI. They can be used for one or multiple categories. Both these chart types represent data with rectangular bars, where the size of the bar is proportional to the magnitude of data values.

The difference between the two is that if the rectangles are stacked horizontally, it is called a bar chart. If the rectangles are vertically aligned, it is called a column chart. This guide will demonstrate how to build bar and column charts in Power BI Desktop.

### Data

In this guide, you will work with a fictitious data set of bank loan disbursal across years. The data contains 3,000 observations and 17 variables. You can download the datase&#x74;**.** The major variables are described below:

1. `Date`: Loan disbursal date.
2. `Loan_disbursed`: Loan amount (in US dollars) disbursed by the bank.
3. `Gender`: Whether the applicant is female (F) or male (M).
4. `Purpose`: Purpose for which loan was taken.

Start by loading the data.

### Loading Data

Once you open your Power BI Desktop, the following output is displayed.

![b1](https://pluralsight2.imgix.net/guides/16c4cce1-5d1e-4c00-a4c0-34ee7dd58ccb_b1.png)

Click on **Get data** option and select **Excel** from the options.

![b2](https://pluralsight2.imgix.net/guides/044933be-9a35-4730-8384-d3c1eb1850cb_b2.png)

Browse to the location of the file and select it. The name of the file is **BIdata.xlsx**, and the sheet you will load is **BIData** sheet. The preview of the data is shown, and once you are satisfied that you are loading the right file, click **Load**.

![b3](https://pluralsight2.imgix.net/guides/0b295b3c-a9d4-4d8b-aea7-d84d9c14f75b_b3.png)

You have loaded the file, and you can save the dashboard. It is named **PowerBI Visualization**. The **Fields** pane contains the variables of the data.

![b4](https://pluralsight2.imgix.net/guides/7e56fe50-9d78-42b5-b82e-7ee3cdf26a86_b4.png)

### Column Chart

To begin, click on the *Clustered column chart* located in the **Visualizations** pane. This creates a chart box in the canvas. Nothing is displayed because haven't yet added the required visualization arguments.

![bc1](https://pluralsight2.imgix.net/guides/a0c6e06e-a5d0-454a-aad6-15d739dcc1a8_bc1.png)

You can resize the chart on the canvas. The next step is to fill the visualization arguments under the **Fields** option as shown below. Drag the variable `Purpose` into the **Axis** field, and `Loan_disbursed` in the **Values** field.

![bc2](https://pluralsight2.imgix.net/guides/4b019bb1-9699-4bcc-920a-5e73e3312e5e_bc2.png)

The output above shows the **Loan\_disbursed by Purpose** chart. You can format the chart under the **Format** tab. For example, if you want to add values to the chart, turn on the **Data labels**.

![bc3](https://pluralsight2.imgix.net/guides/f839687e-0e04-425a-b69f-8687cb70bf05_bc3.png)

You can also increase the size of the **X axis** labels. Set the **Text size** to 12.

![bc4](https://pluralsight2.imgix.net/guides/db9c2a5e-8894-46e1-a803-405e29faae6b_bc4.png)

You can also adjust the title of the chart. Go to **Title**, and change the **Font color**, **Alignment**, and **Text size** arguments as shown below or as per your preference.

![bc5](https://pluralsight2.imgix.net/guides/f96f26e4-4007-4175-8b70-caeac04bb957_bc5.png)

After making these changes, you will have the following column chart.

![bc6](https://pluralsight2.imgix.net/guides/453ea4b1-1a29-4824-bde9-c36e9a00b6eb_bc6.png)

#### Clustered Column Chart

A clustered column charts is a type of column chart in which you compare two values side by side. In this case, you will compare the `Loan_disbursed` values against two categories, `Purpose` and `Gender`.

It is easy to make a clustered column chart by adding `Gender` in the **Legend** position of the previous column chart.

![bc7](https://pluralsight2.imgix.net/guides/61860090-84e8-408d-8319-56f3e03a204a_bc7variant1.png)

### Bar Chart

If you have the column chart in the canvas, it is easy to convert it into a bar chart. Below is the **Loan\_disbursed by Purpose** chart you created above.

![bc9](https://pluralsight2.imgix.net/guides/dac4eabe-a548-4329-af1e-dc10b1666a69_bc9.png)

Locate the **Clustered bar chart** option in the **Visualizations** pane as shown above, and click on it. This will convert the column chart into a bar chart.

![bc10](https://pluralsight2.imgix.net/guides/23e6154f-ddaa-4d78-8c26-0e7d9ea2fabb_bc10.png)

#### Clustered Bar Chart

To create a clustered bar chart, drag the `Gender` variable into the **Legend** option.

![bc11](https://pluralsight2.imgix.net/guides/131ee59f-f821-4db2-992f-6a25f24f25a0_bc11variant1.png)

### Conclusion

Bar and column charts are used regularly in visualization to compare two or more values. In business intelligence, you will be required to build these charts for a variety of areas, such as finance, sales, marketing, production planning, geographical coverage, time series analysis, and many more. This is a great skill set to add because you will be using it regularly across sectors and organizational functions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nishanthkp.gitbook.io/power-bi-tutorials/power-bi/ex4-bar-and-column-charts-in-power-bi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
