Forum Discussion

Bertrand_fr's avatar
Bertrand_fr
Regular Visitor
8 years ago

How to read SQL requests in an Excel file?

Hi everybody,

 

Is there a way in Power BI to read SQL requests in an Excel file and then to dynamically execute them and get the results ?

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Yes, with M, you can iterate over a series of queries and pass those into the Sql.Database() function in the query parameter. Although, if you do this, they'll all be in one "set", so you'll have to decide if you're going to append them or split them out into separate queries.

     

     

     

    • Bertrand_fr's avatar
      Bertrand_fr
      Regular Visitor

      Hi SonnChilds,

       

      Thanks a lot for this detailed explanation, works great!

      Now I'm trying to find where is the result set?

      How can I use it?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Each result set resides in that "Table" value with the yellow text. Try clicking on the word "Table", and you'll add a step navigating to that result set. Alternatively, you can use the split arrows at the top of that column to expand out the tables, but only do this if all of your result sets are of the same structure (i.e. a union).