Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hi there,
I have 20 differing queries all essentially referencing the same basic code.
= #"Base Code - New"(startDateNew, endDateNew, "at")
"Base Code - New" is a function that takes in 3 vars. startDateNew and endDateNew are parameters, and the last var is a country code that changes. This means that I have 20 queries, all with a different 3rd var.
e.g.
= #"Base Code - New"(startDateNew, endDateNew, "be")
= #"Base Code - New"(startDateNew, endDateNew, "ca")
and so on...
What I would like to do is combine these 20 queries into a single query in order to simplifiy my code. Is this possible?
Note - All queries produce the same column headers and data types
Bonus points: Even though this post title doesn't explicitely state it, an even better solution (my next question) would be how to union all of these tables into a single table through the query editor. This way I would would have one query producing one table from 20 different sources via a function.
Thanks!
Solved! Go to Solution.
Sorry Xiaoxin - duplicate post that I cannot delete now. Please see this link for my accepted solution
https://community.powerbi.com/t5/Desktop/Create-multiple-tables-from-single-query/td-p/412254
HI @chriswragge,
I"d like to suggest you create a table to store parameters, then add custom column to invoke and store result tables from custom function.
After these steps, use Table.Combine function to merge tables from above result table list.
Reference links:
Creating Tables In Power BI/Power Query M Code Using #table()
Regards,
Xiaoxin Sheng
Sorry Xiaoxin - duplicate post that I cannot delete now. Please see this link for my accepted solution
https://community.powerbi.com/t5/Desktop/Create-multiple-tables-from-single-query/td-p/412254
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 22 | |
| 21 | |
| 21 | |
| 20 | |
| 13 |
| User | Count |
|---|---|
| 59 | |
| 53 | |
| 40 | |
| 31 | |
| 26 |