Previous month end data for report

Hi expert,
I have to calculate previous month end data for my report.
let say if user select 15 oct then he should be able to see 30 sept data.
I have calander prompt.
Thanks,

Hi,
Use presentation variable in date prompt.
Apply sql filter(covert to sql) on report as date_column= TIMESTAMPADD(SQL_TSI_DAY,-DAYOFMONTH(date 'presntation_variable'),date 'presentation_variable')
Refer : How to get LAST_DAY in obiee
Regards,
Srikanth

Similar Messages

  • Previous month end date

    hello,
    i would like to find out the previous month end date when i give the input any date .
    finding previous month end date.
    eg :-> if i give the date as 02-Jan-2008, the result should be 31-dec-2007
    if i give the input date as 10-nov-2007, the previous month end date is 31-Oct-2007
    etc...

    ME_XE?select the_date, trunc(the_date, 'MM') - 1 as las_day_prev_month
      2  from
      3  (
      4     select add_months(sysdate, level) as the_date from dual connect by level <=12
      5  );
    THE_DATE                   LAS_DAY_PREV_MONTH
    02-FEB-2008 08 58:30       31-JAN-2008 12 00:00
    02-MAR-2008 08 58:30       29-FEB-2008 12 00:00
    02-APR-2008 08 58:30       31-MAR-2008 12 00:00
    02-MAY-2008 08 58:30       30-APR-2008 12 00:00
    02-JUN-2008 08 58:30       31-MAY-2008 12 00:00
    02-JUL-2008 08 58:30       30-JUN-2008 12 00:00
    02-AUG-2008 08 58:30       31-JUL-2008 12 00:00
    02-SEP-2008 08 58:30       31-AUG-2008 12 00:00
    02-OCT-2008 08 58:30       30-SEP-2008 12 00:00
    02-NOV-2008 08 58:30       31-OCT-2008 12 00:00
    02-DEC-2008 08 58:30       30-NOV-2008 12 00:00
    THE_DATE                   LAS_DAY_PREV_MONTH
    02-JAN-2009 08 58:30       31-DEC-2008 12 00:00
    12 rows selected.
    Elapsed: 00:00:00.12
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Getting Last Month End date

    Dear Experts,
    I want the following result. I have a date parameter. I want to
    get the last / end date of the previous month
    for any given date which the user inputs.
    For ex:
    If user puts the date 15.06.2008
    then i want to get the previous month end date i.e. 31.05.2008.
    The reason being i am creating a program for updating Opening and Closing Stocks of every month in a ZTABLE. The user will put the date in the parameter and system will bring the closing stock of previous month and then calculate for the current month.
    I hope i am not complicating matters too much....
    Basic funda is to arrive at the end date of the previous month for any date which the user puts.
    Please help me... it is mission critical..
    Thanks & Regards,
    Jitesh M Nair

    hi,
    use this to get last month end date.
    ex:
    data: d2 like sy-datum.
    d2 = sy-datum.
    d2+6(2) = '01'.
    d2 = d2 - 1. "prev mnth last date
    write:/ d2.

  • Month end date

    how to display month end date for every month by default?

    hi,
    chk this code.
    by default it will show the begin and end date in select option.
    the similar think u can adopt.
    check this sample code...
    tables: mkpf.
    data date like sy-datum.
    data date1 like sy-datum.
    select-options: s_date for mkpf-budat.
    initialization.
    CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
    EXPORTING
    iv_date = sy-datum
    IMPORTING
    EV_MONTH_BEGIN_DATE = date
    EV_MONTH_END_DATE = date1
    s_date-option = 'EQ'.
    s_date-sign = 'I'.
    s_date-low = date.
    s_date-high = date1.
    append s_date.
    rgds
    anver
    if hlped mark points

  • Month end date in RPD

    We need to show month end date for a given date in a table.
    Say the date is '03-25-2008', then output should give me '03-31-2008'.
    I want to create a new derived column like this in rpd.
    I believe variables cannot help me here, because we will need to have month end date for each value the date column will hold.
    Please let me know how can we achieve this.

    Hi....
    Better go for creating view by writing the direct function.
    if db is: ORACLE, then LAST_DAY(<date column>) is the function to get the last day of the date column.
    but in creating view you also fetch the key column of the particular date column table and the above function too... it's like
    select key column, LAST_DAY(<date column>) as LastDate from TableNameA
    now you create a physical join between the TableNameA and the view, which maintains 1to1 relation ship.
    So that we can use the LastDate column in our BMP layer in particular TableNameA logical table.
    I think it works out probably....
    If not sorry...
    Thanks & Regards...

  • Delivery Block at PGI level based on GI date and Month end date

    Business need a check on delivery processing based on the Planned GI date, Month end date and transit period. This transit period is a custom field and dependent on customer. Also it is not maintained anywhere in system. Business store it in some excel format.
    The logic needed is: For any given month, the delivery order MUST be goods issued in the same month, i.e. once the order is delivered, the Post goods issue should ONLY be allowed if and only if , the PLANNED GI date ( as maintained in delivery ) + transit time ( at customer level ), falls within the month end date. If not, a block should be applied at PGI and only authorized personnel should be able to release that block.
    Also, there will be no check at invoicing VF01 level. Once the PGI blocked is removed, there will be no check on invoicing. The month end date may vary month to month and need to in combination of Sales Org / Plant as mentioned
    In addition, the business need an exception report where the information of releasing the block should appear for release date, user id of the responsible person, time sales order no etc. and it should be downloadable.
    We can have a custom table to maintain the month end day in given combination.
    But I need your expert inputs as-
    1-     Can we add this transit period in at customer master data as it is dependent on customer and there are huge no of customers for the sales unit? If not, then how to maintain it; may be a z table?
    2-     Based on this logic, what should the code/logic to be written for block at PGI.
    3-     How to control the authority check for removing the block.
    4-     The source fields for exception report.
    Pls revert accordingly.
    Many thanks in advance.

    Hello,
    Please refere the answers to your questions:
    1- Can we add this transit period in at customer master data as it is dependent on customer and there are huge no of customers for the sales unit? If not, then how to maintain it; may be a z table?
    You can either use some un-used Feild in Customer Master or maintain a Z-Table. I believe maintaining a Z-Table would be easy as you have huge number of Customers. You can also write a dmall program to Pick the Customer-wise transit dates from a excel file & store in Z-Table.
    2- Based on this logic, what should the code/logic to be written for block at PGI.
    You have explained the requirement well in your thread, you need to explain the same to your ABAPer & Basis person & they would do the needful.
    3- How to control the authority check for removing the block.
    Basis person would create & assign a Z-Authorization object which the ABAPer would use in his program.
    4- The source fields for exception report.
    Once you do the above development, your ABAPer will easily pick the required feild in Report as he has already used all the feilds somewhere in his development.
    Hope this helps,
    Thanks,
    Jignesh Mehta

  • What is month end data from mbew?

    I have a report that shows valuated stock qty and value that needs to be filtered based on Month End data. (MARD, MBEW).
    How to code this filter "Month End data"?

    MBEWH and MARV are validation points for this. look at MB5W or report J_B1BL07

  • Month end dates caluclation

    Hi guys,
    can any give me an idea..
    i have between calendar prompt...
    when i select from date and to date..
    i need the month end dates of that selected period..
    for example
    from date: 05-may-12 and to date: -19-oct-12
    i need to display May 31st,june 30th,july 31st, august 31st,september 3oth
    can any guide me pls
    Edited by: Bhargav K on Jun 4, 2013 11:19 AM

    Assuming you are using two column prompts 'FromDate' and 'ToDate', try using the following expression as the column formula in your report.
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( <FromDate_column>) * -(1) + 1,<FromDate_column>)))
    For the report create two filters, one on FromDate_column and the other on ToDate_column both filtered as is prompted
    Now when you use this report in a dashboard with the dashboard prompt containing the From and To data column prompts, the report will list all the month end dates between the selected range.
    Hope this helps

  • Fetching previous month's date

    Hii,
    Can anyone  provide me the code for retrieving firstWorkingDay for previous month ??

    Hi,
    Please check code:
    import java.text.*;
    import java.util.*;
    public class DateUtils {
      public enum IntervalType {  Month, Week  }
      private DateUtils() {  }
      public static Calendar[] getDateIntervals(IntervalType type, Calendar reference) {
        if (reference == null) {
          reference = Calendar.getInstance();
        Calendar startDate = (Calendar)reference.clone();
        Calendar endDate = (Calendar)reference.clone();
        if (type == IntervalType.Month) {
          // first date of the month
          startDate.set(Calendar.DATE, 1);
          // previous month
          startDate.add(Calendar.MONTH, -1);
          // first date of the month
          endDate.set(Calendar.DATE, 1);
          // previous month, last date
          endDate.add(Calendar.DATE, -1);
        else {
          // previous week by convention (monday ... sunday)
          // you will have to adjust this a bit if you want
          // sunday to be considered as the first day of the week.
          //   start date : decrement until first sunday then
          //   down to monday 
          int dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek  != Calendar.SUNDAY) {
            startDate.add(Calendar.DATE, -1);
            dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek != Calendar.MONDAY) {
            startDate.add(Calendar.DATE, -1);
            dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          // end date , decrement until the first sunday
          dayOfWeek = endDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek  != Calendar.SUNDAY) {
            endDate.add(Calendar.DATE, -1);
            dayOfWeek = endDate.get(Calendar.DAY_OF_WEEK);
        return new Calendar[] { startDate, endDate };
      public static void main(String[] args) {
        try {
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
          System.out.println("** previous month (relative today)");
          Calendar [] results = DateUtils.getDateIntervals(IntervalType.Month, null);
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous week (relative today)");
          results = DateUtils.getDateIntervals(IntervalType.Week, null);
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous month (relative jan 1, 2007)");
          results = DateUtils.getDateIntervals(IntervalType.Month,
            new GregorianCalendar(2007, 00, 1));
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous week (relative jan 1, 2007)");
          results = DateUtils.getDateIntervals(IntervalType.Week,
            new GregorianCalendar(2007, 00, 1));
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
        catch (Exception e) {
          e.printStackTrace();
        output :
        ** previous month (relative today)
        2008-06-01
        2008-06-30
        ** previous week (relative today)
        2008-06-30
        2008-07-06
        ** previous month (relative jan 1, 2007)
        2006-12-01
        2006-12-31
        ** previous week (relative jan 1, 2007)
        2006-12-25
        2006-12-31
    this will solve all your requirements!
    Thanks
    Pravesh

  • How to set a default start and/or end date for New Events based on trigger date.

    I'm using the CalendarActivityListener to get current row when clicking on an existing event. As per previous posts this listener gives you access to event detail including Start Date, End Date, etc.
    However, what I want to do is to default the start (and end) dates for New Events based on the trigger date.
    I've tried the CalendarListener and can grab the Trigger Date from it - however, I can't see a way to pass this directly to the popup/dialog I'm using to create the new event.
    At present I'm putting the TriggerDate into the ADFContext session scope e.g. ADFContext.getCurrent().getSessionScope().put("TriggerDate",calendarEvent.getTriggerDate());
    Then, I've tried multiple approaches to try and "get" the TriggerDate from session scope to drop it into my new Calendar Event basically, I'm trying to default the InputField(s) associated with the Start Date using the value from the session - I've tried
    1. setting the default value for the InputField in the jspx using a binding expression i.e. value="#{sessionScope.TriggerDate}" - this actually sets the value appropriately when the jspx is rendered but, when I go to create I get a NPE and I can't debug. I assumed that it might be a Date type issue - it would appear that CalendarListener provides a date of type java.util.Date and that the StartDate attribute of my VO/EO/table is a DATE and therefore requires oracle.jbo.domain.Date so I tried casting it - to no effect
    2. Using a Groovy expression *(StartDate==null?adf.context.sessionScope.TriggerDate:StartDate)* in my calendar's EventVO to default the Start Date to the same result
    Any thoughts or ideas?

    John,
    Thanks for that suggestion - could not get it to work. However, I did manage a different approach. I finally determined the sequence of events in terms of how the various events and listeners fire (I think).
    Basically, the CalendarActivityListener fires, followed by the listener associated with the Calendar object's Create facet, followed finally by the CalendarEventListener - the final is where the TriggerEvent is available and then finally, control is passed to the popup/dialog in the Create facet. So, my approach of trying to set/get the TriggerDate in the user's HTTP session was doomed to failure because it was being get before it had been set :(
    Anyway, I ended up adding a bit of code to the CalendarEvent listener - it grabs the current BindingContext, navigates through the DCBindingContainer to derive an Iterator for the ViewObject which drives the calendar and then grabs the currently active row. I then do a few tests to make sure we're working with a "new" row because I don't want to alter start & end dates associated with an existing calendar entry and then I define the Start and End dates to be the Trigger Date.
    Works just fine. Snippet from the listener follows
    BindingContext bindingContext = BindingContext.getCurrent();+
    *if ( bindingContext != null )    {*+
    DCBindingContainer dcBindings = (DCBindingContainer) bindingContext.getCurrentBindingsEntry();+
    DCIteratorBinding iterator = dcBindings.findIteratorBinding("EventsView1Iterator");+
    Row currentRow = iterator.getCurrentRow();+
    if ( currentRow.getAttribute("StartDate") == null)+
    currentRow.setAttribute("StartDate", calendarEvent.getTriggerDate());+
    if (currentRow.getAttribute("EndDate")==null)+
    currentRow.setAttribute("EndDate", calendarEvent.getTriggerDate());+
    *}*

  • Quarter End date for this period

    Hi
    I have current date, How could I get the quarter end date for this date.
    for example
    Jan 23 2005 - The quarter end date is Mar 31 2005.

    needs testing
    import java.util.Calendar;
    import java.text.SimpleDateFormat;
    class Testing
      public Testing()
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH,3-(cal.get(Calendar.MONTH)%3));
        cal.set(Calendar.DAY_OF_MONTH,0);
        System.out.println(sdf.format(cal.getTime()));
        cal.set(2005,10,15);
        cal.add(Calendar.MONTH,3-(cal.get(Calendar.MONTH)%3));
        cal.set(Calendar.DAY_OF_MONTH,0);
        System.out.println(sdf.format(cal.getTime()));
      public static void main(String[] args){new Testing();}
    }

  • Previous month first data and previous month last date

    can any body have query to get previous month first date and previous month last date.
    Ex: First day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY,-6, (TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)))
    Last day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)
    can anybody have it for first day of the previous month,last day of the previous month?
    Edited by: user12255470 on Apr 7, 2010 3:30 AM

    Hi,
    1st day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1) + 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE))
    last day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)))
    Please mark Q answered and award points for correct answers !
    Thanks
    Alastair

  • I want to see the previous month workload statistics for my system.

    Hello,
    I want to see the previous month workload statistics for my system. When I go to st03n ->expert mode, go to month view and when I click on previous month workload analysis I see data for 12 days only. However, the data is available in weekly view.
    What can be the problem?
    Please help.

    which version of SAP System you are using
    try this option ST03N -> Expert mode -> Total -> Choose the month

  • Previous month last date in sql

    hi
    i am using function
    select dateadd(day,1 - DATEPART(day,dateadd(month,24-36,GETDATE())),dateadd(month, 24- 36, getdate()))
    this will giveme 2014-03-01,
    now what changes  i need to make this function which will give me previous month last date.
    2014-02-28

    Hi coool_sweet,
    The answers in above posts are excellent. In case you may need any tip for date calculation, here is a good link for your reference.
    Date and Time Data Types and Functions - SQL Server (2000, 2005, 2008, 2008 R2, 2012)
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Last month end date based on current date

    Hi,
    How to show last month end date based on the current date.
    Eg:
    Current date = "08/26/09"
    Var- Last Month End Date = "07/31/09" etc...,
    Please help me how to get it...
    Thank You!

    Good to hear that it worked for you. but not for me.
    I tried like this:
    1st::
    1. var1= ToDate("06/30/09","MM/dd/yyyy")
    2.Var2= RelativeDate([Var1];-DayNumberOfMonth([Var1]))
    result: 5/30/09
    2nd:
    RelativeDate('6/30/2009';-DayNumberOfMonth('6/30/2009'))
    result: 5/30/09
    Am working on SAP OLAP cubes.
    Please help me where am going wrong....
    Thank You!

Maybe you are looking for

  • How to find out the transport request that a report is locked to?

    Hello Experts, I have to transport a report to production system. The report has already been assigned to a transport request. How do I find as to which transport request is the particular report assigned to. Any place where I can check for the locks

  • Using Preview application

    I was having a problem installing the latest version of free Adobe Reader for my Mac, I tried many things, I just could not get it. I contacted adobe but they helped just so far, next step is to pay for serious tech assistance. I was able to download

  • How much space is occupied by OSX Mountain Lion on the hard disk

    Hi guys, can someone tell me please how much space is occupied by Mountain Lion on hd? I whould like to buy a new Hybrid hd but it has only 8 Gb of nand flah memory. I fear that operating system will be divided on both hd partitions (ssd and serial a

  • Anyone else having trouble pairing iPhone music apps with the Aura BluNote?

    I have already treid all the suggested fixes from the Apple website.  Still no success.  The bluetooth speaker plays audio whenever I make a phonecall, but will  not when I try to listen to my music, pandora, or any other audio app.

  • Return button not working

    Please help...I just got my new MacBook Pro delivered today...my FIRST laptop. I started setting it up and got this crazy VoiceOver, so I learned the tutorial and set up my laptop, but now I can't navigate at all without VoiceOver. I tried turning it