Chris Webb shows how to take a parameterized query in Power BI and create an M function from it:
All of these examples involve writing M code manually. The big change in the latest version of Power BI Desktop is that you can do the same thing using just the UI.
Let’s take the classic example of combining data from multiple Excel workbooks and update it to show how things work now.
Say you have a folder containing three Excel workbooks containing sales data for January, February and March and you want to load data from all three into a single table into Power BI. The first thing to do is to create a new parameter in Power BI Desktop that returns the filename, including path, of one of the Excel files. Call it ExcelFilePath and configure it as shown here:
This is pretty cool.