Skip to content
Home » EOMonth function in Power Apps

EOMonth function in Power Apps

The EOMonth function in Power Apps returns the last day of the month for a given date, with an option to shift the result by a specified number of months.

It is useful when working with month-end data, financial reports, or due dates.




Syntax:

EOMonth(StartDate, Months)
  • StartDate: Required. The starting date from which the calculation is based.
  • Months: Required. The number of months to shift from the starting date. Use positive numbers to move forward and negative numbers to move backward and zero changes the day portion of the input DateTime to the end of the month.

Examples:

Getting End of Current Month

If you want to get the last day of the current month based on a given date, you can pass 0 for the number of months to shift.

Following formula returns the last day of the current month based on today’s date.

EOMonth(Today(), 0)

Getting the last day of the month for 2 months from now

To calculate the last day of a future month, you can use the Months argument to add the desired number of months to the starting date.

EOMonth(
  Today(),
   2
)
The formula uses the EOMonth to calculate the last day of the month two months from the current date.
If today is October 15, 2024, the formula will calculate the last day of December 2024, which is December 31, 2024.

 

Getting the last day of the month for 2 months ago

To calculate the last day of a past month, you can use the Months argument to substract the desired number of months from the starting date.

EOMonth(
    Today(),
    - 2
)

The formula uses the EOMonth to calculate the last day of the month that is two months prior to the current date.

If today is October 15, 2024, the formula will calculate the last day of August 2024, which is August 31, 2024.

When to use EOMonth

The EOMonth function in Power Apps is useful in various scenarios, particularly when dealing with date calculations. Here are some situations when you might want to use the EOMonth function.




  • When you need to identify the last day of a month relative to a specified date, whether it’s in the future or the past. This is especially important for reporting and financial calculations.
  • If you generate monthly reports, using EOMonth can help you identify the end date of the reporting period easily.
  • If you need to adjust a date to ensure it aligns with the end of a month, whether you’re adding or subtracting months, EOMonth provides a straightforward way to do that.

 

Also Read..

EDate function in Power Apps

 

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SQL BI Tutorials

Subscribe now to keep reading and get access to the full archive.

Continue reading