title: HQL: Max date of previous month
body: <p>Good morning,
  I have a problem I've been trying to solve for but am getting now where.</p>
  <p>I need to find the max date of the previous month. Normally I would just use the following to find the last day of the previous month: last_day(add_months(current_date, -1)</p>
  <p>However, this particular data set doesn't always have the last day with data. E.g. Last day in the data for May was May 30th. Obviously if i try using the syntax above it would return no data because it would be looking for 5/31.</p>
  <p>So is there a way to find the &quot;max&quot; day available in the data of the previous month? Or the month prior etc.?</p>