title: Lubridate summarise on a nonfixed "monthly" basis
body: <p>I have the following data:</p>
  <pre><code>Customer &lt;- c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5)
  Invoice &lt;- c(100:134)
  Invoice.Date &lt;- c('20200223','20200226','20200301','20200314','20200314','20200401','20200405','20200302','20200604','20201103','20201012','20200710','20200804','20200813','20200912','20201001','20201030','20201031','20201101','20201014','20200915','20200213','20200304','20201003','20200505','20200617','20200520','20201005','20200403','20200303','20200915','20201003','20201101','20201001','20200901')
  
  invoices &lt;- data.frame(Customer, Invoice, Invoice.Date)
  </code></pre>
  <p>I know how to get a monthly invoice counts as such</p>
  <pre><code>invoices %&gt;%
    group_by(month = floor_date(as.Date(as.character(Invoice.Date), &quot;%Y%m%d&quot;), &quot;month&quot;)) %&gt;%
    count(Customer, name = &quot;monthly&quot;) %&gt;%
    pivot_wider(names_from = month, values_from = monthly)
  </code></pre>
  <p>I would however like to get a count based on &quot;previous monthly period&quot; based on the last invoice date.</p>
  <p>So the last column should have 10/24 - 11/23, the one before that 9/24 - 10/23, etc. I have a few slow ideas in mind, is there something faster in lubridate or elsewhere?</p>