Query by current month

I have an excel spreadsheet that queries an oracle data for some information.  I am trying to get the information shown to only be from the current month.  I have tried my google-fu, but all of the formulas I have found will not work and return a various error of some sort. 
The rest of the query works great, but I cant figure this one out. 
Select
From
and I guess i need a where statement, but nothing seems to work. 
Where"My_Table_Name","OrderDate" .....

Try this
WHERE   date_column >= ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), - 1)
AND     date_column <  TRUNC (SYSDATE, 'MONTH')
Regards,

Similar Messages

  • SQL Query-return current month and the same month of last year

    hello-
    I would like to display the current month name, count of errors, year, and month number for both current year and previous year. Having trouble getting my query to display as following..... 
    Month   CountofErrors      Year      MoNo
    January                  57    2015          1
    January                 155   2014          1
    thank you!

    Its hard to answer without DDL and DML and sample data.
    Give a try
    select DATENAME(month,getdate()),Month(getdate()),YEAR(getdate()) ,COUNT(*) from dbo.errortable
    where DATENAME(month,getdate())='January' and YEAR(getdate()) in(YEAR(getdate()),YEAR(getdate())-1)
    group by DATENAME(month,getdate()),Month(getdate()),YEAR(getdate())
    --Prashanth

  • Get data for current month in VC from query - Urgent

    Hi all,
    I have designed a query for cube FIAR_C03 for overdue items and query output contains customer, net due date, document date, fiscal year period and amount. I want a chart for that query in VC that only contains those items in which net due date is in current month. How can i do that?
    Where I can place the condition to display only those items in vc in which net due date is in current month and how ?
    Please respond.
    Regards,
    Aisha Ishrat
    ICI Pakistan Ltd.

    Hi Aisha,
    It is possible to do with following steps:
    1. In Query Design make your field 'Net Due' filter with variable for date input (0CALMONTH for example where your date should be this format MMYYYY). Test your query and see if you input a month/year date it would would work;
    2. Build one table from output of your query (choose fields);
    3. In Visual Composer, drag your query into your board and from 'Varaiables' port  (NOT FROM INPUT) drag a line to create a Start point. As soon you realease to create 'Start' a box will ask which fields you want. Choose your date as field;
    4. Select the line between Start point a query. In Input Field assigned the following formula (DSTR(NOW(),'MMYYYY') *
    5. Deploy your model
    at this formula I said: transform NOW(), current date, in Text with format MMYYYY (012002 for example).
    It works!
    Assigned points if was helpful.
    Kind Regards,
    Gilson Teixeira

  • 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

  • SQL query to get last 6 months records neglect the current month

    Hi All;
    I need help with 
    sql query to get last 6 months records neglect the current month
    Any help much appreciated
    Thanks
    Pradnya07

    SELECT <> FROM tbl WHERE dt >=dateadd(month,-6,GETDATE())
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Customer exit in APO for current month in query

    Hi,
    I need to create a customer exit which automatically restricts 0calmonth on the current month in a query.
    How should I do this APO?
    Most important, Which table should I use to find the input, i.e current month and year?
    If possible please provide some code to show the solution.
    Best regards,
    Sebastian

    Use the standard SAP exit 0I_CLMTH.

  • Mdx query to get the last date of every month if the month is current month need current date..

    i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
    is it possible using MDX...

    Hi Shashi,
    According to your description, you want to return the last day for each month except current month, right?
    In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
    with member [measures].[a]
    as
    ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
    select {[measures].[a]} on 0,
    [Date].[Calendar].[Month].members on 1
    from
    [Adventure Works]
    And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • How set current month in Voyager using BEX Query 7.0

    Hi:
      I have a voyager workspace connected a SAP BI Query 7.0. My query shows information since 2007 to 2009
      How I can set current month in characteristics defined in slice section? I tried to use a exit variable in proposed values query section but it doesn't works, when I use filter section in my BEX query it show only  information for 1 month.
    Thanks
    Marta Díaz

    Hi,
    From the problem report i understand that you want to open the Voyager workspace with all the data, but want to analyze for only the current month. 
    You can achieve it in the following manner.
    a) Open the Voyager report.
    b) Click on the member selector of the slice.
    c) Deselect the default member and then select the current month.
    d) Click on OK button.
    This should show you the data for only the current month.
    If you want to make use of exit variable by using the SAP query designer then try using the current calendars month variable.
    You can also refer from the discussion below in the thread to create a variable.
    Dafault value previous month in BEx
    Hope this helps.
    Thanks

  • Determining Current Month Yr 0CALMONTH automatically in Input Ready Query

    Hi,
    Is there a standard way of Determining 0CALMONTH in an Input ready query so that when the user enters a line into the Infocube the current Month is stored into the 0CALMONTH field.
    Regards,
    Arun

    Hi.
    You can achive this by using characteristics relationship.
    Plz refer following [link|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0e3df0c-c370-2910-a696-96f5f38574d7&overridelayout=true].
    Regards.

  • Query for fiscal month till current month of year

    Hi,
    can you please help me to show only fiscal months till current month of year?
    e.g. Current month is Apr of 2012.
    I have to show the fiscal months till the Apr 2012 of year 2012.
    if the date is 24th of Apr then it would show May month also.
    Regards,
    Nilesh

    with t as (
    select to_date('04232012','MMDDYYYY') d from dual union all
    select to_date('04252012','MMDDYYYY') from dual)
    select
    d,
    case
    when to_char(d,'DD') >= 24 then
    to_char(trunc(add_months(d,1),'MONTH'),'MM-YYYY')
    else
    to_char(d,'MM-YYYY')
    end fin_month
    from t
    D     FIN_MONTH
    23.04.2012     04-2012
    25.04.2012     05-2012

  • SQL Query to add previous month amount to current month amount

    Beginner - Using SQL 2008 R2 - Having a difficult time adding previous month amount to current month amount on a continual running basis. Table fields and example data are:
    FunctionID    
    UnitID     
    Dateof           
    Result       YTD
    A                   AA           01/01/2014    10             10
    A                   AA           02/01/2014    10            
    20
    A                   AA           03/01/2014     15           
    35
    B                  BB            01/01/2014     20          
    20
    B                  BB            02/01/2014     10           30
    The YTD field would be a calculated field. I would need to be able start a new YTD in Jan of the next year. Really could use some help and direction on this one. Easy to do in an Excel spreadsheet. Can't seem to get it in SQL. Thanks in advance.

    As of 2008 R2 the choices are:
    - Self join
    - Correlated subquery (in the SELECT or APPLY clauses)
    - Cursor
    - SQLCLR aggregation function (winner)
    The first two options yield a poor performance for tables with considerable number of rows.
    Example:
    select
        A.*, 
        select
            sum(B.Result)
        from
            T as B
        where
            B.FunctionID = A.FunctionID
            and B.UnitID = A.UnitID
            and B.Dateof >= dateadd(year, datediff(year, '19000101', A.Dateof), '19000101') --bofyear
            and B.Dateof <= A.Dateof
        ) as YTD
    from
        T as A;
    Check these old but very interesting posts from Adam Machanic.
    http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/running-sums-redux.aspx
    http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/running-sums-yet-again-sqlclr-saves-the-day.aspx
    The things get easier from SS 2012 with the enhanced OVER clause (introduction of window frame extent).
    select
        sum(Result) over(
        partition by FunctionID, UnitID, year(Dateof) 
        order by Dateof
        rows between unbounded preceding and current row
        ) as YTD
    from
        T;
    http://sqlmag.com/sql-server-2012/sql-server-2012-how-write-t-sql-window-functions-part-3
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • Report for current day and current month

    Hi gurus,
    i 've a report, where i 've to display the values for qty and cost of the material for the current day and current month
    HOw can i do this in BEx Query designer..If any document plz share
    thanks
    rakesh

    hi Kolli
    here i want to filter the data on system date,
    i wnt the report to pick the date dynamically based on the system date.
    but i think restricting on calmonth and calday is not going to solve my scenario..
    rakesh

  • Calendar to get week number of current month

    Hi All,
    Description: Currently I am working on an application which require to calculate some data for current month from a database where I have the data of all the previous and current month of that year, I can take week number as criteria.
    Help Required: I can find week of month or year using Calendar methods but how to find the first week on the current month only.
    Lets suppose the current month is April so when I use, int weekofmonth = cal.get(cal.WEEK_OF_MONTH);
    it will return me the number of present week however I want to get what would be the week number at the start of the month (April).
    Hope I am able to describe my query properly.
    Thanks in advance.
    Amit

    / ====================================================
    Method: Get the desired Date format for the date
    Developed By: Sandip Waghole [29-Jan-2010]
    ==================================================== /
    public String getWeekNo(String strDate)
    // input Date Format : M/dd/yyyy
    int weekNo=0,i=0;
    String strWeekNo=null;
    int noOfDaysInTheYear=365;
    int WEEK_STARTS_ON = 1; // Define the day on which week starts Sunday/Monday 1:Sunday 2:Monday
    int firstDayNoInFirstWeekOfPresentYear=0; // Inititalize teh day on which week is starting in present year
    int firstDayOfPresentYear=0; // Inititlize the 1st day of the present year whether Sunday/Monday/.....
    int[] monthDaysArray = {31,28,31,30,31,30,31,31,30,31,30,31}; // Define array of the days as per months
    int todaysDayNoInPresentYear=0;
    int daysLateByFirstWeekStartedAfterYearStarted=0;
    int intTemp=0;
    //strDate="08/24/2000"; // For test purpose
    StringTokenizer strDateTok = new StringTokenizer(strDate, "/ ");
    int month = Integer.parseInt(strDateTok.nextToken());
    int day= Integer.parseInt(strDateTok.nextToken());
    int year = Integer.parseInt(strDateTok.nextToken());
    GregorianCalendar cal = new GregorianCalendar();
    // Check if present year is leap year
    boolean boolIsLeapYear = cal.isLeapYear(year);
    // If it is boolean year then add 1 to total days in the year & add one more day to february
    if(boolIsLeapYear)
    noOfDaysInTheYear=noOfDaysInTheYear+1;
    monthDaysArray[1]=monthDaysArray[1]1;
    // Find the 1st day of this year
    Calendar calObj = new GregorianCalendar(year, Calendar.JANUARY, 1);
    firstDayOfPresentYear = calObj.get(Calendar.DAY_OF_WEEK);
    int intRemoveNoOfDaysFromWeek=0;
    // # Find the day no of prsent day
    for(i=0;i<month;i+) // get no of days till present year
    intTemp = intTemp monthDaysArray;
    todaysDayNoInPresentYear = intTemp - (monthDaysArray[month-1]-day);
    if(firstDayOfPresentYear==6 || firstDayOfPresentYear==7) // If first Day is Friday or Saturday then it is week
    // Identify the the day no on which 1st week of present year is starting
    firstDayNoInFirstWeekOfPresentYear = 7 - firstDayOfPresentYear WEEK_STARTS_ON 1;
    // Find delay in the 1st week start after r=the year start
    daysLateByFirstWeekStartedAfterYearStarted = firstDayNoInFirstWeekOfPresentYear - 1;
    // Now week is starting from Sunday
    weekNo = (Integer)((todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted)/7);
    // Find the day no of today
    intTemp = (todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted) % 7;
    if(intTemp > 0)
    weekNo=weekNo+1;
    else
    weekNo=weekNo;
    else
    // 1st week is starting on 1st Of January
    firstDayNoInFirstWeekOfPresentYear=firstDayOfPresentYear;
    // Remove no. of days from the 1st week as week is starting from odd Sunday/Monday/Tuesday/Wednesday/Thursday
    intRemoveNoOfDaysFromWeek = 7-firstDayOfPresentYear 1; // 1 added as include start day also
    // So one week will be added in no. of weeks
    weekNo = (Integer)((todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek)/7);
    // Find the day no of today
    intTemp = (todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek) % 7;
    weekNo = weekNo +1; // As 1st weeks days are reduced from the todays day no in the year
    if(intTemp > 0)
    weekNo=weekNo+1;
    else
    weekNo=weekNo;
    // Remove the no. of days from the week 1
    strWeekNo=Integer.toString(weekNo);
    return strWeekNo;
    // Any issues please mail on [email protected] or [email protected]

  • SSRS Date parameter - current month from SSAS cube

    I have a SSAS cube with a date dimension called Posting Period and now I would like to have my report parameter using this date dimension to show the current month.
    So far I have worked out the following expression which are working(Fiscal year calendar going from May to May) for the year component - but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see
    the Quarter and month is hardcoded in the below expression:
    ="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
    Any help would be appriciated.
    Tx

    Hi HCMJ,
    In your scenario, you use the expression
    ="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
    to set the default value of the parameter and then use it in the MDX query, right?
    If in this case, you can use the expression below
    ="[PostingPeriod].[Posting Period].[Year].&[2013].&[Q" & DatePart(DateInterval.Quarter,today()) & "].&[10]”
    to set the value on Quarter date part.
    And it returns:
    If I have anything misunderstood, please point it out and elaborate the meaning of "but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see the Quarter and month is hardcoded
    ", so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Default value in a variable - current month

    Hi!
    I have a infoobject called CREATE_MONTH. My queries divides the result based on this month. If there are several month it summarize the result. The CREAT_MONTH is a free characteristics, and not defined in the main table.
    I want the current month value as a default. Is this possible?

    Hi.....
    As already told......You have to use an Offset for the variable...
    Check this :
    Re: How to create a variable in Bex Query Designer
    This will help you.........
    Regards,
    Debjani.........

Maybe you are looking for

  • Service Desk configuration

    Dear All, I am in the middle of the configuration of SAP Service desk, i am able to create message and message are going from Quality Server to Solution manager server fine, here i can view  the message, i am unable to properly process the message, l

  • IPod locks up with video on the TV

    I have a 80gb 5g ipod and i'm watching a movie on the TV from the iPod. If I try to stop the movie or it comes to the end, sometimes it LOCKS the iPod up and can't unlock it. 1st time I had to wait til the battery ran out. The 2nd time I took everyth

  • Hyp 9.3 FR CellText - Suppress data blocks that don't contain Cell text

    I'm creating a Financial Report that focuses on Data Blocks that contain Cell Text. The following function works when retreiving at a level one or higher Member for retrieving data. *<<CellText("Grid1", cur, A, 1)>>* The results of the function retur

  • Refreshing ALV contents

    Hi all.. I have a few input fields and a button....based on the input provided i display the data in an ALV table. Now i navigate the next view and create a new entry and save it. until i click on the button again im not able to see that new entry in

  • My iPhone shuts down at between 30% and 10% charge

    My iPhone charge only lasts half day generally and shuts down at anywhere between 30% and 10% charge. I have contacted apple and my battery is not part of the recall and they did a diagnostics report from the phone and say its fine. I can't upgrade f