Lead magnet - project 1.png
  • Bernard

How to add comments to your Tableau calculated fields


Adding comments to Tableau calculated fields

Have you ever re-visited some of your old dashboards in the name of revising them, or attempted to update dashboards authored by other experts - only to find the calculations incomprehensible. This mostly is so - because the calculations lacked comments.

And we use comments to help others understand our calculations by explaining how they are made or mean.

And in this short article am going to share two ways you can add comments to your calculations – so to make them user friendly and generally professional.

Using double-forward-slash (//) to add one-line comments

One of the ways to add comments is using the double-forward slash (//) before your calculation to add single-line comments. Note: adding this double-forward slash will render that piece of text in gray color and therefore will be ignored in the actual calculation.

See in the example below, where I have used double-forward slash to explain the calculation.

Adding comments in tableau calculations using double forward slash

Adding multi-line comments (/*………*/)

Available from Tableau 2020.4, you can add multi-line comments by adding a /* at the start of your comment and close it with a */.

See in the example below, where I have added multi-line comments to explain more about the calculation.

Adding multiline comments in Tableau calculations

Conclusion

Comments are simple items to implement in your Tableau calculations, yet most of us tend to ignore them and later-on find ourselves in deep problems when updating old dashboards.

With this simple guide and reminder, lets normalize using comments in all Tableau calculations for the greater good of everyone.

Thank you for reading.