Saravanan, are you aware that using a relative date filter will get you fairly close to your goal, without writing calculation?
This is limited to relative dates compared to TODAY(), but it allows the user to change how far back they want to go, also allowing them to look at MTD, etc.
If this doesn't work for you let us know why, and we can help you work out the calculations.
EDIT: Here's the file attachment.
Message was edited by: Shawn Wallwork
Last 24.twbx.zip 1.1 MB