3 Replies Latest reply on Jul 1, 2015 1:38 PM by Joe Oppelt

Sorting on Calculated Fields

Hey All,

PFA the worksheet attached. I have a similar kind of problem and I have recreated it using superstore data. I wanted to find the sales of the city when the profit is maximum. I have done that using window_Max calculated field and I am now able to achieve it.

After doing that, I am not able to sort the sales column. Can anybody help me how to sort it based on the sales. I am able to sort by city. But not able to sort by sales.

Any help would be appreciated.

Thanks

• 1. Re: Sorting on Calculated Fields

In Tableau, we sort Dimensions BY a Measure -- so you'd want to Sort your City dimension BY Sales.  However, you are currently displaying Row-level (disaggregated) Sales, and we cannot sort based on non-aggregated measures.

If you instead were displaying SUM(Sales) and were to sort based on that measure, you'd end up with something like:

But I'm not exactly sure what you're hoping to achieve through the Table Calculation filter (or whether it was accomplishing what you hoped it would).  I hope this helps you understand a bit more about Sorting in Tableau -- with awareness of this, and an understanding of what you hope to acheive as an end-result in Tableau, it will enable you to produce the output you need in the view.

http://www.theinformationlab.co.uk/2014/11/03/understanding-sorting-tableau/

Can you mock up and explain your expected results?

1 of 1 people found this helpful
• 2. Re: Sorting on Calculated Fields

Hey Matt,

Thanks for the reply. My kind of problem is, I want to first find out the maximum value of third column(Here profit) and then find the corresponding second column value( here sales). I am able to achieve it. After doing that, I want to sort it using sales.

For eg, from the above submitted worksheet, I will want to sort by 100119.16, 45737.36, 36532........ and their corresponding cities.

Is that not possible here?

Thanks

• 3. Re: Sorting on Calculated Fields

I think you need to create a packaged workbook.  (FILE -> "Extract Packaged Workbook".)  Then upload the .twbx file you get out of that.

But I think your issue is that you want to sort by a table calc.