Hey @vkedia ,
welcome to the QuickSight Community .
In your situation you can’t filter for that specific timerange - in your example you only access data from 2024/01/01 till 2024/05/21 everything else is ignored. You need to use parameters in a calculation.
I think @Jesse answered a similar question here: Period Over Period Functions with Date Controls - #3 by Jesse
There are also great articles that can give your more inside:
Period Over Period and Other Date Comparison Calculations (YoY, MoM, YTD, Rolling 90 days, etc) - Learning Center / Articles - Amazon QuickSight Community
Creating period comparisons with QuickSight’s periodOver and periodTo functions - Learning Center / Articles - Amazon QuickSight Community
If you still need help just reach out - maybe you/we can create something in arena and test it there.
BR
Robert