Power Query M: List of dates until day t is needed

christiane.latte

New member
Joined
Feb 27, 2018
Messages
14
Reaction score
0
Points
0
Excel Version(s)
2016
What I did so far:

Step 1:
= List.Dates

Step 2:
= Source(#date(2018, 1, 1), Duration.Days(DateTime.Date(DateTime.FixedLocalNow())-#date(2017,12,31)), #duration(1, 0, 0, 0))

But only gives me the dates until TODAY. (Well, of course: DateTime.FixedLocalNow()

But how will it give me the days until this year's end? Or alternatively until next year's end?

Can anyone help?

Cheers,
Chrissi
 
Code:
let now = Date.From(DateTime.LocalNow()),
yearend=  Date.From(Date.EndOfYear(DateTime.LocalNow())),
nextyearend =  Date.AddYears(Date.From(Date.EndOfYear(DateTime.LocalNow())),1),
list_until_end_year = List.Dates (now, Duration.Days(yearend-now)+1, #duration(1, 0, 0, 0)),
list_until_next_end_year = List.Dates (now, Duration.Days(nextyearend-now)+1, #duration(1, 0, 0, 0))
in list_until_next_end_year
 
Back
Top