Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Create multiple queries from a single query

Hi all,

I have managed to create a Query with a list of different tables (See image). 

This list of tables will get bigger over time. 

 

For each Source I would like to expand the table DATA in a new query and name the query based on the Source value (See image below for example)

 

Is there a way to automate these steps? I want to knip the process of creating a reference query from INPUT_Tables, renaming the query, filtering the Source by the desired value and expanding the table DATA each time a new record gets added into INPUT_Tables.

Your help is verry much appreciated.

 

Kind Regards,

Stefan 

 




3 Replies

  • edhans's avatar
    edhans
    Community Champion

    Not to my knowledge. Power Query cannot create queries, rename them, delete them, or even identify them. THat is all "above" the layer of the M language. If all of those tables are the same format, you can use the Combine feature to bring them all in at once. But if they are not, and need to be brought in as separate queries with their own formatting, you will have to do as you explained. and then apply the relevant transformation steps if necessary.

    I do not think it is supported, but you could conceivably do this with C scripts in Tabular Editor if you could get T/E to know the names of the tables, but I'm not sure how you could successfully pass that info to T/E, so I'm still thinking no.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Edhans,


    That is unfortunate to hear, but thanks for taking the time to help me. 

    Regards, Stefan

     

  • Would love to see the solution for this. I have the same problem and it seems like it would be a pretty popular situation.