How to create a YTD with relative dates?

I have a database, in which there is data since 2013. However, I need to create a pivot table, in which I can perform a comparison between the data count from 2013 to July of this year 2022 and from 2013 to July of 2021. Is there any formula that I can create this relative count after every month? For example, at the end of August I need the data to automatically update for the range 2013 to August 2021.

Hi @pedrohro, If your Start Date is fixed at 2013(01/01/2013) then you can create a parameter for End Date with default rolling date option as shown below.
Now that you have Start Date (01/01/2013) and End Date you should be able to create a calculated field get data count for 2013 to end of July 2022.
use similar logic for 2013 to end of July 2021(use addDateTime function to subtract a year from the parameter value).
Rolling date option will help update your end date on a monthly basis.
If this works for you please mark this as solved.