First and last values of this month

Hi ,
In my reporting I want to calculate average value based on amount.
Avg = ( Starting amount of this month + Ending amount of this month) / 2.
How can i get the starting value and ending value for one field "Amount".
I changed the <b>amount</b> properties as Sum, Last value and based 0calday.
but for the same amount how can I get the starting value.
(NOTE: Starting value is not equal to the last month last value).
The data is coming based on day wise.
Suggest me ...
Thanks in advance....
Regards
Rajesh

Dear Rajesh,
Can you tell me which cube you are working with, and what is the key figure ?
What you can do is have a RKF which will have a selection variable for fiscal year period for the current month(which could be a user entry and mandatory entry).
Now create a copy of the above RKF and use a off set of -1 for the variable fiscal year period.
now the valu you get from the first RKF will be the month end balance and the value you get for the second RKF will be the closing balance of previous month, which is nothing but the opening for the user inputed month.
Now you can create a CKF to get the average.
Hope the above helps, If yes please assign reward points
regards
Venkata Devaraj

Similar Messages

  • Message Mapping, First and last values in a CSV file

    I'm having problems with a Message Mapping that requires me to take the values from the first line in a CSV and the last line to calculate other values...
    The source message type in my mapping is as follow
    <MT_Message>
        <Header>                  1..1
             <ID>
             <StartDate>
             <EndDate>
       <Records>                 1...unbounded
               <Interval>
               <Number>
    I need to take the first row/occurence of Records and use this to calculate the Startime. I also need to take the last occurence of Records to calculate the stop time
    This is my CSV file content
    H     FORECASTS      20080101     20081231     17568
    D     20080101     1     1     66.29283
    D     20080101     1     2     61.1344
    D     20080101     2     1     61.1344
    In this case I need to take  the values 1     1 for the StartTime and 2    1 for the StopTime.
    How can this be done?

    Damien,
    Do  u have problem with mapping or content conversion. According to my understanding the problem is with content coversion. U can't take the first and last values in CSV file. Probably u can import all the values and during mapping u can seggregate the required structure alone.
    Best regards,
    raj.

  • 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

  • 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

  • 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

  • How to find first and last day of previous month?.

    Based on current month, I want to find start and end day of
    previous month.
    For example,
    For august, Start date is July 1st and End date July 31st.
    How can i get first of previous month as start date and last
    day of the previous month as end date?.
    Same way,
    i want to find start date of current month and end date of
    next month.
    Example:
    For august,
    i want to get start date, august 1st and end date : september
    30.
    How can i do this from current date or now().
    I am looking for best and easy way to find start and end
    dates..
    Thanks

    <cfset today = now()>
    <cfset firstOfThisMonth = createDate(year(today),
    month(today), 1)>
    <cfset lastOfNextMonth = dateAdd("d", -1, dateAdd("m", 2,
    firstOfThisMonth))>
    <cfoutput>
    today = #today#<br>
    firstOfThisMonth = #firstOfThisMonth#<br>
    lastOfNextMonth = #lastOfNextMonth#<br>
    </cfoutput>
    Edit - To find the start and end day of previous month, get
    the first of THIS month. Use Subtract 1 month ("m") to get the
    start date. Subtract 1 day ("d") to get the end date.

  • To display first and last dates of a month

    I have the date format in 10 Mar 10.
    My requirement is when ever I select the any date in the dashboard for whole month it should display whole month results.
    I got query in obiee101.blogspot.com.but if I use that sometimes it is not returning the last day results. Any body please give me the query to display results for first day and lastday?
    Ex:if I select any day in the drop down of the prompt it should display whole month results
    If I select either 1 mar 10,2 mar 10,30 mar 10.....
    It should give the results for whole month of march.
    Can you please provide me the query for last month also?
    If I select march date in date print want to display whole march results in one column,previous month results in other column
    Anybody help me to get this done?

    Yes, you are correct. In John's SQL for last day of the month, if the "last day of the previous month" ends on the 30th, than "adding one month" will result in the 30th of the following month. But if the following month has 31 days, you miss that day.
    Use this for the last day of the current month.
    TIMESTAMPADD(SQL_TSI_DAY, -1,TIMESTAMPADD(SQL_TSI_MONTH,1,TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY, DAYOFMONTH(CURRENT_DATE)*-1, CURRENT_DATE))))
    The above SQL will ensure that you will always get the last day of the "current month" regardless of how many days are in the previous or current month.

  • First and Last date of any Month.

    Hi Friends,
    I have 2 fields in my table
    FROM DATE & TO DATE
    User can enter any date in these two fields, but at time of commit i want to change the FROM DATE to the first date of the Month user have entered. And for TO DATE i want to change the last date of the month.
    For Example :
    User Enters-
    FROM DATE 12-Mar-2003
    TO DATE 27-Jun-2003
    I want to change these date to:
    FROM DATE 01-Mar-2003
    TO DATE 30-Jun-2003
    How can I write a database function or procedure to control this thing.
    Please help.
    Best regards,
    Imran Baig

    It depends on your requirements, but I usually use TRUNC(date, 'D')
    to get the first day(Sunday) of the week, because TRUNC(date, 'W')
    returns the same day of the week as the first day of the month.
    See http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a85397/function.htm#80101
    for more info on this.

  • TSQL Query to display First and Last Values of a GROUP as Columns - SQL Server 2008

    Could someone please help with the TSQL to achieve the following: Every Employee has 2 records (From & To). Output has to display one record for each employee with From & To as columns.
    Input
    Empid
    Type
    Date
    100
    From
    5/4/2004
    100
    To
    6/2/2008
    101
    From
    6/12/2003
    101
    To
    6/2/2013
    102
    From
    12/12/2012
    102
    To
    5/3/2014
    Output
    EmpID
    From
    To
    100
    5/4/2004
    6/2/2008
    101
    6/12/2003
    6/2/2013
    102
    12/12/2012
    5/3/2014
    Thanks, Ashish Singh

    SELECT empid,
    MAX(CASE WHEN Type='From' THEN date END) from,
    MAX(CASE WHEN Type='To' THEN date END) to
    FROM tbl GROUP BY empid
    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

  • Get First and last day of Month..

    Hi Friends,
    I am trying to fetch First and Last day of a month and would like to implement that in the following code:
    SELECT COALESCE(Date_A, Date_B, Date_C)
    FROM dual
    Here Date A and B are in Format of MM DD YYYY (March 14, 2008)
    and Date C is like MM YYYY (March 2008)
    How can I get the Date_C as March 1, 2008 OR March 31, 2008 format if Date A and B are NULL ?
    Thanks!
    Edited by: user11095386 on Apr 23, 2009 10:45 AM

    Hi,
    In my earlier message, I thought that you were starting with strings like '03 12 2009' and that you wanted to display them as 'March 12 2009'. If what you have is just the reverse, then just reverse the format strings in my first message. Add a comma, if you want one, in the appropriate format string.
    I believe this is what you want:
    COALESCE ( TO_CHAR ( TO_DATE ( Date_A, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_B, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_C, 'fmMonth YYYY'),    'MM DD YYYY')
             )Notice how, on the 3rd line, TO_DATE is called without DD in the format string:
    TO_DATE ( Date_C, 'fmMonth YYYY')When you do this, the day defaults to the 1st of the month, so this is all you have to do to convert the VARCHAR2 'March 2009' to the DATE 01-Mar-2009.
    If you want the last day of the month, not the first, when Date_C is chosen, then use LAST_DAY:
    COALESCE ( TO_CHAR ( TO_DATE ( Date_A, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( TO_DATE ( Date_B, 'fmMonth DD YYYY'), 'MM DD YYYY')
             , TO_CHAR ( LAST_DAY ( TO_DATE ( Date_C
                                              , 'fmMonth YYYY'
                 , 'MM DD YYYY'
             )

  • FM for First and Last Day_Current Month

    Hello All,
    Inorder to update the TVARV table, two new variables were needed which will get the First and Last Day of current month.
    One FM i was able to find was BKK_GET_MONTH_LASTDAY which takes the Todays date and outputs the Last date of the month. IS there any FM for FIRSTDAY Current month....
    Regs,
    -PSK

    Hi Sravan,
    Following help may help you.
    FM - BUILD_PERIOD_TABLE
    code is mentioned below.
    data: it_cperiod type table of range_prds with header line,
    define one variable as range like -
    ranges: r_cperiod for sy-datum,
    CALL FUNCTION 'BUILD_PERIOD_TABLE'
        EXPORTING
          YEAR         = <current year>
        TABLES
          PERIOD_TABLE = it_cperiod.
      read table it_cperiod with key per_id = <current month>
      refresh r_cperiod.
      r_cperiod-sign = 'I'.
      r_cperiod-option = 'BT'.
      r_cperiod-low = it_cperiod-begda.
      r_cperiod-high = it_cperiod-endda.
      append r_cperiod.
    Now, you can see begin and end of moth in r_cperiod.
    Regards,
    Parag

  • How to find first and last day of last month?.

    Hello,
    I am using Crystal Report XI.
    Reports will be generated on first of every month for
    previous month. I want to find start and end date of previous month
    dynamic.
    For august, Start date is July 1st and End date July 31st.
    For September, start date is Aug 1st and Aug 31st.
    How can i get first of previous month as start date and last
    day of the previous month as end date?.
    Same kind of thing I want to do for future report ..find next
    month start date and end date.
    Thanks

    Adomacro,
    you could do a function, like this
    <cffunction name="getReportdates" returntype="struct"
    hint="Given an arbitrary month and year, the function returns a
    structure containing the first and last day of the previous
    month">
    <!--- Take current month and current year as the default
    --->
    <cfargument name="mnth" type="string" required="No"
    default="#monthAsString(month(now()))#">
    <cfargument name="yr" type="numeric" required="No"
    default="#year(now())#">
    <cfset firstDayOfGivenMonth = parseDateTime("1 " &
    arguments.mnth & " #arguments.yr#")>
    <cfset lastDayOfPreviousMonth =
    dateAdd("d",-1,firstDayOfGivenMonth)>
    <cfset numberOfDaysOfPreviousMonth =
    daysInMonth(lastDayOfPreviousMonth)>
    <cfset firstDayOfPreviousMonth =
    dateAdd("d",-#numberOfDaysOfPreviousMonth#,firstDayOfGivenMonth)>
    <cfset reportDates = structNew()>
    <cfset reportDates.firstDayOfPreviousMonth =
    firstDayOfPreviousMonth>
    <cfset reportDates.lastDayOfPreviousMonth =
    lastDayOfPreviousMonth>
    <cfreturn reportDates>
    </cffunction>
    <!--- Example usage --->
    <p>
    Given month: <strong>March
    2004</strong><br>
    begin date:
    <cfoutput>#dateFormat(getReportdates('March',2004).firstDayOfPreviousMonth,"d
    mmm yyyy")#</cfoutput><br>
    end date:
    <cfoutput>#dateFormat(getReportdates('March',2004).lastDayOfPreviousMonth,"d
    mmm yyyy")#</cfoutput><br>
    </p>
    <p>
    Given month: <strong>August
    2007</strong><br>
    begin date:
    <cfoutput>#dateFormat(getReportdates('August',2007).firstDayOfPreviousMonth,"d
    mmm yyyy")#</cfoutput><br>
    end date:
    <cfoutput>#dateFormat(getReportdates('August',2007).lastDayOfPreviousMonth,"d
    mmm yyyy")#</cfoutput><br>
    </p>

  • Get first and last day given month name with combobox

    hi guys ;
    I loaded to month name in combobox and I want to get first and last day by the name of month from selected Combobox
    So if I select to february than results get 01.02.2015 and 28.02.2015
    if select March than 01.03.2015 and 31.03.2015
    Thanks .

    Thank you for useful post , How to change Culturinfo as a Turkish Month name ?
    your's code is work if I use English month name But it was get error when use the turkish month name
    If you are running your application on a Turkish Windows you could use the System.Globalization.CultureInfo.CurrentCulture:
    int month = DateTime.ParseExact(monthName, "MMMM", System.Globalization.CultureInfo.CurrentCulture).Month;
    Or you could use create an explicit culture object like this:
    System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("tr-TR");
    int month = DateTime.ParseExact(monthName, "MMMM", ci).Month;
    Please remember to mark all helpful posts as answer to close your threads.

  • After installing some updates on final cut pro 7 is asking me to enter my first and last names plus serial number which i dont have. how do i go about this?

    After intalling some updates for Final cut, I m asked to put my first and last names and serial number which unfortunatelt i do not have. how do i go about this?

    To add to what BenB advised, make sure you have proof of purchase when you call Apple for a replacement serial number.
    For future reference, it is a good idea to keep all software serial numbers in a database or text document.  Considering the cost of the software, keeping a list of serial numbers can come in very handy at times like this.
    -DH

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

Maybe you are looking for