# 5 Ways to Make a Bar Chart in Tableau and An Introduction to Aggregation

PreviewInstructor

Ryan Sleeper

- Description
- Transcript Member Only Feature
- Related Content Member Only Feature

### Several ways to make one of the foundational data visualizations

There is always more than one way to do the same thing in Tableau. This is a theme you will hear Ryan often discuss, and it starts with five different ways to make one of his favorite chart types: the bar chart. Also learn the many ways measures can be aggregated in Tableau with just a couple of clicks.

Hi, this is Ryan with Playfair Data TV, and in this video I’m going to show you our first chart type, which is a bar chart, as well as five different ways to make it, as well as provide an introduction to aggregation. Throughout Playfair Data TV, I’m going to be talking in terms of how Tableau determines whether or not you’re able to make a certain chart. In other words, have you met the technical criteria required in order to make a certain visual?

A bar chart is made with zero or more dimensions and one or more measures. So let’s take a look at this bar chart we’ve created. I used this as an example in a previous video when I showed you a measure versus a dimension, and how sometimes a bar chart can work but not provide any context, and that’s what we’re looking at here. Let’s see if we’ve met the technical criteria.

This is a bar chart looking at sales only in the Sample Superstore dataset. So it says, “Bar charts are made with zero or more dimensions.” We’ve got zero. So far, so good. “And one or more measures.”

We’ve got one measure, sales. So we met the technical criteria to make this chart. It’s not telling us anything, but because we had the correct combination of fields, we were able to make this chart.

There are at least five ways to start a bar chart, and I’ll actually jump over to Tableau and show you these. The first is just double-clicking on a measure will start a chart. So if I double-click on the Sales measure, we’ve got our first bar chart.

The default behavior when you double-click on a measure is for Tableau to put that measure onto the rows shelf. Because it’s drawing a row for the Sales measure, we’ve got this y-axis. I could have got to the same exact spot by left-clicking the Sales measure from the Measures area of the data pane and dragging it to the rows shelf. Creates the same chart.

If I would prefer a more horizontal orientation to this vertical orientation, I need to move the Sales measure from the rows shelf to the columns shelf. You can do that by left-clicking on the measure and just dragging it up to the other shelf. Now, Tableau’s drawing a column for the Sales measure, which is giving me this x-axis for sales and providing that more horizontal orientation instead of a vertical orientation.

If you ever want to just flip the orientation, you can also use this one-click button under the word Server in the top navigation called Swap. This will swap whatever’s on the rows shelf with whatever’s on the columns shelf. So if I click it once, sales goes back to rows. Click it again, sales goes back to columns. So there’s four ways.

I’m going to drag this away to show you one more, a fifth way. This is one of the ways that you can use Tableau in the flow of your analysis. You could actually just double-click on the rows shelf and type the name of the measure. So I’ll type sales, click Enter, click Enter again, and that gets sales to the rows shelf and draws a vertical bar chart.

So there were five ways to do it. Another rule of thumb I’ve got for you is there is always more than one way to do the same thing in Tableau. I always say that the correct way is the way that you’re the most comfortable with that gets you the correct result. There’s always more than one way to do it, just showed you five ways to make a bar chart.

And in that spirit, there’s a sixth way to make a bar chart, and this will be an introduction to aggregation. I want to point out that every measure in Tableau, by default, will have some form of aggregation. Notice, on all five ways we just made a bar chart, all of them had these letters preceding the name of our measure sales. SUM, that’s the aggregation of that measure. By default, Tableau is adding up or summing together all the sales values across are 9,994 records to get us this total of $2.3 million, roughly.

I’m going to show you a sixth way to make a bar chart, which will allow you to change the aggregation of that measure before it draws a bar chart. This time, I’m going to right-click on the sales measure. And while I’m holding down the right mouse key, I’m going to drag that measure to the rows shelf and let go. This time, before Tableau draws the bar chart, it’s going to ask me what I want to choose as the aggregation.

These are some examples for you. This is the same aggregation that you’ve probably come across in elementary school math. The data here doesn’t matter too much, but this is just a sample of nine rows of data. If I were to sum those nine values together, I’d end up with 50. If I were to sum up those 9 values and then divide by the number 9 to get the average, I get 5.56.

Median would be as if I sorted those values into either ascending or descending order. It would be the value right in the middle. CNT might be somewhat new to you. That’s short for Count. That’s just a count of the number of values in the record set.

CNTD is short for Count Distinct. We’ve got a count distinct of 6. If your count number is larger than your count D number, that means you’ve got some duplicate values. So this 9 value record set here has 6 unique values and 9 total values.

MIN is short for the word “minimum.” That’s the smallest number in the dataset. MAX is short for “maximum.” That’s the highest number in this data set.

I’ll choose average just to show you a slightly different look. Choose average sales. Click OK. And the average sales is 229.86, very different than our sum, which was 2.3 million.

So this choice will really come down to what analysis you want to do. Sometimes you might want to sum a number. Other times you might want to look at an average, and min, max, median.

You can also change the aggregation for a number that is already on the view. You can do that by clicking into the pill that’s on the view. You can do that by either clicking this down arrow that appears when you hover over the pill or right-clicking on the pill.

In either case, about halfway down, where it says measure, in parentheses will be the aggregation of that measure. When you hover over that, you can choose a different aggregation. So if I wanted to get back to SUM, I could choose SUM. Notice the AVG changed on the pill. Now it’s back to SUM.

Once we’ve got this foundation, I could slice and dice this further by putting a dimension on the view, such as category. And that’s how to make a bar chart in Tableau. Thanks for watching!

Related video: Exercise – Make a Bar Chart in Tableau

Related video: 3 Ways to Make Beautiful Bar Charts in Tableau

Related chapter: *Practical Tableau* – Chapter 8 – Five Ways to Make a Bar Chart / An Introduction to Aggregation

##### Fundamentals Videos

- Tableau’s Product Ecosystem
- Shaping Data for Use with Tableau
- Connecting to Data in Tableau
- Tableau Classification: Measure vs. Dimension
- Tableau Classification: Discrete vs. Continuous
- Getting a Lay of the Land in Tableau
- 5 Things I Do When Working with Data for the First Time
- 5 Ways to Make a Bar Chart in Tableau and An Introduction to Aggregation
- When in Doubt in Tableau Then Right-Click
- Exercise: Make a Bar Chart in Tableau
- An Introduction to the Tableau Marks Shelf / Marks Cards
- Exercise: Bar Chart with Tableau Marks Cards
- Tableau’s Detail Marks Card and Visualization Level of Detail
- How to Make a Line Graph in Tableau
- Exercise: Make a Line Graph with Continuous Quarters in Tableau