Would using a calculated column in SharePoint help?
https://stackoverflow.com/questions/40140335/formula-to-get-the-last-date30th-or-31st-of-the-added-month-to-a-date-in-shareThe only other option I can think of is to have a list which lists the months and max days that you can reference. Wouldn't work for leap years though.
In the workflow you could have a collection variable containing all the max days and just retrieve the index based on the month.
Have a separate collection for leap years.
I'm now realizing I may have worded my question wrong. I'm not necessarily grabbing the last day of the month. It's a day near the end of the month with no pattern. That's why it's critical that I grab the greatest day in any given month from the mentioned list. Honestly, since each event only holds one date for any given month, I would even settle for getting the date in the Dates column that corresponds with the current month.
I just did a similar query, in my case, to get the maximum ID. When I queried the list, I set it to sort by ID, descending. Then I just use the first item in the collection ID, since it will be my maximum ID. Date should work the same way, or if your newest item is always your max date, you could use ID same as I did. That might be better if there's multiple entries on the same day.
List query:
Below is where I pull the first item ID: