From Date Expression: Add Days ( Start Of Month ( Subtract Days ( Start Of Month ( Current Date ) , 1 ) ) , 22 )
To Date Expression: Add Days ( Start Of Month ( Current Date ) , 21 )
Hi Nagma_Nk
In my example I have used a calendar control as this made testing easier, for your purpose just substitute the calendar control for the current date
I have broken the problem into 3 steps.
- Calculate the 25th of this month
- Calculate the 25th of last month
- Decide which one is appropriate
Below are the detailed steps.
1. Calculate 25th of this month
We calculate the start of this month using the Start Of Month function.
Then Add 24 days to get to the 25th day of the month using the Add Days function
When working with expressions I find it easiest to build them from the outer most function inwards.
Start with Add Days
Then drag Start of Month into first the input field
Lastly drag the date into the input for the Start of Month function (substitute current date for your solution).
2. Calculate the 25th day of last Month (read this one a couple of times if you need to)
With the functions we have available my calculations are broken down below.
Start of this month (Calendar) - 1 Day = End of Last Month
Start of Month (End of Last Month) = Start of Last Month
Start of Last Month + 24 Days = 25th day of Last Month
I used Add Days and passed in -1, but this can be replaced by Subtract Days instead.
Taking the same outer most to Inner most approach as before.
Add 24 days
Calculate the Start of Last Month
By subtracting 1 day
From the Start of This Month
Substitute Current Date for your solution
3 Decide which date to use
Now base on the current date choose which value to use using logical operators
Below are the Expressions
Below are tests showing the expressions working.
I hope this helps