Average of last 12 months

Hi, a reproducible example would help. What have you tried?

Otherwise, have a look at these:

Calculate the average daily and monthly - tidyverse - Posit Community (rstudio.com)

Summarize Time Series Data by Month or Year Using Tidyverse Pipes in R | Earth Data Science - Earth Lab