Welcome to Forums Sign in | Join | Help | Forums
in Search


NEED ASAP - Confused by summary query - can anyone help?

Last post 08-11-2008 4:07 PM by Drew Allen. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-11-2008 12:29 PM

    • Belinda Goodman
    • Top 200 Contributor
    • User Since: 0807
    • Posts 52
    • Organization: Louisiana College
    • Products:  Accounting for Nonprofits, The Raiser's Edge

    NEED ASAP - Confused by summary query - can anyone help?

    I need the follow information.  Who gave a total of $1000 or more last calendar year that has never given a total of $1000 or more in any given calendar year.  Then I need a list of all who have given $1000 or more last calendar year and how many years they have given $1000 or more in a calendar year before.  With both they should be Soft Credited for spouse and/or matching gifts. 

  • 08-11-2008 12:51 PM In reply to

    • Drew Allen
    • Top 10 Contributor
    • Posts 514
    • Organization: Children's Hospital of Philadelphia
    • Products:  The Information Edge, The Raiser's Edge

    Re: NEED ASAP - Confused by summary query - can anyone help?

    You're going to need a separate summary for every single fiscal year that you want to look at.  This is extremely tedious to do in RE.  There are also limits to the number of summaries that RE will let you create.  (I believe it's 20.)

    The reason it's so difficult in RE is that you are really doing a summary of a summary.  You are first doing a summary of gifts per fiscal year and then doing a summary of the fiscal years (minimum in one case; count in the other) based on the first summary.  The front end simply isn't designed to handle something that complex.

    If you know SQL, it's very easy to do this stuff in the back end.  If you are interested in how to do this in SQL, let me know.

    Drew 

    J. Drew Allen
    The Children's Hospital of Philadelphia
    Filed under:
  • 08-11-2008 3:32 PM In reply to

    • Belinda Goodman
    • Top 200 Contributor
    • User Since: 0807
    • Posts 52
    • Organization: Louisiana College
    • Products:  Accounting for Nonprofits, The Raiser's Edge

    Re: NEED ASAP - Confused by summary query - can anyone help?

    Drew,

    Thank you.  I am interested.  Keep in mind - I am fairly new to RE and know nothing about SQL.  Your help is appreciated.  You may contact me by email goodman@lacollege.edu if you don't mind.

  • 08-11-2008 4:07 PM In reply to

    • Drew Allen
    • Top 10 Contributor
    • Posts 514
    • Organization: Children's Hospital of Philadelphia
    • Products:  The Information Edge, The Raiser's Edge

    Re: NEED ASAP - Confused by summary query - can anyone help?

    Here is code that should work.

    -- Create Temporary Table of fiscal year summaries.
    SELECT cg.Constit_ID, Year( DateAdd( qq, 2, g.Dte ) ) AS FY, Sum(g.Amount)
    INTO #FY_Giving
    FROM Constit_Gifts_BB AS cg
    INNER JOIN Gifts AS g
    ON cg.Gift_ID = g.[ID]
    WHERE {Enter your gift type filter here.}
    GROUP BY cg.Constit_ID, Year( DateAdd( qq, 2, g.Dte ) )
    HAVING Sum(g.Amount) >= 1000

    -- Find people whose first $1000 year was last year
    SELECT Constit_ID
    FROM #FY_Giving
    GROUP BY Constit_ID
    HAVING Min( FY ) = Year( DateAdd( qq, 2, GetDate() ) ) - 1

    -- Find number of years (non-consecutive) with $1000 totals as of last FY
    SELECT Constit_ID, Count( FY )
    FROM #FY_Giving
    WHERE FY < Year( DateAdd( qq, 2, GetDate() ) )
    GROUP BY Constit_ID

    The formula that I used for the fiscal year assumes a fiscal year that runs 7/1-6/30.  If you are using a different fiscal year, you'll need to adjust the offsets that are used.

    It is also possible to calculate the number of consecutive years of giving at any one point, but that gets even more complicated.

    Drew
     

    J. Drew Allen
    The Children's Hospital of Philadelphia
Page 1 of 1 (4 items)