1 Reply Latest reply on Sep 5, 2013 7:21 AM by Jim Wahl

    Dynamic Sort Across Two Sheets

    David Vale



      I've trawled the forums for an answer to this question but have not been able to fine one. So my apologies if subject has already been covered.


      I have two sheets on a dashboard, the one above is a table, the one below is a line graph showing the same data as the sheet above. What I'd like to happen is that if I sort a row on the graph by clicking on it's title, the corresponding row in the table above is sorted in the same way.


      As you can see from the attached the Disposals % row in both graph and table are sorted in the same way, this was done manually by clicking on each row title individually.


      How can I achieve the same result but by just clicking on one of the rows, and have both sheets sort.


      Thanks for your help,


        • 1. Re: Dynamic Sort Across Two Sheets
          Jim Wahl

          Hi David,

          I can think of two approaches: An easy one and a difficult one.


          Below is a draft of the easy approach, using the Superstore data set with the Customer Segment dimension for columns and Shipping Cost and Unit Price for measure values rows.

          2013-09-05 17-05-32.png


          On the top left of the graph you'll see a Sort by field, which is parameter with a list of the measures (adding using a floating dashboard element). This is used to create a calculated field Sort Order =

          IF     [Sort by] == "Shipping Cost" THEN SUM([Shipping Cost])
          ELSEIF [Sort by] == "Unit Price" THEN AVG([Unit Price])


          After adding this field, right-click on it and select Convert to Discrete. Now drag it to the Columns header, just to the left Customer Segment. Click on this pill and deselect Show Headers. Since this is a blue, discrete pill, Tableau will create a new set of panes with, by default, borders around those panes. This is most obvious on the bar chart. From the top menu, click Format > Borders > Columns and move the Level slider at the bottom of the format pane to the left. The panes also break the line chart, but perhaps a bar chart woks as well, if not better.


          Note that another approach is to set the sort order in Customer Segment to be this field. The problem is that users can override the specified sort order by clicking on the fields and then the sort orders will no longer be consistent across sheets (there is no way to disable the sort icon -- you can vote for it here: http://community.tableau.com/ideas/1094).


          The Difficult Option

          I think there's a way to do this without parameters using table calcs to determine the user-selected sort order, but it won't be easy to implement or maintain. If you can live with a parameter, the easy, parameter-based solutions is what I'd go with.