Forum Discussion

Wani_Muneer's avatar
Wani_Muneer
Icon for Helper I rankHelper I
3 years ago
Solved

Load multiple tables using query

using power  query  how can we load multiple tables from Database starting with  'A' 

  • Anonymous's avatar
    Anonymous
    3 years ago

    The simpliest way it two create Query that connects to the Database, then filter text.  

    let
        Source = Sql.Databases("Server", "Database"),
        #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Item], "a") or Text.StartsWith([Item], "A"))
    in
        #"Filtered Rows"

    You will be left with a list of tables starting with a or A.  Note Power Query is case sensitive.

     

    Next you can use the "Add as New Query" to open each table separately and load them to Power BI.

     

     

    Otherwise you might try the search feature in the Navigator Screen when connecting to the database.  But this more of a wildcard search than start with, and would include the schema table as well.

     

     

  • Anonymous But at the first step it is loading the whole database like functions, procs, and tables and it might break the power bi file. But my problem is that I wanted to only load filtered table not full database. 

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Wani_Muneer - yes, but it depends what you mean by load.  Do you want to load each one separately or do you want to combine these tables into a single table?

    • Anonymous's avatar
      Anonymous
      Not applicable

      The simpliest way it two create Query that connects to the Database, then filter text.  

      let
          Source = Sql.Databases("Server", "Database"),
          #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Item], "a") or Text.StartsWith([Item], "A"))
      in
          #"Filtered Rows"

      You will be left with a list of tables starting with a or A.  Note Power Query is case sensitive.

       

      Next you can use the "Add as New Query" to open each table separately and load them to Power BI.

       

       

      Otherwise you might try the search feature in the Navigator Screen when connecting to the database.  But this more of a wildcard search than start with, and would include the schema table as well.

       

       

      • Wani_Muneer's avatar
        Wani_Muneer
        Icon for Helper I rankHelper I

        Anonymous But at the first step it is loading the whole database like functions, procs, and tables and it might break the power bi file. But my problem is that I wanted to only load filtered table not full database.