The June release of Power BI Desktop has what seems to be a fairly unremarkable new feature in that it allows you to add descriptions to each step in a query in the Query Editor window. However the implementation turns out to be a lot more interesting than you might expect: the step descriptions become comments in the M code, and even better if you write M code in the Advanced Editor window your comments appear as descriptions in the Applied Steps pane.
Take the following M query, entered in the Advanced Editor, as an example:
let Step1 = 5, Step2 = 10, Step3 = Step1 * Step2 in Step3
There are three variables declared in the let expression which appear as three steps in the Applied Steps pane. The first two steps declare integers and the third multiplies these two integers together, returning 50.
If you right-click on the first step and select Properties, then you can enter a description for the step in the Properties pane that appears:
After you click OK, the description is visible as a tooltip when you mouse-over the step:
If you then open the Advanced Editor window you’ll see the M code for the query has now been changed to include a comment (NB comments in M code start with //):
let // Declare the first number Step1 = 5, Step2 = 10, Step3 = Step1 * Step2 in Step3
If you then edit the M code in the Advanced Editor window to add a comment in the line before a step, like so:
let // Declare the first number Step1 = 5, Step2 = 10, // Multiple the two numbers together Step3 = Step1 * Step2 in Step3
…then this will also show up as a description when you mouse-over the step in the Applied Steps pane:
As a result, for anyone like me who writes a lot of M code manually in the Advanced Editor window, this turns out to be a really handy feature.