This is a quick tutorial on how to analyse M-functions step-by-step.
Queries, that have been transformed into a function (1) can be invoked in the query-editor (2) and they will then return their output for you to check (3). But they will not show you how they did it. In the query-editor where you normally see the single steps and their individual output if you click on them, you will just see one line for the function and one for the invocation (4):
So how can we make them reveal all their secrets for us to see the quickest way?
Yes, we could edit the code and replace every parameter that has been passed. But this can get a bit tedious, especially if you haven’t written the code by yourself and don’t know where and how often the parameters are used. A very quick and safe way is to replicate the parameters within the let-expression by copy-&pasting like this:
That way you just define them once and don’t have to care about how often they are used within the following query. And it is very quick to do as you can just copy the parameter-expression and comma-separate your inputs.
I bet you want to check this out on Chris Webb’s latest blogpost here: DynamicDateSelections.zip
Enjoy & stay queryious 🙂
In Chris Webb’s LIKE Blog (https://blog.crossjoin.co.uk/2014/05/27/implementing-a-basic-likewildcard-search-function-in-power-query/#comment-30055), he recurses his function, PhraseFind. Tracking recursed arguments is difficult. Any suggestions?
Cannot think of a way to achieve that with recursion. You would need to use List.Generate instead.