Skip to Content
avatar image
Former Member

how to find the first day of Previous Month

hi all,

can you please advise how to find the first day of previous month

Thanks

Krishna

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 18, 2016 at 02:29 PM

    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

    **/

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 18, 2016 at 02:31 PM

    Oracle DB:

    select to_char(trunc(trunc(sysdate, 'MM') - 1, 'MM'),'DD-MON-YYYY') "First Day of Last Month",
    from dual
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 18, 2016 at 02:37 PM

    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)

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 18, 2016 at 02:40 PM

    Try using:

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

    sample.jpg

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 18, 2016 at 05:25 PM

    Thank you all for you suggestions.

    Add comment
    10|10000 characters needed characters exceeded