How would you approach a data Model below?

Hi,

How would you approach a dataset in the format below:

  • Aggregate by different categories.
  • Revenue in multiple time-frames (montly, ytd, ytd last 3 months)

What is the best approach to have a final model as the imagem below? is there any library or functionality you would use to facilitate the summarization for multiple time period (instead of writing SQL statements) ?