Forum Discussion
shamilka
2 years agoFrequent Visitor
Getting only the latest database data instead of downloading the whole table in the beggining
Hi All, I'm using the following code to load the data to Power BI. Since my filteration at the the next step of the code, it will download the whole table. I want to download only the latest dat...
- Anonymous2 years ago
Hi shamilka ,
I will use SQL Server as datasource for an example:
Sample data (Today is 2024.8.20):When connecting to SQL Server:
Here is the SQL Code in the SQL statement:
select * from Table_4 where date <= CAST(GETDATE() as date) AND date >= DATEADD(DAY, -15, CAST(GETDATE() as date));And the final output is as below:
Here is the M code in Advanced Editor:let Source = Sql.Database("DM1", "Import", [Query="select * from Table_4 where date <= CAST(GETDATE() as date) AND date >= DATEADD(DAY, -15, CAST(GETDATE() as date));"]) in SourceBest Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ahadkarimi
Solution Specialist
2 years agoHey shamilka, could you let me know if the data is being loaded from SQL or ...?
shamilka
2 years agoFrequent Visitor
Hi ahadkarimi,
I'm loading from the database