Forum Discussion

NancySharma's avatar
NancySharma
Regular Visitor
8 years ago

Way to query data using SQL and csv file

I want to query my sql database based on some fields in csv file. 

 

When i connect to query can i use the query to connect this way for example.

 

SELECT Column1

      ,Column2

      ,Column3

FROM myDB1.TableName OU

WHERE OU.Column1 IN (

SELECT id FROM  Source = Csv.Document

WHERE CSVColumnName IN (“product”, “abc”));

 

11 Replies

    • NancySharma's avatar
      NancySharma
      Regular Visitor

      Hi Phil,

       

      I am new to Power BI,

       

      What i see is that you made changes to data on Power BI. What i want is that i get prefiltered data from sql based on filter in CSV file so that only needed data gets loaded in power BI.

       

      Reason is when i try to form joins and filter data in power BI, it takes a lot of time when i refresh my CSV file, it has like million records. So what i am looking for is  i get prefiltered data uploaded to BI based on CSV filer that i can put in query.

      • Phil_Seamark's avatar
        Phil_Seamark
        Microsoft Employee

        Hi NancySharma

         

        All the work should be done in Power Query (which sits before Power BI).  You can query your CSV file and you will have to read all of it.  Then in Power Query, you can generate a list values from the CSV file that you are interested in and finally use that list inside your T-SQL query statement in the WHERE clause.