Sum a by previous month's date range

Hello,
i am having trouble creating a formula for the following.
sum(,,) in minimum(Lastfullmonth)-1 and in maximum(Lastfullmonth)-1
can anyone help me out with this formula?
thanks
david
Edited by: davitali on Nov 22, 2011 2:54 AM

Hi David,
If you're using CR 2008, you can make use of the advanced cross-tab features available.
Follow the steps below to create a calculated member (a.k.a row or column):
1) In the Preview mode, right-click the column header that shows the last month. Considering September as the last month, Right-click the column header > Calculated Member > Insert Column
2) A column with a blank header and zero values comes up after September
3) Right-click the blank column header and select Calculated Member > Edit Header Formula. Type this in the editor:
"Difference"
4) Now, the blank column header displays the text 'Difference'
5) Next, right-click one of the zero values in this column and select Calculated Member > Edit Calculation Formula. Type this formula:
Gridvalueat(currentrowindex,currentcolumnindex-1,currentsummaryindex) - Gridvalueat(currentrowindex,currentcolumnindex-2,currentsummaryindex)
The Crosstab would now display the difference between the two months.
To change the font color of the value try this:
1) Right-click one of the values from the column and select Format Field > Font tab > click the formula button beside Color and use this formula:
if CurrentColumnIndex = 1 then
    if currentfieldvalue < Gridvalueat(currentrowindex,currentcolumnindex-1,currentsummaryindex)
    then crRed else crGreen
else
crNoColor
If you have not suppressed the Row Totals or if the Row Totals is the 1st Column, then the formula might color the column beside Total (October) instead of the last (September). Just change the value of CurrentColumnIndex in the above formula to 2.
Let me know how this goes!
-Abhilash

Similar Messages

  • Previous month first data and previous month last date

    can any body have query to get previous month first date and previous month last date.
    Ex: First day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY,-6, (TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)))
    Last day of the previous week:
    TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)
    can anybody have it for first day of the previous month,last day of the previous month?
    Edited by: user12255470 on Apr 7, 2010 3:30 AM

    Hi,
    1st day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1) + 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE))
    last day of previous month :
    TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)))
    Please mark Q answered and award points for correct answers !
    Thanks
    Alastair

  • Previous month last date in sql

    hi
    i am using function
    select dateadd(day,1 - DATEPART(day,dateadd(month,24-36,GETDATE())),dateadd(month, 24- 36, getdate()))
    this will giveme 2014-03-01,
    now what changes  i need to make this function which will give me previous month last date.
    2014-02-28

    Hi coool_sweet,
    The answers in above posts are excellent. In case you may need any tip for date calculation, here is a good link for your reference.
    Date and Time Data Types and Functions - SQL Server (2000, 2005, 2008, 2008 R2, 2012)
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Previous month end date

    hello,
    i would like to find out the previous month end date when i give the input any date .
    finding previous month end date.
    eg :-> if i give the date as 02-Jan-2008, the result should be 31-dec-2007
    if i give the input date as 10-nov-2007, the previous month end date is 31-Oct-2007
    etc...

    ME_XE?select the_date, trunc(the_date, 'MM') - 1 as las_day_prev_month
      2  from
      3  (
      4     select add_months(sysdate, level) as the_date from dual connect by level <=12
      5  );
    THE_DATE                   LAS_DAY_PREV_MONTH
    02-FEB-2008 08 58:30       31-JAN-2008 12 00:00
    02-MAR-2008 08 58:30       29-FEB-2008 12 00:00
    02-APR-2008 08 58:30       31-MAR-2008 12 00:00
    02-MAY-2008 08 58:30       30-APR-2008 12 00:00
    02-JUN-2008 08 58:30       31-MAY-2008 12 00:00
    02-JUL-2008 08 58:30       30-JUN-2008 12 00:00
    02-AUG-2008 08 58:30       31-JUL-2008 12 00:00
    02-SEP-2008 08 58:30       31-AUG-2008 12 00:00
    02-OCT-2008 08 58:30       30-SEP-2008 12 00:00
    02-NOV-2008 08 58:30       31-OCT-2008 12 00:00
    02-DEC-2008 08 58:30       30-NOV-2008 12 00:00
    THE_DATE                   LAS_DAY_PREV_MONTH
    02-JAN-2009 08 58:30       31-DEC-2008 12 00:00
    12 rows selected.
    Elapsed: 00:00:00.12
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Previous month end data for report

    Hi expert,
    I have to calculate previous month end data for my report.
    let say if user select 15 oct then he should be able to see 30 sept data.
    I have calander prompt.
    Thanks,

    Hi,
    Use presentation variable in date prompt.
    Apply sql filter(covert to sql) on report as date_column= TIMESTAMPADD(SQL_TSI_DAY,-DAYOFMONTH(date 'presntation_variable'),date 'presentation_variable')
    Refer : How to get LAST_DAY in obiee
    Regards,
    Srikanth

  • FOX to read previous month's data

    Hi Guys, i have the following FOX to calculate LINE '57' but cannot read previous month's data.
    please assist.
    DATA LINE TYPE ZBPLINE.
    DATA FISCPER TYPE 0FISCPER3.
    DATA PREV_MONTH TYPE 0FISCPER3.
    DO.
    PREV_MONTH = TMVL (FISCPER , -1) .
    {0BALANCE,FISCPER ,57} = {0BALANCE,PREV_MONTH,57} + {0BALANCE,FISCPER,12}.
    FISCPER  = TMVL(FISCPER , 1).
    IF FISCPER  > PREV_MONTH.
    EXIT.
    ENDIF.
    ENDDO.

    Lerato,
    I am not sure how is your data model, but here are a couple tips
    DATA LINE TYPE ZBPLINE.
    DATA FISCPER TYPE 0FISCPER3. ->>>>>  This sHould probably be 0FISCPER
    DATA PREV_MONTH TYPE 0FISCPER3. ->>>>>  This should probably be 0FISCPER
    data finalmonth type 0FISCPER3. ** or 0fiscper!
    finalmonth = TMVL(FISCPER , 12).
    *initialize you fiscper
    fiscper = '201001'. * or call a variable
    DO.
    PREV_MONTH = TMVL (FISCPER , -1) .
    {0BALANCE,FISCPER ,57} = {0BALANCE,PREV_MONTH,57} + {0BALANCE,FISCPER,12}.
    I am not sure what is 57 and 12. Is it your planning item?
    FISCPER = TMVL(FISCPER , 1).
    This exit if statement should be like this
    if FISCPER  > finalmonth.
    EXIT.
    ENDIF.
    ENDDO.
    Hope that helps
    Alex Zetune
    goldstrategy.com

  • To get previous month's data

    Hi
    My report requirement:
    Display current month and previous month's data (sal) next to each other based on the month selected as a current month.
    Expression I'm using at the moment:
    case when trunc(lag(dt,1,dt) over (partition by ename order by dt),'MM') = trunc(add_months(dt,-1),'MM')
    then lag(sal,1,sal) over (partition by ename order by dt)
    However, instead of 'dt' I'm trying to use a parameter (dt as a current month's dt).
    This gives me an error message.
    Can anyone guide me on this?
    Thanks and regards,
    Aparna

    Why not simply join the table with itself? I.e. join the two months data sets and have a single row containing current and previous month results
    Simplistic example. We have a YEARLY_TOTALS table where the primary key is MONTH in the date format YYYY/MM. You can then compare the sales totals per month of this year with that of last year using the following type of SELECT construct:
    SELECT
    cur.month,
    cur.sales as CURRENT_SALES,
    prev.sales as LAST_YEAR_SALES
    FROM yearly_totals cur
    JOIN yearly_totals prev
    ON ADD_MONTHS(prev.month,12) = cur.month
    WHERE cur.month >= TRUNC(SYSDATE,'YY')

  • Fetching previous month's date

    Hii,
    Can anyone  provide me the code for retrieving firstWorkingDay for previous month ??

    Hi,
    Please check code:
    import java.text.*;
    import java.util.*;
    public class DateUtils {
      public enum IntervalType {  Month, Week  }
      private DateUtils() {  }
      public static Calendar[] getDateIntervals(IntervalType type, Calendar reference) {
        if (reference == null) {
          reference = Calendar.getInstance();
        Calendar startDate = (Calendar)reference.clone();
        Calendar endDate = (Calendar)reference.clone();
        if (type == IntervalType.Month) {
          // first date of the month
          startDate.set(Calendar.DATE, 1);
          // previous month
          startDate.add(Calendar.MONTH, -1);
          // first date of the month
          endDate.set(Calendar.DATE, 1);
          // previous month, last date
          endDate.add(Calendar.DATE, -1);
        else {
          // previous week by convention (monday ... sunday)
          // you will have to adjust this a bit if you want
          // sunday to be considered as the first day of the week.
          //   start date : decrement until first sunday then
          //   down to monday 
          int dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek  != Calendar.SUNDAY) {
            startDate.add(Calendar.DATE, -1);
            dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek != Calendar.MONDAY) {
            startDate.add(Calendar.DATE, -1);
            dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
          // end date , decrement until the first sunday
          dayOfWeek = endDate.get(Calendar.DAY_OF_WEEK);
          while (dayOfWeek  != Calendar.SUNDAY) {
            endDate.add(Calendar.DATE, -1);
            dayOfWeek = endDate.get(Calendar.DAY_OF_WEEK);
        return new Calendar[] { startDate, endDate };
      public static void main(String[] args) {
        try {
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
          System.out.println("** previous month (relative today)");
          Calendar [] results = DateUtils.getDateIntervals(IntervalType.Month, null);
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous week (relative today)");
          results = DateUtils.getDateIntervals(IntervalType.Week, null);
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous month (relative jan 1, 2007)");
          results = DateUtils.getDateIntervals(IntervalType.Month,
            new GregorianCalendar(2007, 00, 1));
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
          System.out.println("** previous week (relative jan 1, 2007)");
          results = DateUtils.getDateIntervals(IntervalType.Week,
            new GregorianCalendar(2007, 00, 1));
          System.out.println(sdf.format(results[0].getTime()));
          System.out.println(sdf.format(results[1].getTime()));
        catch (Exception e) {
          e.printStackTrace();
        output :
        ** previous month (relative today)
        2008-06-01
        2008-06-30
        ** previous week (relative today)
        2008-06-30
        2008-07-06
        ** previous month (relative jan 1, 2007)
        2006-12-01
        2006-12-31
        ** previous week (relative jan 1, 2007)
        2006-12-25
        2006-12-31
    this will solve all your requirements!
    Thanks
    Pravesh

  • Last day of previous month for data load

    Hi,
    I have to load data from the previous month into the psa and then into an infocube. I was wondering as to how to get the last of the previous month to write a code in ABAP. I will be writing the code at the infopackage level in the data selection. I could load data from the 1st of the previous month to the 1st of the current month. This will be an additional load of 30,000 records for the 1st of every month, since I will be loading 30,000 records everyday, I was wondering if I could limit the load from the 1st of every previous month to the last day of that month. This will be a repetitive loading.
    DATA: CURR_MM(2) TYPE N,
    CURR_YYYY(4) TYPE N,
    CURR_DD(2) TYPE N,
    PREV_MM(2) TYPE N,
    PREV_YYYY(4) TYPE N,
    PREV_DD(2) TYPE N,
    YYYY_MM(6),
    YYYY_MM1(6),
    DATE LIKE SY-DATUM.
    DATE = SY-DATUM.
    CURR_YYYY = DATE+0(4).
    CURR_MM = DATE+4(2).
    CURR_DD = DATE+6(2).
    PREV_DD = 1.
    IF CURR_MM = '01'.
    PREV_MM = '12'.
    PREV_YYYY = CURR_YYYY - 1.
    ELSE.
    PREV_MM = CURR_MM - 1.
    PREV_YYYY = CURR_YYYY.
    ENDIF.
    concatenate PREV_YYYY PREV_MM PREV_DD into YYYY_MM.
    concatenate CURR_YYYY PREV_MM PREV_DD into YYYY_MM1.
    read table l_t_range with key
    fieldname = 'BLDAT'.
    l_idx = sy-tabix.
    l_t_range-low = YYYY_MM.
    l_t_range-high = YYYY_MM1.
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.
    p_subrc = 0.
    Mind you this code will load data from 1st of the previous month to the 1st of current month. I just don't want to load that extra "1st day" of current month data as I have 30,000 records everyday.
    Say for example, I want to load data from 1st Mar to 31st Mar or 1st Feb to 28thFeb. How should I modify the above code.
    Is there a formula to get the last date of the previous month. That's all I need. This would solve the problem.

    try this routine. it will return a range from 1st day to end of the month.
    DATA: l_s_range TYPE rsr_s_rangesid,
              E_T_RANGE TYPE  RSR_T_RANGESID.
    DATA: year(4) TYPE n,
          month(2) TYPE n,
          day(2) TYPE n,
        ld_keydate  TYPE sydatum,
          ld_lastday  TYPE sydatum.
      REFRESH e_t_range.
      CLEAR l_s_range.
      year  = sy-datum(4).
      month = sy-datum+4(2).
    *Months with 31 days in year
      IF month = '01' OR
         month = '03' OR
         month = '05' OR
         month = '07' OR
         month = '08' OR
         month = '10' OR
         month ='12'.
        day = '31'.
      ENDIF.
    *check for leap year: provoking sy-sybrc <> 0
      IF month = '02'.
        day = '29'.
        MOVE:   '02'        TO ld_keydate+4(2),
                year        TO ld_keydate(4),
                day         TO ld_keydate+6(2).
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            date   = ld_keydate
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <> 0.
          day = '28'.
        ENDIF.
      ENDIF.
    *months with 31 days in year
      IF month = '04' OR
         month = '06' OR
         month = '09' OR
         month = '11'.
        day = '30'.
      ENDIF.
      MOVE: year              TO ld_lastday(4),
            month             TO ld_lastday+4(2),
            day               TO ld_lastday+6(2).
      l_s_range-low  = sy-datum.
      l_s_range-high = ld_lastday.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      APPEND l_s_range TO e_t_range.

  • Sum an amount between a certain date range

    Hello,
    I am working out a home budget and want to know how to calculate what is due this month.
    I have two columns - "Amount" and "Due Date". Some content for an example is:
    Amount,Due Date
    20,15/05/2009
    300,16/05/2009
    40,1/06/2009
    What I want is a formula which will sum the total amount of items due within this months' date range. If the date range could be as automatic as "This Month" that would be great otherwise I would say IF "Due Date" between 1/05/2009 and 31/5/2009.
    Is this possible?

    In column D, the formula is:
    =YEAR(C)*100+MONTH(C)
    In B8 and in B9 the formula is:
    =SUMIF(D,YEAR(A)*100+MONTH(A),B)
    Yvan KOENIG (from FRANCE jeudi 14 mai 2009 15:30:56)

  • Variable last date of previous month/last date of current month

    Hello Experts,
    I am facing an issue while designing a query.
    Requirement is like this.
    Report will be run on monthly basis.so on execution of report, it should prompt for month/year.
    now on report there are two columns for which I have to get data on date basis(last date of previous month and Last date of current month).
    Can anyone tell me is there any standard variable for this? what is it?
    or how to achieve this?
    Regards,
    Nirav

    Hi,
    See if this post in this forum can help you.
    Re: Last date of a month
    Regards
    Shalabh Jain

  • Different totals based on dates (month vs date range)

    I know I've seen this before, but I can't find the thread. I have a column in a fact table for price. When I add price and the month (eg April 2012) from the time dimension, it totals one number, but when I remove the month, and add a date range (4/1/2012 - 4/30/2012) it totals another (lower value). I can't find the solution I found last time.
    Anyone else run into this? and solve it?

    RiZapata wrote:
    I know I've seen this before, but I can't find the thread. I have a column in a fact table for price. When I add price and the month (eg April 2012) from the time dimension, it totals one number, but when I remove the month, and add a date range (4/1/2012 - 4/30/2012) it totals another (lower value). I can't find the solution I found last time.
    Anyone else run into this? and solve it?The solution is to understand what OBIEE is doing. If the totals differ, then the definitions are different. You need to troubleshoot to see what the difference is. When you add the month column and the date (so you can see every date) and add the total then, which total does it tie to? Is there rounding? How off are the two totals? That often may give a clue as to what is missing in the lower total.

  • All months in date range plus running count

    Oracle 11g
    Hello all,
    Having trouble getting the following query to return proper results. Have a table with a MEMBERNO, BUSINESS_LINE, ELIGIBILITY_START_DATE, ELIGIBILITY_END_DATE.
    MEMBERNO is not unique
    BUSINESS_LINE is not either
    Start and end date are periods of time where: MEMBERNO&BUSINESS_LINE have changed
    I need to list the member number, business_line, and each month that falls within the date range beginning with eligibility_start_date & eligibility_end_date, as well as a running count of the total in that span.
    Eg.
    member, business_line, month, year, count
    1234, bus1, 01, 2001, 1
    1234, bus1, 02, 2001, 2
    1234, bus1, 03, 2001, 3
    Here is my SQL, it is not sequencing the months dates correctly and I can not figure out why. Any help is very appreciated:
    SELECT memberno,
    business_line,
    TO_CHAR (ADD_MONTHS (start_date, LEVEL - 1), 'MM') as MONTH,
    TO_CHAR (ADD_MONTHS (start_date, LEVEL - 1), 'YYYY') as YEAR,
    ROW_NUMBER () OVER (PARTITION BY key1 ORDER BY start_date ASC) as MEMBER_MONTH_COUNT
    FROM (SELECT memberno,
    business_line,
    eligibility_start_date as start_date,
    eligibility_end_date as end_date,
    member_nbr || business_line as key1
    FROM eligibility)
    CONNECT BY LEVEL <=
    MONTHS_BETWEEN (TRUNC (END_DATE, 'MM'),
    TRUNC (START_date, 'MM'))
    + 1;
    Edited by: 935047 on Jul 25, 2012 5:58 AM
    Edited by: 935047 on Jul 25, 2012 6:18 AM

    935047 wrote:
    I need to list the member number, business_line, and each month that falls within the date range beginning with eligibility_start_date & eligibility_end_date, as well as a running count of the total in that span.
    Eg.
    member, business_line, month, year, count
    1234, bus1, 01, 2001, 1
    1234, bus1, 02, 2001, 2
    1234, bus1, 03, 2001, 3I could not understand what the Running Count mean. Hence, I used Row_Number (Same as you did).
    Below query might match yours.
    with data (memb_no, bus_line, st_date, end_date) as
      select 1234, 'bus1', to_date('01-01-2001', 'MM-DD-YYYY'), to_date('06-30-2001', 'MM-DD-YYYY') from dual
      union all
      select 1234, 'bus1', to_date('07-01-2001', 'MM-DD-YYYY'), to_date('07-30-2002', 'MM-DD-YYYY') from dual
    min_max as
      select memb_no, bus_line, min(st_date) st_date, max(end_date) end_date
        from data
       group by memb_no, bus_line
    lvl as
      select level l
        from dual
      connect by level <= (select max(round(months_between(end_date, st_date))) from min_max)
    select memb_no,
           bus_line,
           to_char(add_months(st_date, l - 1), 'MM') months,
           to_char(add_months(st_date, l - 1), 'YYYY') Year,
           row_number() over (partition by memb_no, bus_line order by st_date) cnt
      from min_max cross join lvl
    order by year, months;
    ----OUTPUT------------------------
    MEMB_NO BUS_LINE MONTHS YEAR CNT
       1234 bus1     01     2001   1
       1234 bus1     02     2001  19
       1234 bus1     03     2001   3
       1234 bus1     04     2001   4
       1234 bus1     05     2001   5
       1234 bus1     06     2001   6
       1234 bus1     07     2001   7
       1234 bus1     08     2001   8
       1234 bus1     09     2001   9
       1234 bus1     10     2001  10
       1234 bus1     11     2001  11
       1234 bus1     12     2001  12
       1234 bus1     01     2002  13
       1234 bus1     02     2002  14
       1234 bus1     03     2002  15
       1234 bus1     04     2002  16
       1234 bus1     05     2002  17
       1234 bus1     06     2002  18
       1234 bus1     07     2002   2
    19 rows selected

  • Which SQL function to use to get previous month's data?

    Hi
    The reporting need: Display of two month's payroll run results....current and previous (based on the parameter passed) in Oracle Discoverer.
    Data source: A table in which run result values are stored. Of course to be linked to number of other tables.
    Can somebody guide me on which SQL function to use to get the data for previous month?
    Secondly, as Discoverer does not support parameters, I cannot put parameter in the query itself. I'll be applying parameter later while generating my report.
    Please advice.
    Thanks and regards,
    Aparna

    It's not very clear in my head... but you can try :
    SQL> select * from test;
    ENAM        SAL DT
    TOTO       1000 30/05/06
    TOTO       1001 20/04/06
    TOTO       1002 11/03/06
    TATA       2000 30/05/06
    TATA       1500 20/04/06
    TUTU       3500 30/05/06
    6 rows selected.
    SQL> select ename, dt, sal currmonth,
                case when trunc(lag(dt,1,dt) over (partition by ename order by dt),'MM') = trunc(add_months(dt,-1),'MM')
                     then lag(sal,1,sal) over (partition by ename order by dt)
                     else null end prevmonth
         from   test
    SQL> /
    ENAM DT        CURRMONTH  PREVMONTH
    TATA 20/04/06       1500
    TATA 30/05/06       2000       1500
    TOTO 11/03/06       1002
    TOTO 20/04/06       1001       1002
    TOTO 30/05/06       1000       1001
    TUTU 30/05/06       3500
    6 rows selected.
    SQL>
    SQL> Nicolas.
    Just an additional question : do the previous month is current month-1, or is there hole in month suite (e.g. the previous month can be current month-2) ?
    Message was edited by:
    N. Gasparotto

  • Grouping by month within date range

    Hi,
    I have a date range which I like to group by months, but not from the 1st to last date of the calendar month but by given start date.  For example the table below represents the date range with some values in a table.  So the
    first month range in the group should be from 06/06/2013 to 08/07/2013.  The 06/07/2013 is absent because it's Saturday.  In fact the data is populated with working days only.  
    Table below shows what I really would like to get:
    There is a simple calculation for each month anniversary date, if the value from the start date, 06/06/2013, here 12 is less than the next month anniversary date, 08/07/2013, which is 9, then it should ignore it.  And only show the value from the month
    who's anniversary date value is less than the first date value, 12.  So the example above shows value 14 for the second month's anniversary date, 06/08/2013.  If the value has been found in any month the show, and ignore the rest. 
    I am just interested if there are any and report which number of month and the value. 
    I can implement this in procedural way, such as in VBA, but because the above looped many times it will take hours to run the process.  I have tried in SQL Server, but first problem I came up with is that I can't group by month from the given start
    date.
     Is this possible to do in T-SQL ?

    I'm not sure I entirely understand your question.  So I'll break the answer into two parts.
    First, as I understand it, you are looking for a way to group data by months, but not all dates in June, 2013 as one group, all dates in July, 2013 as the next group, etc.  Instead you want all dates from June 6, 2013 to July 5, 2013 as the first month,
    all dates from July 6, 2013 to August 5 as the second month etc.  The way to do that is use
    DATEDIFF(month, '20130606', <your date column>) + CASE WHEN DAY(<your date column>) < 6 THEN -1 ELSE 0 END
    So you can assign the month number you want to every row when you select from your table by
    SELECT DATE, VALUE, DATEDIFF(month, '20130606', DATE) + CASE WHEN DAY(DATE) < 6 THEN -1 ELSE 0 END AS MonthNumber
    FROM <your table name>
    Now as I understand it (but am not sure), you want the first value in each "month" (as you are defining "month" which is greater than the value contained in your start date and if no value in a particular month is greater than that value,
    you don't want any row for that month.  For that you could do something like
    Declare @StartDate date;
    Declare @StartValue int;
    Set @StartDate = '20130606';
    Select @StartValue = Value From <your table name>
    Where Date = @StartDate;
    ;With cteMonthNumber As
    (SELECT DATE, VALUE, DATEDIFF(month, @StartDate, DATE) + CASE WHEN DAY(DATE) < DAY(@StartDate) THEN -1 ELSE 0 END AS MonthNumber
    FROM <your table name>
    WHERE DATE > @Date AND VALUE > @Value),
    cteOrdered As
    (Select DATE, VALUE, MonthNumber,
    ROW_NUMBER() OVER (PARTITION BY MonthNumber ORDER BY DATE) As rn
    From cteMonthNumber)
    Select MonthNumber, Value As KickOutValue
    From cteOrdered
    Where rn = 1;
    Tom
    P.S.  Notice that I wrote my date literal as YYYYMMDD.  This is a good idea in SQL Server since '20130806" will always be interpreted as August 6.  But depending on the settings on your server and/or client '06/08/2013' might be dd/mm/yyyy
    and so be August 6, but it might be interpreted as mm/dd/yyyy and be June 8.
    It is also a good idea to express date literals in this forum as yyyymmdd.  There are a lot of us on the forum from the United States and we think 06/08/2013 is June 6 and a lot of us from other places who think 06/08/2013 is Aug 8.  If you give
    your dates as yyyymmdd we don't have to try to figure out what format you are using.

Maybe you are looking for