Forum Discussion

Nick001's avatar
Nick001
Frequent Visitor
5 years ago
Solved

List of months

hello,   Can you help me plz, I would like to generate a list in Power Query with all the beginning Days of the month from today 2 months in the past and 12 months in the future. Unfortunatel...
  • Jakinta's avatar
    5 years ago

     

     

    = let 
    ThisMonth = Date.StartOfMonth( Date.From(DateTime.LocalNow())), 
    Start = Date.AddMonths( ThisMonth,-2), 
    End = Date.AddMonths(ThisMonth,12) 
    in 
    List.Select( List.Dates(Start, Duration.TotalDays(End-Start), #duration(1,0,0,0)), 
    each _= Date.StartOfMonth(_))

     

    or

     

    = List.Transform( {-2..11}, each Date.AddMonths( Date.StartOfMonth( Date.From(DateTime.LocalNow())), _))