Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a Folder Source with a bunch of CSVs that goes into this folder automatically, but inside Power BI I just want to load the newest CSVs, where newsest = Today - 30 days. How can I do that? The column Date corresponds to the "Creation date" of the CSV.
Solved! Go to Solution.
Nice, using your answer as foundation, I found an even easier solution:
#"Filtered Rows" = Table.SelectRows(Source, each Date.IsInPreviousNDays([Date created], 30) or Date.IsInCurrentDay([Date created]))
Hi,
You need to load all the CSVs which are created within the last 30 days.
Or only one CSV which has been created exactly 30 days before Today ?
The folder will have all the CSVs since forever, but inside Power BI I just want to load and work with the CSVs which were created inside the frame "today - 30 days".
This is where I can filter, but I don't know how to express "today - 30 days" or something with the same effect in there.
You could use the 'is in the previous' menu with 30 days as a parameter. This will however not consider the csv of 'Today'.
Copy paste this code in the advanced editor (M) and adapt it to your need (update the source path).
let
Source = Folder.Files("YourSourcePath"),
DatesFlag = Table.AddColumn(Source, "Flag", each [Date created] <= DateTime.LocalNow() and [Date created] >= Date.AddDays(DateTime.LocalNow(),-30)),
KeepLast30Days = Table.SelectRows(DatesFlag, each ([Flag] = true))
in
KeepLast30Days
You can then peacefully combine the binaries (Column 'Content').
Nice, using your answer as foundation, I found an even easier solution:
#"Filtered Rows" = Table.SelectRows(Source, each Date.IsInPreviousNDays([Date created], 30) or Date.IsInCurrentDay([Date created]))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |