Swapping two fields within a view

by Valerija Kirjackaja

Most of us are probably familiar with the ‘swap columns and rows’ button in Tableau which comes in very handy when you don’t know in advance what orientation you want your chart to take.

Today, I learnt that there is a way to swap two fields which are already used in the view without changing the orientation of the chart. This function works with both dimensions and measures and all you need to do is hold down the CTRL key to select the two fields you’d like to swap, right-click on one of them, and select ‘Swap’ from the dropdown list.

I have built a simple chart using the Sample Superstore data which shows the yearly sales for each segment, split up by region using different colours.

If I now wanted to change the view to have regions as column headers instead and segment on colour, I could easily do it by using the swap trick.

This also works when we want to swap two fields on the Marks Card. Below is a map a built using the same Superstore dataset, with the size of the circle indicating the sum of sales per state and the colour showing the average discount. Depending on what we’d like to emphasise, we might want to swap the two measures.

Avatar

Valerija Kirjackaja