Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 48 | |
| 43 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 198 | |
| 126 | |
| 102 | |
| 67 | |
| 50 |