Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Greetings All,
I'm looking to set up a daily query that will pull the last 100 days from TODAY, for the current-year, prior-year and prior-prior-year periods.
The date ranges would look something like this from today's date December 7th:
| PPY | PY | CY |
| 12/7/2021 | 12/7/2022 | 12/7/2023 |
| 8/29/2021 | 8/29/2022 | 8/29/2023 |
I'm using Power Bi Desktop and have a daily scheduled refresh set-up
The code below is what I use to pull the last 100 days each morning, but not sure how to set up for the prior year periods.
= Table.SelectRows(#"Removed Columns", each Date.IsInPreviousNDays([close_date], 100))
Thanks in advance!
Solved! Go to Solution.
Construct the periods by yourself (take 5 days for example)
let
Source = let today=Date.From(DateTime.LocalNow()) in List.Accumulate({0..2}, {}, (s,c) => s & List.Dates(Date.AddYears(today, -c), 5, #duration(-1,0,0,0)))
in
Source
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
Construct the periods by yourself (take 5 days for example)
let
Source = let today=Date.From(DateTime.LocalNow()) in List.Accumulate({0..2}, {}, (s,c) => s & List.Dates(Date.AddYears(today, -c), 5, #duration(-1,0,0,0)))
in
Source
Expertise = List.Accumulate( {Days as from Today}, {Skills and Knowledge}, (Current, Everyday) => Current & Day.LearnAndPractise(Everyday) ) |
This worked great. Thanks a lot, ThxAlot
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 3 |