Capture threshold date for donor

For fundraising, I would like write a view to capture the date when a donor has reached a threshold of $10,000 within a fiscal year. There may be multiple gifts from this same donor within the year:
06/01/2008 $5,000
07/01/2008 $4,000
10/01/2008 $1,000
12/01/2008 $2,000
The pertinent date here is 10/1/2008 since that is the date when he arrived at the $10,000 level, all subsequent gifts do not matter. I want to be able to count how many donors 'arrived' at this level in a given month and not count them again for the remaining months of the year. It would have these fields:
ID CumulAmtinFiscalYear Date DateMonth FiscalYear
Any help is appreciated.

select   id , dt1, cummul_don_fisc, year_fiscal
from ( select t.* , sum(amount) over(partition by id,  to_char(dt,'yyyy'))  somme_totale
         from t )
where somme_totale >=10000
model
return updated rows
partition by (id ,  to_char(dt,'yyyy') year_fiscal)
dimension by ( row_number() over(partition by id,  to_char(dt,'yyyy') order by dt ) rn)
measures( sum(amount) over(partition by id,  to_char(dt,'yyyy') order by dt) somme,
                   dt dt1,0 cummul_don_fisc )
RULES
ITERATE( 1000)
until (somme[iteration_number+1]>=10000)
        (dt1[1]=case when somme[iteration_number+1]>=10000 then dt1[iteration_number+1] end,
          cummul_don_fisc[1]= case when somme[iteration_number+1]>=10000 then
                                                                  somme[iteration_number+1] end
order by id
DEmo
SQL> with t as (
  2                      select 1 id,to_date('06/01/2008','mm/dd/yyyy') DT,5000 amount from dual
  3                    )
  4  select   id , dt1, cummul_don_fisc, year_fiscal
  5  from ( select t.* , sum(amount) over(partition by id,  to_char(dt,'yyyy'))  somme_totale
  6               from t )
  7  where somme_totale >=10000
  8  model
  9  return updated rows
10  partition by (id ,  to_char(dt,'yyyy') year_fiscal)
11  dimension by ( row_number() over(partition by id,  to_char(dt,'yyyy') order by dt ) rn)
12  measures( sum(amount) over(partition by id,  to_char(dt,'yyyy') order by dt) somme,
13                     dt dt1,0 cummul_don_fisc )
14  RULES
15  ITERATE( 1000)
16  until (somme[iteration_number+1]>=10000)
17          (dt1[1]=case when somme[iteration_number+1]>=10000 then dt1[iteration_number+1] end,
18            cummul_don_fisc[1]= case when somme[iteration_number+1]>=10000 then
19                                                                    somme[iteration_number+1] end
20        )
21  order by id
22  /
no rows selected
SQL>
  SQL>   with t as (
  2                      select 1 id,to_date('06/01/2008','mm/dd/yyyy') DT,5000 amount from dual uni
on all
  3                      select 1, to_date('07/01/2008','mm/dd/yyyy'),4000 from dual union all
  4                      select 1, to_date('10/01/2008','mm/dd/yyyy'),1000 from dual union all
  5                      select 1, to_date('12/01/2008','mm/dd/yyyy'),2000 from dual union all
  6                      select 2, to_date('07/01/2008','mm/dd/yyyy'),4000 from dual union all
  7                      select 2, to_date('10/25/2008','mm/dd/yyyy'),6000 from dual union all
  8                      select 3, to_date('12/01/2008','mm/dd/yyyy'),2000 from dual union all
  9                      select 3, to_date('07/01/2008','mm/dd/yyyy'),4000 from dual union all
10                      select 4, to_date('01/01/2009','mm/dd/yyyy'),4000 from dual union all
11                      select 5, to_date('01/01/2009','mm/dd/yyyy'),10000 from dual
12                    )
13  select   id , dt1, cummul_don_fisc, year_fiscal
14  from ( select t.* , sum(amount) over(partition by id,  to_char(dt,'yyyy'))  somme_totale
15            from t )
16  where somme_totale >=10000
17  model
18  return updated rows
19  partition by (id ,  to_char(dt,'yyyy') year_fiscal)
20  dimension by ( row_number() over(partition by id,  to_char(dt,'yyyy') order by dt ) rn)
21  measures( sum(amount) over(partition by id,  to_char(dt,'yyyy') order by dt) somme,
22                     dt dt1,0 cummul_don_fisc )
23  RULES
24  ITERATE( 1000)
25  until (somme[iteration_number+1]>=10000)
26          (dt1[1]=case when somme[iteration_number+1]>=10000 then dt1[iteration_number+1] end,
27            cummul_don_fisc[1]= case when somme[iteration_number+1]>=10000 then
28                                                                    somme[iteration_number+1] end
29        )
30  order by id
31  /
        ID DT1       CUMMUL_DON_FISC YEAR
         1 01-OCT-08           10000 2008
         2 25-OCT-08           10000 2008
         5 01-JAN-09           10000 2009
SQL>

Similar Messages

  • Capturing key data for tracking/compliance

    We have two separate user groups, both of whom can access eLearning portal. One group (permanent staff) does have LMS logins but a bigger (volunteer) group have no login IDs (in a year or so, this may change)
    However, i'd appreciate advice on how to capture basic data (Pass/score and Name, - plus users Location/Role/Manager, not currently captured in our LMS)
    Using CP4, I have set up a Random Q pool and then a slide with free Text Entry Boxes, to input key data.
    There are potentially too many people to manage creating an email to send data.
    How do I collect/export the data into, say, a spreadsheet (as an interim solution to capture data to report for compiance training ) .
    If this is possibile, Step-by-step help would be appreciated. (not a techy and never used anything like java scripting)
    Much thanks in advance

    That seems remarkably complicated - surely there must be an easy way to say That is precisely the way all Actions are handle by Swing components. It is extremely easy if you take a few minutes to understand how it works.
    Using a KeyListener is the wrong approach.

  • Does MB5L capture the data if goods movement without accounting document

    Dear Guru,
    Can you please advice me if the transaction MB5L capture the data for those goods movement without accounting document?
    Thanks and Regards,
    CW

    Since MB5L captures based on the material and valuation area, still you can see the postings that has been made non-valuated.

  • Dismantling date for Equipments

    Hi Experts,
    How to capture dismantling date for an Equipment under a given functional location.I want to get the history of equipment for a given functional location ie when the equipment is assigned to that functional location.
    Can any one help me?
    Regards,
    Sibinraj

    Hi,
    Valid from date & Valid to date will get changed once you change your installation location.
    For example, equipment 1 has been created on 16.02.2003.
    So Valid from date would be 16.02.2003 & Valid to Date would be 31.12.9999.
    it has been installed in FL1 on 23.05.2005.
    So Valid from date would be 23.05.2005 & Valid to Date would be 31.12.9999.
    Then Equipment 1 has been dismantled from FL 1 & installed in FL 2 on 12.08.2008, then Valid from date will get changed to 12.08.2008 & valid to date will be same (31.12.9999).
    If you see in Usage list, you can see 3 rows.
    First row: FL 2 with 12.08.2008 & 31.12.9999
    2nd Row: FL 1 with 23.05.2005 & 12.08.2008
    3rd Row: Empty FL with 16.02.2003 & 23.05.2005.
    Valid from date will not be same if you change your installation location. Only start up date can be same till the equipment is getting scrapped.
    Regards,
    Maheswaran.

  • Can someone capture a timecode DAT for me in the CT-area?

    I didn't have any luck obtaining a timecode DAT. I was wondering if someone in the CT-area could capture a timecode DAT for me, in FCP, and place the audio in a timeline utilizing the DAT's timecode. Pretty simply and I would be much appreciative.

    I've got a place in Stamford that I think can do this for you.
    e-mail me off list

  • Capture/Display Date & Time for Document Approval

    Hi Gurus,
    We are on SAP Enterprise Portals 7 SPS 15.
    I have enabled Document Approval in one folder in a repository.  The Document Approval works correctly; but I want to capture the date and time the document was approved at:
    Option 1 (Preferred):
    1. Click on "Details" from the "Context Menu" of the document.
    2. Click on "Settings"=>"Approval" in the popup window.
    Currently it only shows
    <Step-Name>  <Approver-Name> has approved
    Desired:
    <Step-Name> <Approver-Name> has approved on <Date-Time>
    Option 2:
    1. Approval Maintenance Report (under Content Management=>Reports=>Approval maintenance)
    Your guidance is greatly appreciated and I promise points.
    Thanks and regards,
      Pratik
    Edited by: Pratik Thakkar on Mar 19, 2009 9:42 AM

    Hi,
    Chk this [https://forums.sdn.sap.com/thread.jspa?messageID=115712]
    Regards
    Baby

  • How does AWR contributes data for ADDM.

    Hi,
    In oracle10g I understand that AWR is used to get information for ADDM.
    I am looking for a detail explanation as how its doing that and How ORACLE is handling the data and deciding the recommendation.
    Regards
    MMU

    Hi,
    I am looking for a detail explanation as how its doing that and How ORACLE is handling the dataAs I understand it, the data for AWR is collected exactly the same as a STATSPACK snapshot, copying the contents of the in-memory accumulators (as exposed by the x$ fixed tables).
    When you take an AWR snapshot, your collection threshold settings determine the volume of data collected, especially SQL. The snapshot thresholds only apply to the SQL statements that are captured in the stats$sql_summary table. The stats$sql_summary table can easily become the largest tables in the STATSPACK schema because each snapshot might collect several hundred rows, one for each SQL statement that was in the library cache at the time of the snapshot.
    In the Automatic Workload Repository (AWR), the executions_th , parse_calls_th , disk_read_th , buffer_gets_th , sharable_mem_th , and version_count_th SQL collection threshold settings allow the DBA to set thresholds for SQL statements. If any of the thresholds are exceeded, the information will be stored by STATSPACK in the repository.
    http://www.dba-oracle.com/tips_oracle_statspack_snapshot_thresholds.htm
    How ORACLE is handling the data and deciding the recommendation.That's a closely-held secret, a proprietary feature that Oracle will never expose!
    Hope this helps. . . .
    Donald K. Burleson
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/t_oracle_tuning_book.htm

  • To Capture Excise Duties for Customer Material

    Dear All,
    Issue is regarding to capture excise invoice
    for Customer Material.
    1.
    one of our client receives Customer material which
    should not be reflected in
    stock.
    2. Excise should be captured which
    receiving
    3. Now
    when this Customer material is returned back to
    customer along with
    the assembly (i.e. the material received from
    customer is fixed
    in Assembly and sent back to
    customer),
    4. Now
    the excise
    captured should be transfered back to customer's A/c.
    I tried
    doing by creating a material type as customer material, where in
    Stock will be reflected but value will not be reflected, where exactly
    we
    can capture the excise details for this scenario.
    How
    to
    proceed further to complete his scenario.
    Consider this
    issue
    to be on high priority &  i/p will be of great help.

    Dear Vijayashree
    From your comments what I understood is that for a particular FERT, you are procuring one component from the buyer, assembling it and invoicing to the same customer.
    If this is the scenario, I dont know how you can invoice without maintaining BOM for that.
    If the client don’t want to maintain BOM for the same, the only option is as follows to my knowledge.
    Whenever the client receives the component, take credit of the duty amount by updating <b>J1IH</b>. While doing PGI, since you have not maintained this component in BOM, stock will <i>ONLY</i> reduce for other components.  So no-where, your client can track the customer’s component.
    Parallelly, apart from selling price, to the extent of excise duty value, one more condition (say ABCD,  to be maintained.  So in your pricing procedure, the assessable value should be PR00 + ABCD for which, the excise duty should be captured so that the client can recover the duty amount from customer.
    Finally, for this practice, the client should maintain datas (how many procured and how many invoiced) manually to convince the government officials but then, I am not sure, how far this will be accepted by the officials.
    Thanks
    G. Lakshmipathi

  • Capturing Excise details for CENVAT in Stock Transfer

    Dear Gurus,
    Our requirement is that we have 2 manufacturing plants and first plant sends a semi finished product duly paying all Excise duties, to the second plant and they receive it to manufacture a finished product and sell it from there.
    Both the plant are under the same company code.
    First plant raises a Stock Trasfer Delivery doc with Excise Invoice and sends the goods to the second plant. Second plant captures the Excise duties through J1IEX_C, so these duties can be availed for CENVAT credit.
    I have created Plant 2 as a customer and Plant 1 as a Vendor. Also maintained 'Shipping data for Plants' for both the Plants. I am not able to do J1IEX_C, as the system is saying Maintain Vendor for the Customer 'ABC' attached to Supplying Plant 'ABC'.
    Kindly let me know what have i to do to successfully create STO and allow the second plant to capture the excise duties for CENVAT credit purposes.
    Thanks and regards.
    Venkat - Hyd.

    Thanks Ravi or Raj, did that, but that has not solved the problem. Anyways since no inputs am closing the thread.
    Warm regards.
    Venkat - SD

  • How to capture the data that the user modified in SM30(Maintenance view)

    Hello experts,
    I have a new requirement wherein when the user modifies a particular record in SM30(maintenance view)
    it would also update that certain records in another table. For example, I modified the address
    of record 1 in table1 so I need to automatically update that same record in table2. Help would be greatly appreciated.
    Again, thank you guys and have a nice day!

    Hi again,
    1. But how can I capture the data that was modified
    Yes, u are right.
    We will have to use the event,
    'BEFORE SAVING'.
    2. In that,
      u must fire a select query,
       from the same table,
       for the same record.
    3. In this, u will get the OLD DATA (which was already saved),
    4. Using this,u can compare,
       (either thru LOOP, or field by field)
      to know, which field value has been changed.
    regards,
    amit m.

  • How to capture the data from a JSP form

    Hi
    I have a JSP form, My task is to capture the data from a JSP and submit to Data Base. for example I have the field like
    Enter Table name to be created in data base: The table name is to be captured by a servlet and by that table name, table should be created in the data base.
    Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????
    Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????

    Get the entered value from the jsp into servlet using request.getParameter("enteredTableName"). it will return the String,pass this table name to execute query using JDBC connection and statement objects.
    -cheers Ram

  • Editable ALV, how to capture changed data

    Hi All,
    I have created an editable ALV. User can make some changes in the displayed record and press "Submit" button (custom button on application toolbar), the program should validate the data and write the file on application server if validations are successful otherwise controls stay on the same screen.
    I am handling this validation and writing file part in PAI of the screen.
    Problem: The program is capturing the data when user changes it for the first, but program is failing to capture the subsequent changes (user makes after the validation fails). Program processes always the first time changed data only. Please help me in getting this problem resolved.
    Step1 : Program shows output.
    Step2: User changes Company Code.
    Step3: User clicks on Submit Button.
    Step3.1: Program reads the new data and performs validation.
    Step3.2: New Company code is not valid, error displayed.
    Step4: User changes the company code again, presses submit button.
    Goto step 3.1 -> Here program does not read the new data, rather first time changes company code is again read and validated, and program shows the same error again, which is not a desired result

    Hi Ashish,
    you need a method HANDLE_DATA_CHANGED as handler for grid event DATA_CHANGED.
    Use
    LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.
    to check all changed data. In this event, add the error messages to ER_DATA_CHANGED object.
    set all required handlers, i.e.
    SET HANDLER:
          handle_data_changed          FOR ro_grid,
          handle_data_changed_finished FOR ro_grid,
          handle_toolbar_set           FOR ro_grid,
          handle_user_command          FOR ro_grid,
          handle_hotspot_click         FOR ro_grid,
          handle_f4                    FOR ro_grid,
          handle_f1                    FOR ro_grid.
       ro_grid->set_toolbar_interactive( ).
    Register ENTER and MODIFIED events.
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
    Regards,
    Clemens

  • How to capture the data entered in a textfield in a JTable

    How to capture the data entered in a textfield present in a cell of a textfield or how to add listener to this textfield

    A sample of my code is:
              model = new GridDisplayTableModel(gridDisp,columnName,getRows(),getCols());
              final ComboRenderer cRenderer = new ComboRenderer();
              final TextFieldRenderer tRenderer = new TextFieldRenderer();
              combo.addItem("one");
              combo.addItem("two");
              combo.addItem("three");
              final JTextField textfield = new JTextField();
              final DefaultCellEditor cmbEditor = new DefaultCellEditor(combo);
         //     final JEnterDataCellEditor textEditor = new JEnterDataCellEditor(12);
              final DefaultCellEditor textEditor = new DefaultCellEditor(textfield);
              rm = new RowEditorModel();
              table = new JTable(model){
         public TableCellRenderer getCellRenderer(int row, int column) {
              int posx = 0;
                   int posy = 0;
                   TableCellRenderer renderer = null;
         for(int l=0;l<getDataVec().size();l++)
                   beanObj =(Helperbean)dataVec.elementAt(l);
                   posx = beanObj.getPosx();
                   posy = beanObj.getPosy();
                   if(row==posx && column==posy)
                             if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
                                  rm.addEditorForRow(row,textEditor);
                                  renderer = tRenderer;
                             else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
                                  rm.addEditorForRow(row,cmbEditor);
                                  renderer = cRenderer;
                             break;
                        renderer = super.getCellRenderer(row, column);
              //     System.out.println("getEditor"+rm.getEditor(1));
         return renderer;
    public TableCellEditor getCellEditor(int row, int col) {   
         int posx = 0;
         int posy = 0;
         TableCellEditor tmpEditor = null;
    for(int l=0;l<getDataVec().size();l++)
         beanObj =(Helperbean)dataVec.elementAt(l);
         posx = beanObj.getPosx();
         posy = beanObj.getPosy();
         if(row==posx && col==posy)
                   if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("textfield"))
                        System.out.println("celleditorval "+textEditor.getCellEditorValue());
                        tmpEditor = textEditor;
                   else if(beanObj.getModeofDisplay() != null && beanObj.getModeofDisplay().equalsIgnoreCase("combo"))
                        tmpEditor = cmbEditor;
                   break;
              tmpEditor = super.getCellEditor(row, col);
    return tmpEditor;
    public boolean isCellEditable(int row,int col){
         boolean isEditable = false;
         int posx = 0;
         int posy = 0;
    for(int l=0;l<getDataVec().size();l++)
         beanObj =(Helperbean)dataVec.elementAt(l);
         posx = beanObj.getPosx();
         posy = beanObj.getPosy();
         if(row==posx && col==posy)
              if(beanObj.getModeofDisplay() != null )     
                        isEditable = true;     
                   else
                        isEditable = false;     
                   break;
         isEditable = false;
         return isEditable;
    public void changeSelection(final int row, final int column, boolean toggle, boolean extend) {
         super.changeSelection(row, column, toggle, extend);
         //my attempt to avoid editCellAt from being called twice in a row
         if (getModel().isCellEditable(row, column) && !(isEditing() && getEditingRow() == row && getEditingColumn() == column))
              if (editCellAt(row, column)) {
                   getEditorComponent().requestFocus();
         // Select the text when the cell starts editing
    public boolean editCellAt(int row, int column) {       
         boolean result = super.editCellAt(row, column);
         final Component editor = getEditorComponent();
         if (editor != null && editor instanceof JTextField) {           
              SwingUtilities.invokeLater(new Runnable() {               
                   public void run() {                   
                        ((JTextField)editor).selectAll();
              return result;
         public boolean hasFocus()
              Component editorComponent = getEditorComponent();
              // Try to install the editor
              int anchorRow = getSelectionModel().getAnchorSelectionIndex();
              int anchorColumn = getColumnModel().getSelectionModel().
              getAnchorSelectionIndex();
              if (anchorRow != -1 && anchorColumn != -1 && !isEditing())
              if ((this.getSelectedRow() == anchorRow) && (this.getSelectedColumn() == anchorColumn))
              if (!editCellAt(anchorRow, anchorColumn)) {}
              return super.hasFocus();
         public void valueChanged(ListSelectionEvent e)
              super.valueChanged(e);
              if ((this.getSelectedRow() == 2) && (this.getSelectedColumn() == 3))
                   DefaultFocusManager focusManager = new DefaultFocusManager();
                   focusManager.focusNextComponent(this);
                   model.fireTableStructureChanged();
         

  • Error when opening legitimate documents "Insufficient data for an image"

    I work for a company who has sold "downloadable resources" via PDF for years now. We created a large batch of PDF documents in 2003 with
    Adobe Acrobat 6.0 paper capture, and these are all PDF 1.5 type documents. We've provided these resources for years, however just today we were notified by a user that upon downloading the file they get a message "Insufficient data for an image". These ARE NOT HACKED PDF's. and they worked fine until 9.0. I have tried 9.0 and 9.1, on multiple computers and have confirmed this issue.
    Now we are stuck with hundreds of PDF's that won't open in 9.x.
    I did try downloading a free demo of "PDF-TOOLS" Recovery & Analysis tool, and I open the file using that program, scan the file - TELLS ME ALL IS OK, then resave it using that program.
    Only then can I open it in 9.x.
    What are we to do now short of buying a $200 tool and taking perhaps several days of time to open and save hundreds of "previously working" PDF files???

    RollingRocker, did you ever get a solution for this? I am having the same problem. I produce a pdf using a JSF third party api called flying saucer, which actually uses itext to produce the pdf. I can attempt to produce the same exact pdf over and over and about 85% of the time the error occurs and the rest of the time the pdf opens successfully with no error. Obviously 15% of the time the reader is completely happy with this pdf, so it is not a malicious document in any way.

  • Not getting correct data for newly added field in 0FI_AR_4

    Hi to all,
    I have added SPART field from VBRK table into 0FI_AR_4 datasource .
    Based on join BSID-VBELN = VBRK-VBELN to get SPART from VBRK table.
    but i found that some VBELN are not maintained in VBRK table, But are Present in BSID table, so i am not get SPART for which no
    VBELN maintained in VBRK.
    Please can any one tell me, what condition should i take to get SPART from VBRK to 0FI_AR_4.
    as i knew that only BSID-VBELN = VBRK-VBELN sufficent to get data for SPART.
    or any different condition i required.
    I shall be thankful to you for this.
    Regards
    Pavneet Rana

    Thanks for reply,
    i have written code for that like that.
    SELECT SINGLE * FROM VBRK
    WHERE VBELN = <fs_d>-VBELN .
    if sy-subrc = 0.
    <FS_D>-SPART = VBRK-SPART.
    endif.
    ENDLOOP.
    according to it result are not capturing all SPART from VBRK. as it only matches the VBELN which are same in both VBRK and BSID table.
    so how to get SPART from VBRK if same VBELN is not maintained in both tables.
    Please can you tell me CODE for that.
    I shall be thankful to you for this.
    Regards
    Pavneet Rana
    Edited by: pavneet rana on Feb 1, 2011 4:53 AM

Maybe you are looking for

  • KPSI (RKNMABTC) on company code level

    Hello, I would like to ask, if somebody of you have already tried following: We would like to run the KPSI (Plan reconciliation / target = actual-IAA) on company code level. It is possible e.g. if create an appropriate cost center group. The problem

  • The change to a different font was not done because the chosen font and the font encodings in the do

    Hi, I created a PDF from a Word document that used Cambria font, and when I select it in Acrobat to try to change the font I get "The change to a different font was not done because the chosen font and the font encodings in the document differ and co

  • Laggy keyboard even after 2.1 update

    Is anyone still experiencing a laggy keyboard even after the 2.1 update? I'm still having problems when texting a typing emails...my keyboard just pauses and then will catch up.

  • Can't get rid of the file in the trash

    There is a very odd file in my trash and I cannot remove it. I've tried using Secure Empty Trash as well as holding down the Option key and also reformatting my hard drive by doing Erase and Install. Is there anyway i can remove it or does anyone hav

  • How to create a file in server's current directory

    hi, I have a project, but when i will run my program on internet Explorer then it will create a folder in server's current directory, but i will not specify drive & folder, it will create a folder in server's current directory, after that i will read