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:
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.