This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hi all,
I have a list of list like this:
Each list is composed by a table and a string, like this:
I want to write an M function that, for each list of the first photo, create a new table in the data model and give her name like the string in the list. For example, with the list above i want to create the new table with name "AZIENDA_GERARCHIA_010". I loop on each list with this code that is working fine:
Output = List.Transform(ListOfTables , each createTable(_))
The code of my createTable function is:
createTable = (l as list) => (
let
tableHierarchy = l{0},
nameTableHierarchy = l{1},
newTable = Table.FromRecords(Table.ToRecords(tableHierarchy))
in
newTable
)
But when i call createTable function, it create a new Source in the scope of the script! Not in my Data Model on Power Bi!
Instead, if i call createTable from button "Invoke", it creates a new table in the Data Model for each time i press on "Invoke".
My questions are:
Hello @Anonymous
I think there is no possibility to create with one query more tables, because one query can only have one result in form of a table. Also there is no possibility to change the query name within M
All the best
Jimmy
let
manyTabs = List.Transform({1..9}, each Table.FromValue(_)),
manyNames=List.Transform({"1".."9"}, each "tab"&_)
in
Record.FromList(manyTabs,manyNames)
@Anonymous I don't understand the solution, can you show me the content of the table tabs?
I don't know if this is a solution of your problem.
It is only a record having a list of key and as correnspondent values a list of tables.
@Jimmy801 ok but why when i call the same function with the button invoke it creates a new table?
just a guess,
may be this
Function.Invoke(function as function, args as list) as any
could makes what you want
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 |