Formula to get difference of sales between 2 date range dynamically

Suppose i have a metric called (sales), and have 2 date fields, where both are mapped to sales (basically its a duplicate of the other date field)
formula is : i need data when i subtract sales for 1st date range with 2nd date range and divide it by second date range
that is for example: (DATE1 SALES in jan - DATE2 SALES in May )/ DATE2 SALES in May
But the date should be dynamic so that when i select any date for DATE1 and DATE2 in parameter or filter it should be reflected in formula
should i create a parameter for both dates?

Yes I would use two parameters.

I would reference this post as I think you should be able to accomplish what you are looking for with a couple of these calculated fields.