Forum Discussion

chriswragge's avatar
chriswragge
Helper I
8 years ago
Solved

Create multiple tables from single query

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!

2 Replies