1 Reply Latest reply on Feb 24, 2012 6:41 PM by Jonathan Drummey

    Change (select) the dimension using the same graph

    Gabriel Gejman

      Hi, I'm looking for a way to select the dimension that is showing some data based on the same graph. For example if I have Sales I want to be able to have the user select if they want to see it by week or by day of the week or by time in the same graph without using hierarchies.


      The idea is not that the user drills-down to the desired hierarchy but to be able to see the same period that is being presented using different dimensions.


      Thanks for your help on this!

        • 1. Re: Change (select) the dimension using the same graph
          Jonathan Drummey

          Step 1: Create a parameter whose values are human-readable names

          Step 2: Show the paramet control

          Step 3: Create a calculated field that is either an IF/THEN or CASE statement for where each value of the parameter returns a different variable. For example:


          CASE [MyParameter]

          WHEN "Sales" THEN SUM([Sales])

          WHEN "Profit" THEN SUM([Profit])



          For time dimensions, you can use the different date functions to generate the right values.


          Step 4: Put the calculated field on the columns or rows shelf.


          A couple things to keep in mind with this method:


          - It can significantly slow down your view, since Tableau has to recalculate & redraw it every time the user clicks on a different option. In addition, since Tableau has to recalculate every time if the view is particularly complex and takes more than a couple seconds to run  it can make the interface feel very slow. I had a view I used this technique with to reduce the number of worksheets and I ended up going back to haveing separate worksheets because Tableau could cache each of them and run faster.


          - If you have a default sort set up in the view, as soon as a user does their own sort the default sort is gone and unless the sorted measures are in the view they can't get the default sort back. This can effectively make some more complicated views not very usable.