I was wondering if it would be possible to create a decile report easily through SQL. Normally, I would export the data to excel.
Here's how to create the report. I have a table containing donation history for each member -- each row represents a different member. For example:
Donor ID Ttl Amt Donated
1342 $1000
525 $50
636 $250
To create the decile report, I would need to sort all records by the field "Ttl Amt Donated", in descending order. Then I would divide these records into 10 equal groups, keeping the sort order. So if there are 525 records in the table, then each group/decile would have approximately 52 or 53 records where the members who've given the most are in the top groups/deciles. Then I would sum the field "Ttl Amt Donated" for each of those groupings. The result would be as follows:
Decile 1 (top 10%): Total Amt=XXX, # Records=XXX
Decile 2 (2nd 10%): Total Amt=XXX, # Records=XXX
Decile 3 (3rd 10%): Total Amt=XXX, # Records=XXX
Decile 4 (4th 10%): Total Amt=XXX, # Records=XXX
etc. until Decile 10
Here's how to create the report. I have a table containing donation history for each member -- each row represents a different member. For example:
Donor ID Ttl Amt Donated
1342 $1000
525 $50
636 $250
To create the decile report, I would need to sort all records by the field "Ttl Amt Donated", in descending order. Then I would divide these records into 10 equal groups, keeping the sort order. So if there are 525 records in the table, then each group/decile would have approximately 52 or 53 records where the members who've given the most are in the top groups/deciles. Then I would sum the field "Ttl Amt Donated" for each of those groupings. The result would be as follows:
Decile 1 (top 10%): Total Amt=XXX, # Records=XXX
Decile 2 (2nd 10%): Total Amt=XXX, # Records=XXX
Decile 3 (3rd 10%): Total Amt=XXX, # Records=XXX
Decile 4 (4th 10%): Total Amt=XXX, # Records=XXX
etc. until Decile 10