# Month End report

**URL:** <https://forum.inductiveautomation.com/t/month-end-report/105133>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 15, 2025, 7:32pm UTC](https://forum.inductiveautomation.com/t/month-end-report/105133 "2025-04-15T19:32:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AUSDIV](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@AUSDIV](https://forum.inductiveautomation.com/u/AUSDIV)\
**Post date:** [April 15, 2025, 7:32pm UTC](https://forum.inductiveautomation.com/t/month-end-report/105133/1 "2025-04-15T19:32:03Z")

</div>

I am trying to make a scheduled report that looks back a month. In the Query I am struggling to find a good way to make the StartDate parameter be the beginning of the most recent month. The end date is simple enough, I can make it now() and then use the scheduler of the report to trigger at the start of the month I believe.

The default of the StartDate parameter is

```python
dateArithmetic(now(), -8, "hr")

```

If every month was 31 days of course I assume I could do -31 and "day". I saw some old posts talking about this and I tried putting some of the code examples into the report module StartDate parameter and didn't get any good look in the query when I tried to query BETWEEN {StartDate} and {EndDate}

---

<div class="post-metadata">

**Author:** ![dillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon/32/81537_2.png) [@dillon](https://forum.inductiveautomation.com/u/dillon)\
**Post date:** [April 15, 2025, 7:44pm UTC](https://forum.inductiveautomation.com/t/month-end-report/105133/2 "2025-04-15T19:44:39Z")

</div>

If the data is being acquired via SQL, I recommend doing it in the SQL query. Here are a couple ways to get the first day of the month for the given date, in this case I use **GETDATE()** function to get the current date. You can use this in the WHERE clause of the query and pass in the date param.

```SQL
SELECT DATEADD(DAY, 1, EOMONTH(GETDATE(), -1)); --Option 1

SELECT DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1) --Option 2

```

-edit 1: clarity

---

<div class="post-metadata">

**Author:** ![AUSDIV](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@AUSDIV](https://forum.inductiveautomation.com/u/AUSDIV)\
**Post date:** [April 15, 2025, 8:15pm UTC](https://forum.inductiveautomation.com/t/month-end-report/105133/3 "2025-04-15T20:15:15Z")

</div>

Worked great, thanks!
