Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi
Is it not possible to add comments at the top of a DAX formula?
I type this:
Solved! Go to Solution.
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
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
Hi,
Comments before measure names is not supported, you can add it after the measure name, on a new line before the statement:
Hi,
If you want to put a description on a measure you can use the description box on the properties ribbon of model view.
Output:
Or put your description after define the name of your measure, like this:
Proud to be a Super User!
Hello @Newcolator,
Can you please try the following workaround:
1. Start the Formula Normally
Rejected Closed 2 =
VAR RC = SUM('FACT CLAIM'[closed_rejected_count])
RETURN RC
2. Edit the Formula to Add Comments
// same as rejected closed, but returns nulls for missing data so line charts don't show legends for 0 lines
Rejected Closed 2 =
VAR RC = SUM('FACT CLAIM'[closed_rejected_count])
RETURN RC
3. Use Multi-line Comments as an Alternative
/*
same as rejected closed, but returns nulls for missing data so line charts don't show legends for 0 lines
*/
Rejected Closed 2 =
VAR RC = SUM('FACT CLAIM'[closed_rejected_count])
RETURN RC
Hope this helps!
@Newcolator , Yes, seems like not supported before the measure name.
Please log an issue or idea
Issue -https://community.powerbi.com/t5/Issues/idb-p/Issues
Idea - https://ideas.powerbi.com/ideas/
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
86 | |
82 | |
70 | |
49 |
User | Count |
---|---|
143 | |
123 | |
107 | |
61 | |
55 |