Introduction
What are ad-hoc calculations? Ad-hoc calculations are calculations that you can create and update as you work with a field on a shelf in the view. They are also known as type-in or in-line calculations.
A good example of ad-hoc calculation is in the example below computing the Profit Ratio.
(Note, the above ad-hoc calculation computes the Profit Ratio, without the need of creating a new field in the data pane)
Note, executing this assigns the functions used in the calculation as the name of the calculation, see below.
Quick way to rename ad-hoc calculations.
A quick way to rename ad-hoc calculations is by using multi-line ad-hoc calculations.
Multi-line ad-hoc calculations are created by typing the first part of your calculation, in this case the name assigned to the calculation e.g., //Profit Ratio then press SHIFT+ENTER to open a new line where you can type the calculation itself e.g., SUM([Profit])/SUM([Sales])
How do you do it?
Double-click on an empty shelf to create your ad-hoc calculation.
Use double forward slashes “//” followed by your desired name e.g., //Profit Ratio
Press SHIFT+ENTER to open a new line.
On the new line, type your calculation e.g., SUM([Profit])/SUM([Sales]), and press enter to commit the calculation.
Note, the ad-hoc calculation is automatically renamed as ‘Profit Ratio’ as you can see in the view below.
I hope this article was helpful to you. If you wish to receive more Tableau tips and tricks, kindly join our mailing list by subscribing below.
If you like the work we do and would like to work with us, drop us an email on our contacts page and we’ll reach out!
Thank you for reading!