Last 6 months of data based on date feild that is an integer data type

Hi Folks
I have a date column called 'YYYYMM' that is an Integer data type in YYYYMM format (eg. 201309). I want to return records from the last 6 months. 
If the column was in a date format I could use something like 
[YYYYMM] >DATEADD(M, -6, CURRENT_TIMESTAMP)
Therefore I assume I need to do a CONVERSION of INT into a date format with something like
CONVERT (DATE, [YYYYMM]
But I get the message  "Explicit conversion from data type int to date is not allowed"
Can someone suggested a work around?
Many thanks Steve

another way is this
SELECT *
FROM Table
WHERE DATEADD(mm,(dateintfield%100)-1,DATEADD(yy,(dateintfield/100) -1900,0)) >=DATEADD(mm,DATEDIFF(mm,0,GETDATE())-6,0)AND DATEADD(mm,(dateintfield%100)-1,DATEADD(yy,(dateintfield/100) -1900,0)) < DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Last 6 months of data from current date

    Hi Experts,
    I have a requirement in WebI to display last 6 months of data based on current date.Actually I have a column called "Employee Contract Start date" in my report.Suppose the end user executes the report today,then he should be able to see the Employee's data whose contract started today and in the last 6months from current date.
    Also I have dimension object name "Employee Contract Start Date".
    Please be noted that I am getting the data from Bex Query and I am working on BO 4.1 version.
    I have Objects "Calender day" , "Cal.year/Month" , "Calender month" , "Employee Contract Start Date" in the BEx Query.
    Could anyone please propose me, what are the ways to meet this requirement?

    Hi Cris,
    We can get the 6 Months date in webi.
    Check the below blog , will help you.
    http://scn.sap.com/community/businessobjects-web-intelligence/blog/2014/01/21/time-variablesdimensions
    Regards,
    Javed

  • Find historic of all the websites I went to in the last 6 months (need date), sadly about 3 months ago I seem to have clean out all my browser history

    I would like to check when I went on specific website in the last 5 months but my browser history start only 3 months back. I had some issues with yahoo over taking my browser and I had to remove and reinstall firefox. Is there somewhere in my apple macbook pro a place where my browser history will be stored?

    You would have to restore an older copy of the places.sqlite file via the Time Machine if you have that enabled on your Mac.
    *http://www.apple.com/support/timemachine/
    Note that this will replace both the history and the bookmarks, so you will have to backup the bookmarks to an HTML file or restore the current version of places.sqlite after you are done.

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • Terrible data bleed on iphone 5/ATT the last two months

    I have an iphone 5 and it has always been very easy to manage my data.  The last two months my data usage has DOUBLED for no apparent reason.
    I shut the phone down at night, and also turn off wifi/cellular data before shutting it down.  I've even resorted to putting it in airplane mode also once I noticed this trend.
    The increased data numbers seem to be primarily coming from:
    MAPPING SERVICES (which I am not using/is disabled on all settings!)
    and
    ITUNES (also not using/disabled on all settings)
    I have everything disabled on this phone to the point of it pretty much being a "dumb phone" now.  I use wifi almost all day and have cellular data shut down.
    I spent an hour on the phone with ATT the other night and they are "investigating".
    There is no reason my data usage should be doubling suddenly, when my habits and settings have not changed.
    Anyone else seeing this?  I am ready to dump this phone.

    Hello there dot2222,
    It sounds like you are seeing some extremely high data usage all of a sudden on your phone, even though you disable cellular and even Wi-Fi regularly when not in use. Excessive data usage can be hard to troubleshoot, but lets see what we can do. I would start with the basics, because since it popped up so suddenly. Quit all the running apps first:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    When you have done that and restart the phone and test the issue again:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If the issue persists, use the following article to troubleshoot the cellular data connection starting at step 3, working your way down from there.
    iPhone: Troubleshooting a cellular data connection
    http://support.apple.com/kb/TS3780
    This will lead you to a resolution if this is a software issue, which it seems to me to be.
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • How to calculate a rolling 12 months to date calculation?

    Hi there
    We have a business requirement to calculate a rolling 12 month to date value. That is, for any month, sum up the last 12 months of data. E.g. for June 2011, its May 2010 -> June 2011. We have the standard Year and Period dimension, and the member which holds this calculation is in another dimension called TimeView. TimeView just holds dynamic calculations for Month To Date(MTH), Year To Date (YTD) etc.
    The problem I am having is because we have the standard Year and Period dimensions so I need to do a cross dimensional sum. All the solutions I am trying either give me an insufficient dynamic calc cache (increase lock block setting) or something similar. Our lock block setting is quite high and it doesnt seem to make a difference when I increase it.
    Anyway, I have tried a few solutions:
    Short one:
    @SUMRANGE("MTH",@MDSHIFT(@CURRMBRRANGE(Period,LEV,0,1,),-1,"Year",)) + @SUMRANGE("MTH",@CURRMBRRANGE(Period,LEV,0,,0));
    Long one:
    IF(@ISUDA(ACCOUNT,"Flow"))
         IF(@ISMBR(Jan))
              YTD->Jan + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Jan,-1,"Year",);
         ELSEIF(@ISMBR(Feb))
              YTD->Feb + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Feb,-1,"Year",);
         ELSEIF(@ISMBR(Mar))
              YTD->Mar + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Mar,-1,"Year",);
         ELSEIF(@ISMBR(Apr))
              YTD->Apr + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Apr,-1,"Year",);
         ELSEIF(@ISMBR(May))
              YTD->May + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->May,-1,"Year",);
         ELSEIF(@ISMBR(Jun))
              YTD->Jun + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Jun,-1,"Year",);
         ELSEIF(@ISMBR(Jul))
              YTD->Jul + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Jul,-1,"Year",);
         ELSEIF(@ISMBR(Aug))
              YTD->Aug + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Aug,-1,"Year",);
         ELSEIF(@ISMBR(Sep))
              YTD->Sep + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Sep,-1,"Year",);
         ELSEIF(@ISMBR(Oct))
              YTD->Oct + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Oct,-1,"Year",);
         ELSEIF(@ISMBR(Nov))
              YTD->Nov + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Nov,-1,"Year",);
         ELSEIF(@ISMBR(Dec))
              YTD->Dec
         ELSEIF(@ISMBR(Q1))
              YTD->Mar + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Mar,-1,"Year",);
         ELSEIF(@ISMBR(Q2))
              YTD->Jun + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Jun,-1,"Year",);
         ELSEIF(@ISMBR(Q3))
              YTD->Sep + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Sep,-1,"Year",);
         ELSEIF(@ISMBR(Q4))
              YTD->Dec
         ELSEIF(@ISMBR(H1))
              YTD->Jun + @MDSHIFT(YTD->Dec,-1,"Year",) - @MDSHIFT(YTD->Jun,-1,"Year",);
         ELSEIF(@ISMBR(H2))
              YTD->Dec
         ELSEIF(@ISMBR("YearTotal"))
              YTD->Dec
         ENDIF
    ELSEIF(@ISUDA(ACCOUNT,"First"))
         MTH->Jan;
    ELSE
    MTH;
    ENDIF
    I am sure this may be a common requirement across companies - does anyone know a solution to this?
    Much appreciated!

    Closing this thread, just needed to increase cache levels.

  • Sql to retrive the last 12 months

    Hi,
    I want to show two values which is last 12 months
    Start Date-->01/01/2009
    End Date--->01/01/2010
    Based on these two values in my OBIEE i need to construct a report.How can i achieve this in sql?
    thanks,
    saichand.v

    hi,
    But in order to get the Start Date and End Date ....
    in that format i need to get an sql
    Start Date:SELECT TRUNC(ADD_MONTHS(SYSDATE, -12),'MM') FROM dual (01/01/2009)
    End Date : I didn't get the query which have to show like 01(/01/2010).How to achieve this with sql
    thanks,
    saichand.v
    Edited by: Saichand Varanasi on Jan 19, 2010 12:33 PM

  • Filter from the last 12 months

    Hello
    I want to create a filter that shows the last 12 months os date. I am connect to a SQL database in which the database field is a date type. How do I create a filter that compares the actual date y and database field with the date. I can do it SQL by doing a where

    Hi,
    The following link will help you,
    [http://www.controlfreaks.nl/sites/default/files/BO%20universe%20date%20filters.pdf]
    Regards,
    Ragoth.C
    Edited by: Ragoth.C on Oct 7, 2011 9:19 AM

  • Query to show items not used in last 12 months

    Can anyone help with a query or is there a was in B1 to pull a report of item that have not had activity in the last 12 months?

    I drilled into one item that I knew we are still using. The date on my inactive report was 01/01/07. This is what was displayed in inventory posting.
    Posting Date     Document     Whse     Qty     Price after Disc.     Balance
    210070                         1,329
    1/2/2008     SO 3133     1     -560     $0.05      769
    1/29/2008     ST     1     231     $0.05      1,000
    1/31/2008     SO 3231     1     -585     $0.05      415
    1/31/2008     SO 3235     1     -415     $0.05      
    2/7/2008     PD 2898     1     5,500     $0.00      5,500
    2/8/2008     SO 3261     1     -642     $0.00      4,858
    2/12/2008     PU 6801     1          $249.98      4,858
    3/10/2008     SO 3429     1     -1,281     $0.05      3,577
    3/19/2008     SO 3520     1     -1,335     $0.05      2,242
    3/28/2008     PD 3065     1     5,500     $0.05      7,742
    4/3/2008     PU 7204     1          ($0.27)     7,742
    4/16/2008     SO 3756     1     -1,308     $0.05      6,434
    5/2/2008     SO 3884     1     -1,265     $0.05      5,169
    5/5/2008     SO 3946     1     -1,368     $0.05      3,801
    7/10/2008     SO 4494     1     -643     $0.05      3,158
                             3,158

  • 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!

  • Showing last n months data based on prompt

    Hi,
    I have a "reporting month" prompt like Mar'13 .The report should return last 12 months data for all the measures based on "Reporting Month" prompt and my result will look like below:
    Measures  Mar' 13 Feb 13 Jan 13 ....
    CORP        1345     1444     1555
    ERP           675       877       5678
    I have used a pivot view to get the table view like this but i am not sure how to use the logic for showing all Months .Kindly suggest.

    Hi,
    You can achive this at answers level with the help of presentation variable using "Last N months(Rolling months) data By year-month prompt in OBIEE".
    pl follow the below post.
    http://shivabizint.wordpress.com/2008/09/19/rolling-months-data-for-year-month-prompt-in-obiee/
    thanks

  • Counting date transactions for last six months

    Post Author: crystalrook
    CA Forum: Formula
    Any help is greatly appreciated.  I am running Crystal XI.
    I have an order field (PurchaseOders.PODatePlaced) for each item. There can be multiple orders in the same month for each item of course.  I would like to COUNT each  PurchaseOders.PODatePlaced based on the month it was purchased for the last six months from a date parameter.
    My table looks like this"
    Item            PODatePlaced
    1234           11/12/2007
    1234            11/20/2007
    1234            10/15/2007
    1234            9/30/2006
    1234            12/5/2007
    1234             12/6/2007
    I am trying to get the results to read as follows (only for the last 6 months):
    Items          December         November     October
    1234               2                      2                1
    Thanks for your help

    Post Author: crystalrook
    CA Forum: Formula
    I am adding a cross tab to an existing report so many of the fields are already in the report. I would like to only add the month fields and a count of the transactions. Can this be done?  In the group options how can I tell it to only use the last six months reguardless of activity for the month.  Current results are giving every date as a column.  Can I only get the months to be columns?
    Any suggestions?

  • Last three month data

    Hi,
    Requirement:
    Want to show last three months data dynamicaly based month value seleted in prompt. ex: When Septemper is selected report should show, Sep, Aug, Jul
    tried using ago function but i want to use three measure columns. So is there way using single measure column and achieving.
    Thanks,
    Satheesh

    Satheesh Kumar  wrote:
    Hi,
    Requirement:
    Want to show last three months data dynamicaly based month value seleted in prompt. ex: When Septemper is selected report should show, Sep, Aug, Jul
    tried using ago function but i want to use three measure columns. So is there way using single measure column and achieving.
    Thanks,
    SatheeshSatheesh, I have a question for you. It is the same as the comment left on the article in the link that @user gave you. Like that link -- which doesn't work for all scenarios, how are you accounting for say the month of January? Without a "year" included, you cannot always "subtract 3" to get "3 months ago." Does "month" always correspond to the current year?
    Finally, what are the values of the column the filter is to be applied? All these are important to know if you want help on this. Try again. Thanks.

  • Last month with data  - BEx variable

    Hi guys,
    I am using in the query the char 0CALMONTH to restrict the KF amount, just to get the last month of data that was loaded in the infocube. I tried with content variables but none of them are working. I used 0CYMONTH or 0CMLMON.
    the only thing that I want is to get from the cube always the last month with data that was loaded.
    Do I need to create a customer exit? does anyone has the code to give me?
    any help¡?
    thank u.
    E.V.

    Hi,
    two alternatives:
    VarExit: perform a select statement on your cube joined with your time dimension; or even directly on your time dimension something like:
    SELECT MAX(SID_0CALMONTH) FROM /BIC/D<cube>T.
    This will give the last CALMONTH with posted data in absolute (not considering your query selection)
    <i>Replacement path variable based on a query: create a query which has to return one record an 0CALMONTH in the columns. Put a TOP1 condition on one of your KeyFig. In your original query restrict 0CALMONTH with a variable of type replacement path on the TOP1 query. The advantage of this alternative is that you can get the last CALMONTH posted with data RELATIVE to your query selections if you move your variables input from the user to the TOP1 query...</i>
    Sorry, the above won't work it out; I just has the same requirement and implemented the varexit reading the time dim table.
    hope this helps....
    Olivier.
    Message was edited by:
            Olivier Cora

  • 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

Maybe you are looking for

  • How do i change the image path at run time in wpf ?

    I have a button and i need to show image two different image based on condition.  <Button x:Name="btn" MouseEnter="btn_MouseEnter_1"> <Button.Template> <ControlTemplate TargetType="Button"> <StackPanel Width="43"> <Image Name="btnS" Source="Resources

  • Error while Reading Idocs from ECC 6.0 to Sun IDM .

    Hi Gurus, We have a scenerio where we have to update the Sun IDM Server with all the changes in HR Data happening in ECC. For that... we have 1. Created a Logical System for Sun IDM server, Port, RFC Connection (TCP/IP). 2. Assigned Partner Profiles,

  • Logitech H800 Wireless Headphones Not Working with Yosemite

    I have an iMac 27" late 2012, 2.9 HGz i5. After installing Yosemite, I no longer get sound via my Logitech H800 headphones. The system recognizes that the USB mini wireless connecter is attached. It also pairs with the headset. However, no sound. I h

  • Urgent - Please help me on Linera Refrencing System-LRS

    Oracle Spatial - Linear Referencing System (LRS)question We are building a Highway Database management system and would like to implement Oracle Spatial- Linear Refrencing System-LRS . I have found some example at http://technet.oracle.com/docs/produ

  • Unable to default custom PR dcoument Type (ZNB) thourgh MRP Run if Quota

    Hi All, I have maintained default subcontracting PR document type (ZNB)  for MRP Group in OMDT transaction. But when I ran MRP unable to default PR (ZNB), if I have maintained Quota arrangemnet for subcontracting Material. Without Quota arrangment, a