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

Similar Messages

  • MTD(Month To Date) and YTD(Year To Date) with one example

    can any ont Explain about MTD(Month To Date) and YTD(Year To Date) with one example plz

    Hi,
    Can you please elaborate.
    MTD is from the 1st of the current month till today's date.
    YTD is from 1st Jan till today's date.
    If you trying to build this is query. Create restricted key figure and put restriction on calday with a customer exit for the same.
    Thanks,
    S

  • I spend 5 months in Florida and 7 months in Ontario, Canada. Can a Verizon Samsung Note ll be unlocked and used with a sim card from another carrier in Ontario?

    I spend 5 months in Florida and 7 months in Ontario, Canada. Can a Verizon Samsung Note ll be unlocked and used with a sim card from another carrier in Ontario?

    Yes, you should be able to use a local SIM card from a carrier in Ontario. You should not have to do anything prior to doing so.

  • 12 Month Moving Average and 12 months rolling average

    Hi All,
    please let me know what is difference 12 Month Moving Average and 12 months rolling average
    can i get 1 example to achieve the solution

    Hey suneel,
    Both average are more or less same, for better understanding. go through below link, where you can get some clarifications.
    http://www.brighthubpm.com/project-planning/111351-guide-to-computing-rolling-averages-for-business-forecasts/

  • HT1689 I live 7 months in Germany and 5 months in the USA. My iTunesaccount does not work in the US even though I changed the country  or entered a new account number. Who can help?

    I live 7 months in Germany and 5 months in the USA. My iTunesaccount does not work in the US even though I changed the country  or entered a new account number. Who can help?

    You need 2 apple ids and you have to sign in and out with the two ids.
    Note: Apple ID cannot be merged or transferred to another Apple ID.
    Or only use one apple id in one country.

  • Mapping of CRM Territory Hierarchy data and BI Territory Hierarchy data

    Hello friends,
       I Want to know the easy way to compare the CRM Territory Hierarchy data and BI Territory Hierarchy data . Previously We had an issue with Territory Hierarchy data  and applied note on CRM side and it resolved. Now we want to see whether the Territory Hierarchy data is sync in between BI and CRM.
       Please let  me know if you have an idea what is the solution if both systems are out of SYNC.
    Thanks,
    SRI.

    Hi Raimon,
    Please check note-
    Note 460302 - CRM_MKTPL: Double message concerning BW update
    Regards,
    Anil

  • Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.

    Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.
    Is there any way to re-number them in the order I have chosen so that they can then be sorted by number? The scans are all from pre-digital images that I wish to move to a photobook and I don't want to have to organise them twice!
    Thanks for any suggestions.

    I was a bit short, Chris, sorry. It is limited, what can be posted, when typing on an iPad.
    Now I am back on my Mac. I meant the following:  Batch Change the date for a large range of photos, that should have a date stepped in increments.
    Select all Photos at once and use the command "Photos > Batch Change".
    Then set the date for the first photo and select an increment, e.g. one minute.
    Now all photos will get a new date assigned, incremented by one minute, in the sequence you have selected. So you will be able to sort them by date.  This way it will be unnecessary to change the titles or filenames.

  • What's the need for capitalization date and 1st acq. posting date?

    hi guys,
    i was wondering what the system would do with capitalization date and first acquisition posting date ??
    and what will be the problem if i entered an asset value date (in the acquisition transaction) that's earlier than the capitalization date entered in the asset master record ?!

    In practice all assets are not put to use right from the date of purchase.Hence the concept of different dates arises.  One being the acquisition date and the other Capitalization date.
    I would buy an asset today but start using it from a later date.  Depreciation has to be calculated from the date of capitalization and not acquisition. But still for record purpose date of purchase would be important.  Hence both the dates are maintained.
    Hope this has clarified your doubts.
    Thanks
    GU

  • Table for  the PO Date and Stock Transfer Order Date of a material no

    Hello Everyone!
    I am having a requirement where I want both the Purchase Order Date and Stock Transfer Order Date of a perticular material no.
    On the basis of difference of these two dates I want to find out the period for which the material was present in supplying plant.
    I am not getting the table through which I can get these two dates for a material.
    Please help me out.
    Its urgent.

    hi,
    see these tables:
         EKKO – Purchase Order Header Table
         EKPO – Purchase Order Item  Table
         EKBE – PO History table.
    reward if its useful

  • Delivery not before date and Delivery not after date

    Hi Everyone,
    Can anyone help me in this issue, we need to map "delivery not before date" and "delivery not after date" from an EDI 850 into a sales order.
    Are there any fields to which we can map the data? if not would anyone suggest how to go about it?
    Thanks,
    Michelle.

    Michelle,
    We have a similar requirement, albeit we call it a Delivery Window. We have implemented this by mapping two E1EDK03 qualifiers (we use 033 & 034) to two Z fields extended to VBAK, which we then include in our Sales Order Delivery Date logic.
    Not very elegant, but then my understanding is that SAP has no concept of the Delivery Window.
    Cheers, Paul.

  • What is the difference between delivery date and actual goods issue date?

    Hi ,
    Can you please tell me the difference between Delivery date and Actual goods issue date ?
    Delivery data can be be greater than goods issue date?
    Thanks,
    Ajay

    Hi Ajay,
                  Delivery date means its the original date on which the delivery should be done.Actual goods Issue date is the date on which goods to be delivered according to the purchase order.There can be delay in the delivery so we maintain 2 objects.
    Yes delivery date can be greater than Goods Issue date.
    Hope this clears
    Regards
    Karthik

  • Fieldes planned delivery date and actual good recipt date for SAP QUERY

    Hi Gurus
    I am changing sap query. I need to find two fieldes  : planned delivery date and actual goods recipt date
    I dont know MM tables, do you know wrhere are?
    in table EKPO i don't find the fieldes.
    Thanks in advance

    Thank a lot!
    Regards

  • Inserting Date and Time into a date field

    Okay I am a bit of a Oracle newbie. I am trying to insert the following date and time into a date field and I don't know how to format the second part of the to_Date() function.
    Date/Time: 5/29/2003 7:58:45 PM
    Thanks,
    Branden

    I believe you would want
    to_date( '5/29/2003 7:58:45 PM', 'MM/DD/YYYY HH:MI:SS AM' )
    Note that tahiti.oracle.com has all of Oracle's documentation, including the very useful SQL & PL/SQL reference manuals, available for free.
    Justin

  • Difference between P.O.date and P.O.created date

    Hi,
      Could you tell me difference between purchaseing doucment date and purchase order creaed date.
        Because some time in my org. po created after GR means in past date. So there is difference between
        po date and po created date. where this po created date is maintained in purchase order
               Thanks and Regards
                      Anil

    Dear Anil,
    Please check table EKKO with ta SE11.
    Created Date => EKKO-AEDAT
    Date on which the record was created
    Document date => EKKO-BEDAT
    Date on which the purchasing document was created
    EKKO-AEDAT = Date on which the record was created
    and also "Created By" also recorded automatically
    by system.
    Document date or EKKO-BEDAT normally default as
    today when you create the PO via ME21N. This field
    appear at top right of the screen. However this date
    can be change to any date that required.
    Thanks
    Loke Foong

  • Req. delivery date and plan order finish date relationship

    Dear Experts,
    I have a question on setting the req. delivery date and plan order finish date relationship. Now, I want the plan order finish date is one day before the req. delivery date, is it possible to set it in configuration? Please advised! Many thanks!
    Regards,
    Matt Yim

    Matt,
    Please use a schedule margin key(SMK) in the material master MPR2 view which has float after production defined as 1day.
    If there are no SMK with that defination then you can define you own in customisation and assign the same in the material master. (SPRO--->Production ->MRP->Planning ->Scheduling and Capacity Parameters->Define Floats).
    Regards,
    Prasobh

Maybe you are looking for

  • Details of blocked invoices of a vendor

    hi guys i would like to see the list of blocked invoices of a particular vendor pls help me

  • Problem of loosing the rights after sending to Reader Extension

    I am getting a strange error. I was having a perfectly working version of Reader Extension and Forms Server. I am creating a dynamic PDF Form using the Forms Server. This form is being updated using the Adobe Reader and then submitted back to my appl

  • Incremantal Run

    We are facing a problem regarding Incremental Run in Oracle Warehouse Builder Tool. We have created some mappings by which the data is extracted from the source and inserted into the target tables. Each time all the records are selected again and upd

  • IPod locked with Voice control

    My screen is locked and voice control is on, it won't allow me to open my phone in any way. What can I do to resolve this?

  • Split x2

    I was wondering if the HP Executive Pen works with the HP Split x2? Does Anyone know?