Creating a Date Variable

Hello,
I'm trying to query for a range of dates Month, Year to Month, Year
As you can see, the current format of my tables are that [month] = # (1 is January, 2 is February, etc) and [year] in two separate fields.
How do I create a variable where it takes both month and year fields into a useable date format where I can query a range of months.
For example, if I want to query October 2013 - March 2014, the fields for [month] and [year] would be 10,2013; 11,2013; 12,2013; 1,2014; 2,2014; 3,2014

How can I query this variable? Do I have to create the variable in the universe rather than the report? And will the system recognize this as a date format?
Does it matter if I used /? Is it possible for the formula to register the month name instead of a number (ex. Jan-2014 instead of 1,2014)
This is what it looks like so far:

Similar Messages

  • Create current date variable at universe level

       Hi Everyone
    I have created report regarding to daily car sales. However there is records registered for further months, 2015 December for instance.
    Actually they are error records, but I can't delete them since data transfer is realizing automatically and updates hourly.
    That is why I have decided to use prompt for report: date is less or equal to current date. But couldn't find way how to create current date variable.
    Please help with this.
    Regards...

    Yes.
    Create an object called Today as:
    cast(convert(char(10),getdate(),23) as datetime)
    Note that it will not parse because it does not reference a table. Don't associate it with a table just to get it parsing as you will then have that table in every query that uses the Today object, whether you want it or not!
    It will work fine when you use it in your query. In your example, create a condition of Ship Date Less Than Or Equal To Today where Ship Date and Today are the names of the two objects. This will then translate into SQL as:
    WHERE orders.ship_date <= cast(convert(char(10),getdate(),23) as datetime)
    This will parse because the table orders is in the statement.
    I hope that is clear.
    Regards,
    Mark

  • Formula date variable ,which is processing by 'Customer exit' with ready in

    Hi ,
    I need to create 1 variable which takes date from user and do some calculation.irrespective of any date char.
    so I have created Formula date variable ,which is processing by 'Customer exit' with ready input .
    But when selection screen pop up date formula variable comes with the format yyyymmdd.
    but i need dd.mm.yyyy. i have checked my profile and it is dd.mm.yyyy.
    Waitin for reply

    Hi Babu
    Did you get the answer to the query....if yes please drop me a mail on this as I have the same requirement and thanks in advance...
    my id   [email protected]
    REgards
    Amit

  • Passing a Date variable to SQL

    Hi,
    I am trying to pass in a Date variable into SQL query, but I am getting this error:
    "inconsistent datatypes: expected DATE got NUMBER"
    and my code looks like this. I would appreciate any help on how I need to create the Date variable that SQL would accept it.
    THANKS A LOT!
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
    String txt = "01/01/1990";
    java.util.Date startYear2 = (java.util.Date) formatter.parse(txt, new ParsePosition(0));
    java.sql.Date startYear = new java.sql.Date(startYear2.getTime());
    String txt2 = "12/31/1990";
    java.util.Date endYear2 = (java.util.Date) formatter.parse(txt2, new ParsePosition(0));
    java.sql.Date endYear = new java.sql.Date(endYear2.getTime());
    String scoredGoalsQuery = "SELECT count(name) from player_goal_rel where name = '" + pName + "' and pdate BETWEEN "+ startYear +" and "+ endYear;
    ResultSet scoredGoalsResult = stmt.executeQuery(scoredGoalsQuery);

    You should be using prepared statements.
    String scoredGoalsQuery = "SELECT count(name) from player_goal_rel where name = ? and pdate BETWEEN ? and ?":
    PreparedStatement pstmt = connection.prepareStatement(scoredGoalsQuery);
    pstmt.setString(1, pName);
    pstmt.setDate(2, startYear);
    pstmt.setDate(3, endYear);
    ResultSet scoredGoalsResult = pstmt.executeQuery();

  • Create a formula variable using replacement path for current date

    Hi All,
    I created a formula variable using replacement path for current date.
    But when i used this variable am getting an error message saying .
    " This Variable cannot be used in this query".
    Could you please let me know the reason?
    Thanks,
    Zehra

    Hi All,
    Thanks for all your help...
    I just found a solution via the below link
    in Bex Formula variabel, Current calander day(sap exit) missing.
    Here he is trying to use the existing formula variable.
    My doubt here is, Even i could not find this varaible in BEX formula variable, But could see this in BI Content path as mentioned in the above link.  DO i have to transport this varaible , or i simply can activate it in production?
    I just could find this in BI Content but not in MetaData Repository.
    Thanks,
    Zehra

  • Error while creating a Characteristic Variable with Replacement Path

    Hi all,
        I am trying to create the Characteristic Variable ZVLOWDT (Low Date') with Replacement Path on characteristic ZSTARTDT (Start Date) and it gives the error 'Source to replace 'Low Date' is not defined.
       I have created a User Entry Variable VAR_DATE (Start Date) with interval like '01/01/2009 - 01/15/2009'  and  Customer Exit variable ZVCPDAY (does some calculation based on the input of VAR_DATE) on the same ZSTARTDT characteristic. I want to get the 01/01/2009 (lower range date of the selection) into this Characteristic Variable ZVLOWDT. We are in BI 7.0 and the following are it's properties:
    General Tab:
    Description: Low Date
    Technical Name: ZVLOWDT
    Type of Variable: Characteristic Value
    Processing by: Replacement Path
    Reference Characteristic: ZSTARTDT Start Date
    Details Tab:
    Variable Represents : Single value
    Variable is: Mandatory
    Variable is Ready for Input : unchecked
    Replacement Path Tab: Replacement Rule
    Replace Variable with : Variable
    Variable : VAR_DATE
    Replace with : KEY
    Why I am getting this error, PLEASE ?
    Thanks,
    Venkat.

    Hi Khaja,
       We could derive a Variable value from another Variable with out Customer Exit. There is a white paper.
    First have the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next create the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we could get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error  'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path, PLEASE ?
    Thanks,
    Venkat.

  • Date Variable in Obiee 11g

    Hi All,
    I have created a dynamic repository variable that gives the current date. The date is given in the following format 'MM/DD/YYYY'. This is format that I want the date to appear in. In the presentation catalog, I have created a presentation variable dashboard promt called StartDate, that defaults to the repository variable CurrentDate. I have also created a report that has a number of measures filtered in different ways. If we take one of the measures in the report, what I have done is edited the formula to filter the measure by reported_date>Date'@{StartDate}'.
    Now when I got and see my dashboard I get an error, 'Datetime value 06/07/2011 from 06/07/2011 does not match the specified format'. However when I click 'Apply' on the prompt, the error does not appear and it just says that there is no data for this report.
    Can someone please help me solve this problem?
    Thanks,
    Nikita

    I solved this issue by using steps listed here http://gerardnico.com/wiki/dat/obiee/cast_as_date.
    Thanks

  • How to create a date range in Web Application Designer

    I am using 3.1 version of Web App Designer.  I need to create a report with date ranges.  I can get one date to work but not two (I need a start date and end Date).  My Query has 0CALMONTH with a variable for Interval.  When I select it as a dropdown (??) in Web App Designer, I only get one date prompt in web app designer.
    Any suggestions??
    Thanks
    Kristen

    Hi Kristen,
    I'm sorry i'm not coming to solve your problem,but for the trouble I have had,and I want to create a date picker in Web Application Designer,so if you have solved the problem ,please email to me? [email protected] ,thx very much!
    best regards
    zegion chan

  • Creating WIM ECC variables

    Hi,
    We have installed CIM 9.0.1 and UCCE 9.0, we are able to pass the default activity_id and customer_name to ICM in the user.cim.activity.id and user.wim.customer.name.
    But we want to pass the customer email which is available in CONTACT_POINT_DATA attribute
    we have created a ecc variable in ICM called Call.user.cim.contact.point.data and have created a call variable in CIM called CONTACT_POINT_DATA. but we are not able to obtain this value in the ICM script.
    Please suggest the correct procedure to create ecc variables for WIM 9.0.1.
    Thanks
    Kishore B

    HI Dilip,
    This is fixed in CIM 9.0.2 where you can tag custom attributes to call variables and map them to icm ecc variable in the queue config
    Regards
    Kishore B

  • Key Date variable; Interval in query properties for Time Dep. Masterdata

    Hi,
    I've been searching on the forum, and I think I know the answer already, but still I'd like
    to ask you all whether it's possible to create a Key Date Interval variable to be used in the query properties.
    As far as I can see you can only report by a single key date used in the query properties field for time dependant masterdata, but my customer has asked me to investigate the possibility to enter a date range.
    As all masterdata is time dependant I don't see how this would work, but if someone can shine a light on this maybe there is a solution available?
    Thanks for your help.
    M.

    Hi marc
    I understand your problem.
    I had an idea for a workaround.
    If you can create master data compounded with Valid from and Valid to both of these characteristics , how the query is computing
    the keyfigures.
    Every change in valid from or valid to is unique for the system in this case.
    Thanks
    N.Ganesh

  • Date variable- delivery report

    Hi all,
    In my report, there are two structures designed :- Pending deliveries and Reservation deliveries.
    For Pending deliveries:
    I have used Confirmation Del Date(ZCNFDT) and Open Qty as the restrictions. The Date variable is built upon Confirmation Delivery Date, In selection screen if i input a date as Dec-1, i get the pending qty for week1, week2, week3.
    For Reservation deliveries:
    I am using Requirement Date(ZBDTER) and the Requirement Qty as restrictions.
    My doubt is if i create a variable as ZVAR_BDTER on Requirement date, i will be having another date input in the selection screen, asking for the desired date to be entered. If i enter a date for this date selection then the query will display wrong data.
    According to the Specs, the input date variable must be common for both Pending and Reservations, such that, if i enter Dec 1, it must give the data for both Planning and Reservations.
    I am planning to use 0DATE variable for both of the above structures. Requesting you to suggest on this
    Thanks

    y cant u use 0CALDAY and then create variable for it
    use same 0CALDAY in query design in rows below ur characteristic COMPANY CODE

  • How to Create & Manage data slices easily?

    Hi All,
    We have lots of Business units; everyone works independent to each other, so they might be in different versions at any point of time.
    My requirement is to lock all previous versions, should allow them to work on current version.... so it should be a combination with Business Unit and Version.
    For ex:
    Business Unit 100 has current version 5
    Business Unit 200 has current version 3
    Business Unit 500 has current version 15
    So how can I create simple data slice to manage every business unit with their respective versions locked.
    After reading some of the threads:
    I considered creating data slice for each Business unit but we have 45 units.. with one VERSION customer exit variable to populate the variable from my ztable.
    I want to know more about how to use exit class? (CL_RSPLS_DS_EXIT_BASE)
    Will that help me much better than what I have considered above?
    OR any better way to tackle my problem?
    Thanks in advance
    Guptha

    Hi,
    I think here a simple exit data slice implementation would work. No variables would be needed at all. A feature often overlooked is the 'is_overlapping' method. Here one will get the filter of the planning function, query before the 'is_protected' method is called per record. So when the query / planning function is called the method 'is_overlapping' is called. Here one can read the Z-table with the allowed business unit, version combinations allowed to plan. This Z-table can be read using the restrictions form the filter (i.e. i_tsx_selder table or call seldr_to_range to get a easier to consume range table). Buffer the result in an internal table.
    In the 'is_protected' implementation simply lookup the internal table records and decide whether the records is protected or not.
    Using the 'is_overlapping' method on can set R_IS_OVERLAPPING = rs_c_false if the filter of the planning / function query has not non-empty intersection with the Z-table. Then the system will not call the is_protected method at all.
    Regards,
    Gregor

  • Calendar prompt for Date variable from bex

    Hi All,
    I have a Bex query where I have a variable on 0CALDAY
    - Customer exit (i_step = 1 to populate with current date)
    - Single value
    - Mandatory
    I created universe on this query and in webI selection screen i do see the variable prompt.
    I am not able to see the current date populated automatically since exit values are not populated to WebI at runtime.
    My problem is that in WebI selection screen we get list of date values from the info provider instead of Calendar prompt
    where user can enter the values directly.
    I am currently on BO XI 3.1 SP3.
    Is there any specific setting in Universe or bex query which is required to get this Calendar prompt instead of list of values for dates?
    Note: When we were on SP1 the universe created then had same variable from bex and it still shows us Calendar prompt but ever since we upgraded to SP3 for the query splitter functionality we not able to get the calendar prompt for date variable in new universe we create
    Thanks
    Ritesh

    Yep.
    Now tell me how you want to show that Prompt @ WebI report level.
    My problem is that in WebI selection screen we get list of date values from the info provider instead of Calendar prompt
    where user can enter the values directly. Exactly, i didn't get this??
    @Prompt:
    You have flexibility to show options like:
    Mono/Multi: User can select Single value or Multiple.
    BW Variable: Same we have (Single/Multiple)
    Free/Constrained: User can Enter his/her value directly or No change option.
    BW Variable: By defalut you will get this, once you made it to Optional input.
    Persistent/Not_Persistent: Refreshed report has to show last selected value means use Persistent otherwise Not_P.
    By seeing the Prompt syntax , I can say your Variable is after Customer Exit, Correct??
    Workaround for your Problem is:
    <FILTER KEY="ZV_DATE"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Date (Previous Day)','A','Date\LovDate (Previous Day)Base',mono,primary_key)"/></CONDITION></FILTER>
    You have to remove that Date class and objects from prompt syntax. Because of that it showing up LOV's not calendar.
    Like:
    <FILTER KEY="ZV_DATE"><CONDITION OPERATORCONDITION="Equal"><CONSTANT TECH_NAME="@Prompt('Date (Previous Day)','A',',mono,primary_key)"/></CONDITION></FILTER>
    Why, It should be blank??
    Because Date needs no class\object to show up, by default you will get Calendar on the fly.
    Hope you got my point.
    Thank You!!

  • Creation of Dynamic Date Variables to be used in WebI reports

    What we are trying to achieve is to create 4 optional filters (Current Day, Current Week, Last Week, Last Month) on 4 different dates which will allow the users to use them in WebI reports.
    When using an optional SAP Customer Exit variable in BEx and creating a Universe on top, the filter becomes mandatory (i.e. the whole Universe is filtered by the SAP Exit, irrespective of whether the filter is used in the WebI report). Even if the filter is flagged as optional at the Universe level, it still behaves as mandatory.
    If each filter becomes mandatory then we'll have to create 16 different Universes (for each optional filter and date combination)! This is not feasible.
    I've seen in other posts that MDX Statements are not currently supported for Universes base on BW and SAP Exit should be utilized.
    So with the existing BO version, is it possible to create optional dynamic date variables or is that a product limitation?
    We are on XI3.1 SP3 FP3.1
    Thanks

    Hi Adam,
    In BEx, I would create this query very easily using the "Amount" key figure twice in my results and restricting each with a different SAP standard out-of-the-box delivered variable. For your reference, the variables in BEx are: 0FPER and 0FYTLFP.
    If I expose these variables in my OLE DB for OLAP query, they are not transfered into the universe, but rather act as filters on the entire universe. I've seen in documentation that only "Ready for Input" variables can be transfered as options into the universe which is not something that I have seen mentioned in this thread.
    >> In the BEx Query you have the option to either make the variable "ready for input" or not. The behavior is the same in Bex or in the Universe / Web Intelligence. "Ready for input" means the user can actually provide an input and without the flag the user can not provide an input. Yes those variables are supported in the Universe.
    Why this is a problem: I can't create separate universes based on potential variable periods that users might want to see. Additionally, many financial reports require concurrent use of these measures in the same report. Also, in reality it's not 2 variables, but dozens.
    >> Which is a decision you make already on the BEx query level. if you decide that the variable is not ready for input then the user can change the timeframe in BEx either.
    Also, I don't have a good way to mimic the standard out-of-the-box functionality given with BEx in BO. If I custom create all my variables in the universe, how do I do a lookup from the system date to the fiscal calendar that is stored on the BW server? In other words, how does BO know which date belongs in which period? (the same would be true with factory calendars for a different functional area).
    >> Variable are created in the BEx query and the Universe will leverage those.
    If you want a dynamic date range then EXIT variable as part of the BEx query - ready for input or not - is the solution.
    regards
    Ingo Hilgefort
    The only work around I can see is to require users to enter the current fiscal period and have the BO reports filter based off that user entered value. This is unfortunate as the entire purpose of SAP Exit variables is to avoid having to require user input at report time.

  • How can i add one month to a date variable ?

    Unlike the week which always 7 days, month may change from 28 to
    31, so how can i add one month to a date variable ? Thanks in
    advance.

    Adding 365 won't always work because of leap years.
    You could use the following SQL statement:
    SELECT
         TO_DATE(
              TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                (TO_CHAR(TO_DATE(SYSDATE), 'YYYY') + 1)) NEXT_YEAR
    FROM
         dual
    NEXT_YEAR
    08-JAN-03Or you could create your own function. You would use this
    exactly like add_months:
    CREATE OR REPLACE FUNCTION add_years
         (v_date DATE, num_years NUMBER)
    RETURN DATE AS
         v_year DATE;
    BEGIN
         v_year := TO_DATE(
                   TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                         (TO_CHAR(TO_DATE(SYSDATE), 'YYYY')
                                             + num_years));
         RETURN v_year;
    END;     
    SELECT
         add_years(SYSDATE, 1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-03
    SELECT
         add_years(SYSDATE, -1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-01

Maybe you are looking for

  • Dump when summing up CURR field in ALV GRID display

    Hi All, I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23.  I am using classes and methods to display alv grid. I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even d

  • Photoshop, Automate a gradient?

    This is what I have come up with so far, but at the bottom you can see i am a little stuck. Any suggestions? Please tell application "Adobe Photoshop CS5.1"   activate           set ruler units of settings to point units           tell current docume

  • Faces Scan

    I imported all my photos back from Aperture 2 to iPhoto 09 and I don't think it ran the faces scan. Any idea if you can manually run the faces scan? Thanks.

  • PartKey

    Hi, Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi I have two issues: 1. Drop partitioning key from the existing partitioning key columns i.e. multi-key to single key. The table given below is an existing table which is partitioned

  • How to configure log4J ?

    Hi All, Can anyone please let me know how to configure log4J in portal? I searched in sdn, help.sap and market place, but in vain. Could n't really get any help. Thanks in advance -Sudheer