Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

EOMONTH equivalent in M

Is there an equivalent of EOMONTH function in Power Query?

Or is there a work around to calculate end of month of a date for next month, and for previous month?

 

I'll highly appreciate some help.

  • Anonymous's avatar
    Anonymous
    5 years ago

    ok so it will be

     

    Date.EndOfMonth(Date.AddMonths([Date],1))

  • Anonymous's avatar
    Anonymous
    5 years ago

    You could do:

    LoadDate = Table.AddColumn(LastStepName, "NewColumnName", each Date.EndOfMonth(Date.AddMonths([Column2]{0}, 1))

    This will increment the date by one month, and then get that end of month date.

    --Nate

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Yes, it's Date.EndOfMonth(DateOrDateColumn), which returns the last date in the month for each date.

    --Nate

    • Anonymous's avatar
      Anonymous
      Not applicable

      eomonth(date,1) gives next month's end date. How would we do that in M?

      • Anonymous's avatar
        Anonymous
        Not applicable

        ok so it will be

         

        Date.EndOfMonth(Date.AddMonths([Date],1))

  • Anonymous's avatar
    Anonymous
    Not applicable

    You could do:

    LoadDate = Table.AddColumn(LastStepName, "NewColumnName", each Date.EndOfMonth(Date.AddMonths([Column2]{0}, 1))

    This will increment the date by one month, and then get that end of month date.

    --Nate