There’s a few reasons why you’d want to comment on your calculated fields, for example:
- To explain your calculation/code (to make yours and other people’s lives easier)
- To break down the calculation into multiple parts
- To disable parts of your calculation for debugging
In Tableau there are two types of commenting. Single line comments and multi-line comments. Here is how to do it:
Single Line Comment
In order to single line comment, simply add a // to the start of the line and write some text. Note: // doesn’t have to be at the very start of the text box.
You will notice that the text becomes grey, this means that Tableau recognises this as a comment and it will be ignored.
If you decide to make your comment more than one line, Tableau will not like it:
Notice how the text has become black and it is saying that the calculation contains errors. This is not good. To fix this you have to create a multi line comment.
Multi Line Comment
To create a multi line comment you have to put /* at the start of your comment and */at the end of your comment. See below screenshot.
The problem is now fixed (from screenshot 2) and all is good.