Forum Discussion
jusTodd
1 year agoAdvocate IV
Create a specific Due Date based on another Date
Curious to know if there is a more effective way of doing this in Power Query. I have a string of dates in which I need to create a due date as the 5th of the following month. This is what I ...
- 1 year ago
Hi jusTodd, check this:
let Source = #date(2023, 12, 1), Dates = List.Dates(Source, Duration.TotalDays(Date.From(DateTime.FixedLocalNow()) - Source) +1, #duration (1,0,0,0)), ToTable = Table.FromList(Dates, (x)=> {x}, type table[Date=date]), Ad_DueDate = Table.AddColumn(ToTable, "DueDate", each Date.AddMonths(#date(Date.Year([Date]), Date.Month([Date]), 5), 1), type date) in Ad_DueDate
dufoq3
1 year agoCommunity Champion
Hi jusTodd, check this:
let
Source = #date(2023, 12, 1),
Dates = List.Dates(Source, Duration.TotalDays(Date.From(DateTime.FixedLocalNow()) - Source) +1, #duration (1,0,0,0)),
ToTable = Table.FromList(Dates, (x)=> {x}, type table[Date=date]),
Ad_DueDate = Table.AddColumn(ToTable, "DueDate", each Date.AddMonths(#date(Date.Year([Date]), Date.Month([Date]), 5), 1), type date)
in
Ad_DueDate
- jusTodd1 year agoAdvocate IV
This puts it on the 5th of the same month ?
- dufoq31 year agoCommunity Champion
Hi, no, my query puts 5th of the following month, but at the beginning there was same month - after few minutes I've edited my query, but you probably copied it before my edit 😉 Copy it again.
- jusTodd1 year agoAdvocate IV
Yup! I just got there before you edited. This works great and is so much more cleaner than my own. Thanks a bunch! Really appreciate it.