Matt Masson and Theresa Palmer gave an excellent presentation on Power Query and M for the PASS DW/BI Virtual Chapter a few days ago (hopefully it will be on their YouTube channel soon). One thing that they showed which I hadn’t seen before was that you can display help for a function in M’s built in library simply by typing its name in the formula bar.
Take, for example, the Text.Replace() function. With a new blank query, if you create a step with the following definition:
You will see help and examples as shown below:
By doing this you are creating a step that returns the function itself – note that this is not the same as invoking the function, although it does mean you can invoke the function in a subsequent step. If you do decide to use the function you just need to click Invoke and a dialog will appear to prompt you for the values to pass to the function:
Clicking OK will show the output of the function:
Here’s the full M code for the query for those of you who are curious:
Source = Text.Replace,
InvokedSource = Source("the cat sat on the mat", "cat", "dog")
A very useful tip! Unfortunately you can’t specify help text for your own functions yet, although Matt did say it was something they wanted to do.