Forum Discussion

Newcolator's avatar
Newcolator
Icon for Helper II rankHelper II
2 years ago
Solved

Commenting out first line in DAX

Hi   Is it not possible to add comments at the top of a DAX formula?   I type this:   // same as rejected closed, but returns nulls for missing data so line charts don't show legends for 0 lin...
  • AmiraBedh's avatar
    2 years ago

    In DAX , the standard way to add comments is either using two forward slashes `//` for single-line comments or the `/* */` syntax for multi-line comments. These comments are generally used to explain the code, making it easier to understand its purpose and functionality.

    However, it's important to note that DAX comments are typically not allowed in the names of measures or columns themselves. When you attempt to create a measure and start the definition with a comment, the Power BI or Analysis Services environment might interpret your comment as part of the measure's name if the comment is placed directly above the measure definition without a blank line or is not properly recognized by the editor you're using.

     

    Rejected Closed 2 =
    // put your comment here
    VAR RC = SUM('FACT CLAIM'[closed_rejected_count])
    RETURN RC