How to change the Orientation of the Pie chart in Tableau with Parameters

Vignesh Suresh
3 min readMay 6, 2023

With a little help from ChatGPT and research, I am here to show you how to change the Orientation of the Pie chart in Tableau with Parameters

Create a parameter

  • Create Parameter. Name the parameter “Rotation Parameter.”
  • Set the data type to “String” and write 2 values ‘Rotate Left’ and ‘Rotate Right’. Click “OK” to create the parameter.

Create a calculated field:

  • Create Calculated Field. Name the calculated field “Rotate to Left.” and write the formula

(360+[Sales] * 360) % 360

In general, the expression (360 +[Sales] * 360) calculates the sum of 360 and the product of [Sales]and 360. The % symbol represents the modulo operator, which calculates the remainder after dividing the left operand by the right operand. In this case, it is calculating the remainder when the sum is divided by 360.

  • Create Calculated Field. Name the calculated field “Rotate to Right.” and write the formula

(360 -[Sales] * 360) % 360

In general, the expression (360 -[Sales] * 360) calculates the difference between 360 and the product of [Sales] and 360. The % symbol represents the modulo operator, which calculates the remainder after dividing the left operand by the right operand. In this case, it is calculating the remainder when the sum is divided by 360.

  • Create Calculated Field. Name the calculated field “Rotations” and write the formula

CASE [Rotation Parameter]
WHEN ‘Rotate Right’ THEN [Rotate to Right]
WHEN ‘Rotate Left’ THEN [Rotate to Left]
END

Let’s build our Visualization.

Choose the Mark as Pie

  • Drag Segment to Color and Label. Drag Sales to Label.
  • Drag the “Rotations” calculated field to the Angle.
  • Drag the Sales to Detail. Right, click -> Quick Table Calculation -> Percent of Total. Drag the same to Label. If it goes well, it should look as shown below
  • On the Tableau canvas, you will see the Rotation Parameter parameter control. Try changing the options and it will look as shown below

Thank you for reading. Connect with me on Twitter and LinkedIn, and check out my Tableau Public profile for more visualizations.

Vignesh Suresh

--

--