Compare "This year Month" with "Previous year Month"

Hello everybody,
First post for me here.
Trying metabase on docker, version 1.46.2 , aiming to replace old SAP BW.

I am stuck trying to have a comparison of quantity/payments with same period of previous year.
Let's say i have a question, or a dashboard, with a date range, summarized by month. What i need is another column showing the datas of previous year's month ( or previous year's period of time).:

Item Payment Payment(same period , previous year)

Item1 100 EUR 85 EUR
Item2 150 EUR 120 EUR
... ... ...

I spent lot of time searching, and the official "solution" ( Comparing time periods ) is to create a custom expression like this

"SumIf([Payment], between([Date Received], "2021-01-01", "2021-12-31"))"

But of course i dont want to specify fixed dates. I would like that it reads the date range of the filter, if possible.

I hope i was clear enough, thanksin advance and forgive my awful english


Hi Antonio! Why don't you first build a database view that brings the data in the way you need it and after that you make the GUI query with Metabase? I'm guessing that what you need is Sliding windows in MBQL · Issue #9393 · metabase/metabase · GitHub

Sounds like something very complicate. I expected it was easily doable because should be a very common task ( compare date period with same period of previous year).
Do you have some websites "for dummies" where i can try to know a bit more about how to satisfy my request? You said u beed to "build a database view that brings the data in the way i need". Could you elaborate it a bit more ??
Thanks again

Quick question: are you using the cloud or a self hosted pro version? If so, please write to the success email so we can help you out. We can even set up a meeting with you to help on this