Skip to Content

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 a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2016 at 02:40 PM

    Try using:

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

    sample.jpg


    sample.jpg (73.1 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2016 at 05:25 PM

    Thank you all for you suggestions.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.