Ryan Sleeper
Sorting is a best practice for charts built with discrete fields. In this video, you’ll learn several sort options that will help you create an effective result.
This is Ryan with Playfair Data TV. And in this video, I’m going to give you an introduction to sorting in Tableau.
To get started, I’m going to make a quick chart that looks at sales by customer name.
So I’ve got a measure of sales and it’s breaking down that sales measure by a dimension called Customer Name. Customer Name is on rows, which is why we’ve got a customer name on each row in our data source.
The default sort order, so what we’re looking at here, is called Data Source Order. There’s a couple of simple ways to change the sorting. First two ways I’ll show you are these one-click options under the word Window in the top navigation.
If I click this first button, it will sort these values in ascending order. If I click that, the customer name with the lowest value will be listed first, all the way down to my customer name with the highest value last.
If I click the next button over, this will sort the values in descending order. If I click on that, now we’ve got the customer name with the highest sales value listed first, all the way down to the customer name with the lowest sales value listed last.
I’m going to undo twice to show you one other way to get to those same sort options. If you hover near the top of the chart, you’ll see a similar looking icon appear. This rotates through three different sort orders. So if I click it once, it will move from the default data source order to descending order. If I click it again, it’ll flip to the next order, which is ascending. And if I click it again, it goes back to the default data source order. So it just flips through those three sort orders.
If those aren’t enough for you, you can also click into the pill that you’re trying to sort on and choose the fourth option down for sort.
What we’ve covered so far are ascending, descending, and data source order. You can also sort alphabetically. You can also sort by fields at any aggregation whether or not the fields are on the view, which unlocks some interesting possibilities.
Be very careful with this one because if you do decide to sort by a field that’s not on the view, it will not be clear to your end user how it’s being sorted. So you’ll want to make sure you provide that information in surrounding context.
But essentially, you can sort by just about anything you want. And if you don’t see what you need, you can either even click to sort manually. So you can literally go in through here. There are 793 customer names in the sample superstore data set. You can click one of them and move them up the list.
This probably wouldn’t be a very fun option for you unless you’re getting paid by the hour. But there is a practical purpose for this. This is useful if you ever need to sort your dimension members in a way that is not intuitive to Tableau. If there’s no other way to tell Tableau how to sort the dimension members, you could just sort them manually.
One example that I like to share is if I were the manager of the central region, for example, there may not be an intuitive way to tell Tableau to always put Central on top. Let’s say we always wanted to put our performance on top so that we could then compare ourselves to the rest of the business.
Well, there might not necessarily be an intuitive way to tell Tableau to always put Central on top. But, because we can sort manually, I could just click into the region dimension, click this manual radio button, and always move Central up to the top.
This has been Ryan with Playfair Data TV. Thanks for watching.