Forum Discussion

adriannabell's avatar
adriannabell
Regular Visitor
4 years ago
Solved

Is it possible to perform a SQL select statement against an existing Power BI Query?

Disclaimer:  I am not a SQL developer and I am fairly new to Power BI but I'm trying to do something and I'm not sure it is even possible. ðŸ˜€   Query1 is data from a very LARGE database.  I am curr...
  • v-yingjl's avatar
    v-yingjl
    4 years ago

    Hi adriannabell ,

    You can try to clear the query and re-write it like this:

    let
    
    Source=Excel.Workbook(File.Contents("I:\ITS_Reference_Documentation\Manager Reference\ITS-AUs.xlsx"), null, true),
    
    Table1_Table=Source{[Item="Table1",Kind="Table"]}[Data],
    
    #"Changed Type"=Table.TransformColumnTypes(Table1_Table,{{"AU Number",Int64.Type}}),
    
    Custom1 = "" & Text.Combine(List.Distinct(#"Changed Type"[AU Number]),"','") &"",
    
    SQL_Data=Sql.Database("Servername","databasename",
    
    [Query="SELECT * from HR_Base WHERE AU In ("&Custom&")"])
    
    in
    
    SQL_Data

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.