web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Calculate last day of ...
Power Automate
Unanswered

Calculate last day of month (EOM)

(0) ShareShare
ReportReport
Posted on by 292

For accounting purposes, I need to calculate the last day of the month a bill is due.
There is (currently) no "Last Day of the Month" or "End of Month function in P/Au" --- so how do I calculate EOM() date?

Categories:
I have the same question (0)
  • Verified answer
    MelissaReed Profile Picture
    292 on at
    Re: Calculate last day of month (EOM)

    Short answer:

    addDays(startOfMonth(addDays(startOfMonth('2022-08-03'),31)),-1)

     

    There is now a startOfMonth() function that greatly simplifies this from older solutions to this question I see out there.

     

    To break this down from the inside out:

    MelissaReed_0-1648046063178.png

    1. Choose a date – UTCNow(), or item()?[‘Due Date’]   -- 2/15/2022
    2. Get that date’s Start of Month   -- 2/1/2022
    3. Add 31 days to that – the most days in any month – to put the date into the next month  --  3/4/2022
    4. Get that date’s Start of Month – 3/1/2022
    5. Subtract one from that date which puts you on the last day of the prior month (your month) – 2/28/2022.  

    This approach lets Microsoft worry about “30 days hath September…” and leap years

     

    I put a series of Due Dates into an array, did a Select using this formula to calculate Last Day Of Month for the Due Date:

     

    MelissaReed_1-1648046063183.png

     

     

    Results:

    Due Date

    Last Day of Month

    2022-01-01

    2022-01-31

    2022-01-02

    2022-01-31

    2022-01-29

    2022-01-31

    2022-01-30

    2022-01-31

    2022-01-31

    2022-01-31

    2022-02-01

    2022-02-28

    2022-02-02

    2022-02-28

    2022-02-28

    2022-02-28

    2022-03-01

    2022-03-31

    2022-03-02

    2022-03-31

    2022-03-03

    2022-03-31

    2022-03-29

    2022-03-31

    2022-03-30

    2022-03-31

    2022-03-31

    2022-03-31

     

    I hope this is helpful – it was nice to have a chance to give back after this board has saved me so many times!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard