Expression - First date and last date of current month, current year

Hi
I need to have 2 ssrs expression as I can use  as default parameters in my report where I can -  out from my Time dimension, get the
first date of the current, current year - and one where I get last date, current month, current year.
My data source is a SSAS cube and my timedimension is structured like this:
[Time].[Days].&[2009-01-16T00:00:00]
Any suggestions how to solve this ?

Hi ,
You can use below in Default Values in ssrs ;
for first Day of current month and year
="[Time].[Days].&[" +Format(dateadd("m",0,dateserial(year(Today),month(Today),1)), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-01T00:00:00]
For last day of current month and year
="[Time].[Days].&[" +Format(DateSerial(Year(Now()), Month(Now()), "1").AddMonths(1).AddDays(-1), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-30T00:00:00]
Please correct me if I misunderstood your requirement.
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.

Similar Messages

  • SQL select Statement -first day and last day of the month - 1 year from now

    Hi,
    I need to write a SQL to get the dates in between first day and last day of the month one year from now.
    SELECT last_day(add_months(sysdate,12)) as lastday from dual
    What could be the Query to get the first day of the month one year from now..
    ie ..Sysdate - 3-DEC-2009
    Result - 1-DEC-2010
    thank you

    Hi,
    You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
    SELECT  TRUNC ( ADD_MONTHS ( SYSDATE
                               , 12
                  , 'MONTH'
                  )     AS first_of_month
    FROM    dual
    ;The DATE returned will be in the same month, year, quearter, ... as the first argument.
    \We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
    At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
    For example, to find all appointment_dates in the current month next year:
    SELECT  *
    FROM    appointments
    WHERE   appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
    AND     appointment_date <  TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
    the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
    the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future.

  • First date and last date of current year

    Hi
    how can i get first and last date of current year, thanks for your help

    hi,
    use FM......... FIRST_AND_LAST_DAY_IN_YEAR_GET
    DATA: first LIKE sy-datum,
          last LIKE sy-datum.
    CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
      EXPORTING
        i_gjahr     = '2007'
        i_periv     = '24'
      IMPORTING
        e_first_day = first
        e_last_day  = last.
    WRITE: / 'First Date', first, '    Last Date', last.
    Regards
    CNU

  • How to calculate start date and last date for current week

    Dear All.
    i want to calculate the start of the current week as well as the last date of the current week, our week start from Saturday and ends of Friday i.e. Saturday is the first day of the week and Friday is the last day of the week.
    How can i acheive this in universe Designer?.
    Please help...

    Hi
    the formulas in webi will be as follows
    for startdate
    =RelativeDate(LastDayOfWeek(CurrentDate());-8)
    for enddate:
    =RelativeDate(LastDayOfWeek(CurrentDate());-2)
    Regards,
    Ranganath

  • Fm for Start Date,Middle Date and End Date

    Hi ,
    Is there any Fm which gives first ,middle and last dates of month.
    please help me out...
    Thanks in advance for the help,
    Sandy.

    Hi,
    Hope the following Threads will help you regarding your problem.
    Last Date of the next month
    Thanks.
    Nitesh

  • History - turn on columns "First Visited" and "Last Visited" replacing/instead of "Visit Date"?

    Sometime before Firefox 3.x, in the History window -- it would show you columns of "First Visited" and "Last Visited".
    Now you only get "Visit Date" which is equivalent to "Last Visited".
    * Question -- anyone know how to bring back the "First Visited" column to the History window?
    * I looked in about:config and couldn't find anything.
    * I searched for a Addon and didn't find a current one. (There used to be an Addon called Extended History Manager that would show that column but an administrator disabled the download page for it.)
    * Anyone know how to bring back the "First Visited" column?
    Having that column by default in the Mozilla suite browser. (pre Firefox) was awesome! And at least in Firefox 1 and 2 you could use Extended History Manager Addon. I miss "First Visited"! :(

    Hi Fractalogic, this support forums doesn't work very well as a suggestion box because of the volume of posts and the audience reading it. You can try the following to get more visibility on the proposal:
    * Help > Submit Feedback
    * Filing a request for enhancement on https://bugzilla.mozilla.org/
    You might also try recruiting any developer that created a useful history-related add-on to incorporate this feature.

  • How to find first and last date of a fiscal week using SQL

    Hello,
    I want information about FISCAL Week, means a Week based on ISO standard. I know format strings ‘IW’ or ‘IYYY’ gives fiscal week and fiscal year respectively from a given date. But I want to find the first and last date of a fiscal week. Say suppose I have a fiscal week is 2, and fiscal year is 2008, how to find the start and end date of the given fiscal week.
    Any kind of help would be greatly appreciable.
    Thanks,
    Prince

    davide gislon wrote:
    The following query evaluate the begin of a fisical week, where &year and &week are respectively the year and week you want to calculate.
    To evaluate the end of the week you have to add 6.
    Note that my database is set to have monday as day number 1 of the week, and sunday as day number 7; if your database settings are different you should modify the query accordingly.
    SELECT CASE TO_CHAR(TO_DATE('&year','YYYY'),'D')
    WHEN '1' THEN TO_DATE('&year','YYYY')+((&week-1)*7)
    WHEN '2' THEN TO_DATE('&year','YYYY')+((&week-1)*7-1)
    WHEN '3' THEN TO_DATE('&year','YYYY')+((&week-1)*7-2)
    WHEN '4' THEN TO_DATE('&year','YYYY')+((&week-1)*7-3)
    WHEN '5' THEN TO_DATE('&year','YYYY')+((&week-1)*7+3)
    WHEN '6' THEN TO_DATE('&year','YYYY')+((&week-1)*7+2)
    WHEN '7' THEN TO_DATE('&year','YYYY')+((&week-1)*7+1)
    END BEGIN_FISICAL_WEEK
    FROM DUAL
    Hope this is helpful.
    Cheers,
    Davide
    Edited by: davide gislon on 08-Jan-2009 07:19Your query does nothing you say it does. TO_DATE('&year','YYYY') returns first day of the current month for year &year. And the only reason it returns January 1, &year is that we are currently in January:
    SQL> select TO_DATE('&year','YYYY') from dual
      2  /
    Enter value for year: 2005
    old   1: select TO_DATE('&year','YYYY') from dual
    new   1: select TO_DATE('2005','YYYY') from dual
    TO_DATE('
    01-JAN-05
    SQL> As soon as we roll into February:
    SQL> alter system set fixed_date = '2009-2-1' scope=memory
      2  /
    System altered.
    SQL> select sysdate from dual
      2  /
    SYSDATE
    01-FEB-09
    SQL> select TO_DATE('&year','YYYY') from dual
      2  /
    Enter value for year: 2005
    old   1: select TO_DATE('&year','YYYY') from dual
    new   1: select TO_DATE('2005','YYYY') from dual
    TO_DATE('
    01-FEB-05
    SQL> alter system set fixed_date = NONE scope=both
      2  /
    System altered.
    SQL> select sysdate from dual
      2  /
    SYSDATE
    08-JAN-09
    SQL> But even if TO_DATE('&year','YYYY') would always return January 1, &year, or you would fix it to TO_DATE('0101&year','MMDDYYYY') it still would be wrong. ISO week rules are
    If January 1 falls on a Friday, Saturday, or Sunday, then the week including January 1 is the last week of the previous year, because most of the days in the week belong to the previous year.
    If January 1 falls on a Monday, Tuesday, Wednesday, or Thursday, then the week is the first week of the new year, because most of the days in the week belong to the new year.Therefore, next year:
    SQL> DEFINE YEAR=2010
    SQL> DEFINE WEEK=1
    SQL> ALTER SESSION SET NLS_TERRITORY=GERMANY -- enforce Monday as first day of the week
      2  /
    Session altered.
    SQL> SET VERIFY OFF
    SQL> SELECT CASE TO_CHAR(TO_DATE('0101&&year','MMDDYYYY'),'D')
      2  WHEN '1' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7)
      3  WHEN '2' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-1)
      4  WHEN '3' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-2)
      5  WHEN '4' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-3)
      6  WHEN '5' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+3)
      7  WHEN '6' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+2)
      8  WHEN '7' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+1)
      9  END BEGIN_FISICAL_WEEK
    10  FROM DUAL
    11  /
    BEGIN_FI
    04.01.10
    SQL> SELECT TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') FROM DUAL
      2  /
    TRUNC(TO
    28.12.09
    SQL> 2 user10772980:
    Use:
    SELECT  TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') + (&&week-1)*7 FISCAL_YEAR_&&YEAR._WEEK_&&WEEK
      FROM  DUAL
    FISCAL_YEAR_2010_WEEK_1
    28.12.09
    SQL> SY.

  • How to get first and last date of previous month

    To set default values in selection screen,I want first and last date of the previous month.
    Also I want the first and last dates of previous quarter.
    The quarters can be only january to march, apr to june, jul to sept, oct to dec.
    I want to run a program on beginning of each month by job scheduling having <b>selection screens</b> for the above monthly and quarterly dates.

    Hi Suhas,
    Use the below code.
    DATA: v_date LIKE sy-datum.
    DATA: v_month_begin_date TYPE sy-datum,
          v_month_end_date TYPE sy-datum,
          v_month(2) TYPE n,
          v_month1(2) TYPE n,
          v_quarter TYPE i,
          v_year(4) TYPE n,
          v_quarter_begda TYPE sy-datum,
          v_quarter_endda TYPE sy-datum.
    v_month =  sy-datum+4(2).
    IF v_month = '01'.
      v_month = '12'.
      v_year = sy-datum+0(4) - 1.
    ELSE.
      v_month = v_month - 1.
      v_year = sy-datum+0(4).
    ENDIF.
    CONCATENATE v_year v_month  '01' INTO v_date.
    CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
      EXPORTING
        iv_date             = v_date
      IMPORTING
        ev_month_begin_date = v_month_begin_date
        ev_month_end_date   = v_month_end_date.
    v_month1 = sy-datum+4(2).
    IF v_month1 = '01' OR
       v_month1 = '02' OR
       v_month1 = '03'.
      v_quarter = 1.
    ELSEIF v_month1 = '04' OR
           v_month1 = '05' OR
           v_month1 = '06'.
      v_quarter = 2.
    ELSEIF v_month1 = '07' OR
           v_month1 = '08' OR
           v_month1 = '09'.
      v_quarter = 3.
    ELSEIF v_month1 = '10' OR
           v_month1 = '11' OR
           v_month1 = '12'.
      v_quarter = 4.
    ENDIF.
    IF v_quarter = 1.
      v_quarter = 4.
      v_year = sy-datum+0(4) - 1.
    ELSE.
      v_quarter = v_quarter - 1.
      v_year = sy-datum+0(4).
    ENDIF.
    CALL FUNCTION 'HR_99S_GET_DATES_QUARTER'
      EXPORTING
        im_quarter = v_quarter
        im_year    = v_year
      IMPORTING
        ex_begda   = v_quarter_begda
        ex_endda   = v_quarter_endda.
    WRITE:/5 'previous month begin date : ', v_month_begin_date.
    WRITE:/5 'previous month end date   : ', v_month_end_date.
    WRITE:/5 'previous quarter begin date : ', v_quarter_begda.
    WRITE:/5 'previous quarter end date : ', v_quarter_endda.
    Message was edited by:
            Velangini Showry Maria Kumar Bandanadham

  • Get first and last date of month

    Hi,
      Is there any function module to get first and last date of month for a entered date.
    Please let me know.
    Regards,
    SP

    Hi,
    Use the below FM to find the Last day of month and them u can easily calculate the first day.
    DATA : v_startdate TYPE sy-datum.
    DATA : v_enddate TYPE sy-datum.
    DATA : v_temp TYPE dats.
    v_temp = sy-datum.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
        EXPORTING
          day_in            = v_temp
        IMPORTING
          last_day_of_month = v_enddate
    CONCATENATE  v_enddate+0(6)  '01'  INTO  v_startdate.
    Hope it helps.
    Regards,
    Arnab.

  • How  we claculate the first and last date of the month

    hi,
    I have a requirement, if i have the any date of a month like today date 02/13/2008. So i want the first date of this month and the last date of this month.
    Is there any FM for this..or if you have nay prorgam pls send to me.
    thanks.

    Hi Vipin,
    Try
    HR_JP_MONTH_BEGIN_END_DATE FM will return both first day and last day
    LAST_DAY_OF_MONTHS  for getting last day of month.
    Reward if helpful.
    Regards,
    Mandeep

  • First and Last Date.  Is is possible in Essbase?

    Hello All,<BR><BR>Here are the dimensions in my outline:<BR>- User<BR>- Application<BR>- Dates<BR>- Measures (Count, FirstLoginDate, LastLoginDate)<BR><BR>I am trying to create a report in Essbase that shows the first and last date that each user accessed each Essbase application. I created an ETL process that builds a relational table with one record for each unique combination of User/Application/Day where a user was logged into an application. This process gets its source data from the Essbase application log files. I am loading a count of 1 to each intersection of User/Application/Day. I also want to add the first and last day to the cube but can not figure out how.<BR><BR>1) Is there an easier way to get at the source data then the application log files?<BR>2) If the application log files are the way to go, how do I indicate in the cube what the first and last login days are for each combination of User/Application?<BR><BR>I was thinking of loading the serial dates to the FirstLoginDate and LastLoginDate measures. The trouble I am having is where to load the dates data. Do I load it to level 0 (individual dates) and then use time balance to get the dates up to the higher levels (month, year) or load it at the higher levels? If I should load it at the higher levels, do I assume correctly I will need to create another relational table with one record for each User/Application/Month and User/Application/Year that shows the first and last dates? Any other ideas?<BR><BR>Thank you in advance,<BR><BR>Bill Handelman<BR>847-989-1758<BR>[email protected]<BR><BR>

    While you may have natural ordering in your date dimensions, Essbase doesn't handle first and last dates well. The one area where ther is at least some funcionality in date manipulation is inattribute dimensions, however, the easy use there allows only one date attribute using normal date processing. It gets a great deal more complex using two dates.<BR><BR>Look up the DBAG references to the date type of attribute dimensions, you might find it a partial solution to your problem.<BR><BR>If you go the serial date method, load at level 0 and want to use time balance to bring the values up, you still need a time dimension. If I were designing something, I might use the first access date as a time dimension and the last access date in an attribute dimension, but I'm rambling rather than analyzing.<BR><BR>In any case, look at the date type attribute dimension as one possible option for your cube.

  • Getting first and last dates of a month

    Jello all,
    I am really sorry I am posting this topic here, not actually owned by this forum but in fundamental forum i am not getting it attended.
    I am generating monthly, quartelry and yearly reports, for which I need to get first and last dates of a given Month taking in to account leap year. I searched the API and docs for Calendar class. I could not find any useful methods / fields. I wonder this being a very common requirement, how SUN has not provided these essential features. I still feel, it must be some where. Please help me and reply. Also if you came across any other forum for util package, let me know.
    Thanks
    Varde

    Jello all,
    I am really sorry I am posting this topic here, not
    actually owned by this forum but in fundamental forum
    i am not getting it attended.
    Yes, and I can see you are a very patient person, waiting a whole half hour for a response before cross posting other boards.
    Question answered.
    http://forum.java.sun.com/thread.jsp?thread=514908&forum=31&message=2451646

  • To get first date and end date after entering any month and year

    Hi,
    I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
    I am reading the fields as,
    Properties props = new Properties();
    props.load(new FileInputStream("AnyMonthVolume.properties"));
    String date_month = props.getProperty("date_month");
    String date_year = props.getProperty("date_year");
    Thanks.

    I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
    Calendar cal = Calendar.getInstance();
         cal.setTime(new java.util.Date());
         cal.set(Calendar.DATE, 1); //set the date to start of month
         cal.add(Calendar.MONTH,1);
         cal.add(Calendar.DATE,-1);
    System.out.println(cal.getTime());

  • Show data of last day of previous month against any day of current month

    Hi,
    I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
    Any suggestion ???

    You're asking to filter your data set to only include rows between:
    1) last day of the previous month
    2) any day of the current month
    This can be achieved with prompting in OBIEE Answers.
    last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
    In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
    For the 'last day of previous month' , use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    For the current date, use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

  • Ora-01847 day of month between 1 and last date of month coming in my query

    i m executing simple query but it is not working plz do help
    select *
    from sgvf_tree_nodes_vw
    where to_date(node_attr9_val, 'dd/mm/yyyy') between
    to_date('01/01/2010', 'dd/mm/yyyy') and
    to_date('31/12/2010', 'dd/mm/yyyy')
    gives : Ora-01847 day of month should be between 1 and last date of month

    Hi,
    Check the date format's once
    SQL> drop table demo;
    Table dropped.
    SQL> create table demo(val number, todate varchar2(12));
    Table created.
    SQL> insert into demo values(1,'04/11/2008');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from demo;
           VAL TODATE
             1 04/11/2008
    SQL> select sysdate from dual;
    SYSDATE
    03-FEB-11
    SQL> insert into demo values(1,'04/11/2010');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select *
      2  from demo
      3  where to_date(todate,'dd/mm/yyyy') between to_date('01/01/2010', 'dd/mm/yyyy') and to_date('31/12/2010', 'dd/m
    m/yyyy');
           VAL TODATE
             1 04/11/2010- Pavan Kumar N

Maybe you are looking for

  • Several namespaces in root element

    Hi, I'm using JDOM and I would like to create an XML document that starts like this: <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-1.0" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0" xmln

  • Pixel artifacts and other graphical irregularities after install

    Hello all. Just did an archive and install of Leopard, and everything seems to be working right--except there are odd graphical irregularities popping up in windows. An example of what I'm talking about is here: http://just-in.org/etc/artifacts.png Y

  • SRKIM: Release 11.5.10 에서 Personal Home Page Mode 사용 여부

    PURPOSE ===== Release 11..5.10 의 Profile 'Self Service Personal home Page Mode' 에서 'Personal Home Page' 를 지원 하는지 알아 보도록 한다. SOLUTION ======= Release 11.5.10에서는 더 이상 'Personal Home Page' mode를 지원 하지 않는다. Oracle 은 현재 MOD_PLSQL 을 사용 하지 않는 작업을 진행 중에 있기 때

  • EMac doesn't respond on name and password.

    Hi, Some specs first: eMac, 2003, 10.4.11, 1Gb 700MHz. PPC G4 Running this eMac for years today something very strange happened. Starting up, the Inlog screen asked me for my name and password. Didn't accept. Tried System Administrator plus password,

  • JSF + Ajax4JSF Error

    Hi, I used Ajax4JSF components in my JSF JSP page. Some times the users are getting the following error when they are accessing the components related to Ajax4JSF. They are getting the error on a pop-up window and the error is: Request Error, Status