Forum Discussion

kaye123's avatar
kaye123
Frequent Visitor
3 years ago
Solved

SQL Statement to limit Data import

I have this sql server with 5 database that contains millions of rows and it slows down the data IMPORT. I would like to import the data direct from the source with already limited data from the past...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi kaye123 ,

     

    I don't know what you are using the query language, so I will write an example in MSSQL for you to get the last 5 years. I recommend that you get the data by filtering it on the sql side.

    select * from table_name where FY>=YEAR(GETDATE())-5

     

    but if you want to get all the data then you have to add the following step to the data having the Power Query side

     

     

    = Table.SelectRows(#"Changed Type", each [FY] >= Date.Year(DateTime.LocalNow())-5)

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


    Best regards ğŸ™‚