# How to calculate YoY-month and add it to pivot table?

Hey there,
Is there a easy way to add YoY-month columns to pivot tables?
In the following example, for instance, I would like to show the YoY comparing Feb-24 with Feb-23, Jan24-Jan23, Dec23-Dec22, etc.

Any assistance would be greatly appreciated.

Hi @acallea

I think this link can help you - Period Over Period and Other Date Comparison Calculations (YoY, MoM, YTD, Rolling 90 days, etc)

Andrea

1 Like

Thanks Andrea! There I can see how to calculate the Monthly YoY % Diff for current month, but not really how I could add it to a pivot table and show that YoY for every month. Any clue?

Hi @acallea

Iâ€™m not sure if this is suitable for you, but I calculate month by month in this way, with this output

ifelse(

extract(â€śMMâ€ť, CreatedDate)=1,â€ś(a) GENNAIOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=2,â€ś(b) FEBBRAIOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=3,â€ś(c) MARZOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=4,â€ś(d) APRILEâ€ť,
extract(â€śMMâ€ť, CreatedDate)=5,â€ś(e) MAGGIOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=6,â€ś(f) GIUGNOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=7,â€ś(g) LUGLIOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=8,â€ś(h) AGOSTOâ€ť,
extract(â€śMMâ€ť, CreatedDate)=9,â€ś(i) SETTEMBREâ€ť,
extract(â€śMMâ€ť, CreatedDate)=10,â€ś(l) OTTOBREâ€ť,
extract(â€śMMâ€ť, CreatedDate)=11,â€ś(m) NOVEMBREâ€ť,
extract(â€śMMâ€ť, CreatedDate)=12,â€ś(n) DICEMBREâ€ť,
â€śaltroâ€ť
)

Thanks Andrea, I was looking if there was a way to use existing functions to that use case, but that is also helpful!