Forum Discussion

jusTodd's avatar
jusTodd
Advocate IV
1 year ago
Solved

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 ...
  • dufoq3's avatar
    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