Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sort by any measure in a Tableau table

Tags:

tableau-api

I've built a new worksheet that has two dimensions and several facts. When I try to sort on any column, it only seems to sort within the dimensions. Is it possible to sort based on the column, ignoring dimensions? I find if I concatenate the two dimensions into one... that does work, but is not ideal.

enter image description here

like image 321
corycorycory Avatar asked Jan 04 '23 06:01

corycorycory


1 Answers

Ah yes, sorting in Tableau. Took me a long time to understand it. It doesn't do sorting the way you would expect in other tools like Excel. This is because it's grouping dimensions from left to right. Think of each dimension getting nested inside the one to the left of it. Another way to think of it is that Tableau doesn't sort measures, it sorts dimensions based on some value a measure. That's why concatenating dimensions will yield the expected result, because you have just one calculated dimension and that dimension gets sorted by the value of a measure. You can right click on the concatenated dimension in your Rows shelf and choose Show Header. That's probably your best bet.

See this article from The Information Lab on the sorting in Tableau: https://www.theinformationlab.co.uk/2014/11/03/understanding-sorting-tableau/

There are some Tableau Community posts about it too. https://community.tableau.com/thread/118958 https://community.tableau.com/thread/221956 https://community.tableau.com/thread/164714

like image 199
Sam M Avatar answered Jan 28 '23 17:01

Sam M