Forum Discussion
Power BI - loading multiple sources to one query
This is an old thread, but I think this was not properly replied.
The syntax let ... in ... is similar to a variable definition. After the let, you define expressions that can refer to each other and that will be used to compute the expression after the "in".
Several loading of sources can be included after the "let", this is perfectly allowed. It is to be noted also that the word "Source" has no special meaning in M language. Feel free to replace it.
As far as M (the language of Power Query), a code like this will perfectly work (but will completely confuse the GUI editor):
let
Data = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
MoreData = Excel.CurrentWorkbook(){[Name="Table2"]}[Content]
in
Table.Combine({Data, MoreData})
I define two expressions "Data" and "MoreData" that will each load a table and combine them after the in statement.
The GUI expects only a variable name after the in and will not interpret the different steps.
This would be GUI-friendly:
let
Data = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
MoreData = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
AllData = Table.Combine({Data, MoreData})
in
AllData
l
Hope this can clear some misconceptions for other users.