Skip to Content
0

how to find the first day of Previous Month

Oct 18, 2016 at 02:08 PM

221

avatar image
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Mohan Krishna Seemakurthi Oct 18, 2016 at 02:29 PM
0

First Day Of the Current Month : = RelativeDate(CurrentDate();-DayNumberOfMonth(CurrentDate())+1)

Last day of Previous month : = RelativeDate( [First day of current month];-1)

First day of Previous month : =RelativeDate( LastDayOfMonth( RelativeDate([last day of previous month];-45));+1)

/*****

Example : First day of current month -- 10/1/2016

last day of previous month -- 09/30/2016

relative date 09/30/2016 -45 days = 08/15/2016

last day of (08/15/2016) = 08/31/2016

relative date 08/31/2016+1 = 09/1/2016 First day of previous month

**/

Share
10 |10000 characters needed characters left characters exceeded
Jawahar Konduru Oct 18, 2016 at 02:31 PM
0

Oracle DB:

select to_char(trunc(trunc(sysdate, 'MM') - 1, 'MM'),'DD-MON-YYYY') "First Day of Last Month",
from dual
Share
10 |10000 characters needed characters left characters exceeded
AMIT KUMAR
Oct 18, 2016 at 02:37 PM
0

if your BO version is BI 4.1 Sp06 and above then try this.

=RelativeDate(ToDate("01/"+FormatDate(CurrentDate();"MM/yyyy");"dd/MM/yyyy");-1;MonthPeriod)

Share
10 |10000 characters needed characters left characters exceeded
Kuldeep Ghosh Oct 18, 2016 at 02:40 PM
0

Try using:

=RelativeDate(CurrentDate();-(DayNumberOfMonth(CurrentDate())+DayNumberOfMonth(RelativeDate(CurrentDate();-DayNumberOfMonth(CurrentDate()))))+1)

sample.jpg


sample.jpg (73.1 kB)
Share
10 |10000 characters needed characters left characters exceeded
Mohan Krishna Seemakurthi Oct 18, 2016 at 05:25 PM
0

Thank you all for you suggestions.

Share
10 |10000 characters needed characters left characters exceeded