I'm using a stored procedure, SQL database, CR 11.
What I want to do:
In the last column get a 3 month rolling Net percent based on the dates the user picks. It doesn't have to start until the 3rd month displayed. See example below. How can I make that happen?
What I have now:
a report that groups by year and then month and in group footer2 shows total charges, payments, and adjustments
and the Net percent for the month. The user picks a beginning and ending date.
Thank you
//@PercentNetCollections
ABS(Sum ({@PaymentsAndAdjustments}, {@Months}) % ({#Charges}) )
//@PaymentsAndAdjustments
{@Payment} + {@Adjustment}
//#Charges
Running total that sums charge amount on change of field chargeID reset on change of Month group.
//@Payment
If isnull({aa_dch_PercentOfGrossCollections;1.PaidAmt})
Then 0
Else {aa_dch_PercentOfGrossCollections;1.PaidAmt}
//@Adjustment
If {aa_dch_PercentOfGrossCollections;1.TranType} = 'A'
Then
If isnull({aa_dch_PercentOfGrossCollections;1.AdjAmt})
then 0
else {aa_dch_PercentOfGrossCollections;1.AdjAmt}
Else 0
//@Months **This one is a mess because we didn't go by a calendar month in 2005 but we do in 2006
//not required to go into 2004
if {aa_dch_PercentOfGrossCollections;1.ClosingDate} < #01/08/2005 00:00#
Then "Month Not Available"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #01/08/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #02/02/2005 00:00#
Then "01 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #02/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #03/02/2005 00:00#
Then "02 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #03/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #04/02/2005 00:00#
Then "03 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #04/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #05/03/2005 00:00#
Then "04 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #05/03/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #06/02/2005 00:00#
Then "05 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #06/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #07/02/2005 00:00#
Then "06 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #07/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #08/02/2005 00:00#
Then "07 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #08/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #09/02/2005 00:00#
Then "08 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #09/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #10/04/2005 00:00#
Then "09 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #10/04/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #11/02/2005 00:00#
Then "10 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #11/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #12/02/2005 00:00#
Then "11 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #12/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #01/01/2006 00:00#
Then "12 / 05"
Else
If (year({aa_dch_PercentOfGrossCollections;1.ClosingDate})) > 2005
Then
{@TwoDigitMonth} & " / " & right(totext(year({?@EndDate})),2)
What I want to do:
In the last column get a 3 month rolling Net percent based on the dates the user picks. It doesn't have to start until the 3rd month displayed. See example below. How can I make that happen?
What I have now:
a report that groups by year and then month and in group footer2 shows total charges, payments, and adjustments
and the Net percent for the month. The user picks a beginning and ending date.
Thank you
Code:
Sample:
Chgs Pmts Adj Net% Want 3
Mo Rolling Average Net%
2006
Jan 2,244.00 -1,523.83 -894.25 107% nothing needed here(Nov & Dec not shown)
Feb 2,352.55 -1,463.38 -768.96 95% nothing needed here(Dec not shown)
Mar 2,100.00 -1,500.00 -400.00 90% 97% (I think - not sure if my math is right)
Apr 3,000.00 -1,500.00 -500.00 66% 83%
//@PercentNetCollections
ABS(Sum ({@PaymentsAndAdjustments}, {@Months}) % ({#Charges}) )
//@PaymentsAndAdjustments
{@Payment} + {@Adjustment}
//#Charges
Running total that sums charge amount on change of field chargeID reset on change of Month group.
//@Payment
If isnull({aa_dch_PercentOfGrossCollections;1.PaidAmt})
Then 0
Else {aa_dch_PercentOfGrossCollections;1.PaidAmt}
//@Adjustment
If {aa_dch_PercentOfGrossCollections;1.TranType} = 'A'
Then
If isnull({aa_dch_PercentOfGrossCollections;1.AdjAmt})
then 0
else {aa_dch_PercentOfGrossCollections;1.AdjAmt}
Else 0
//@Months **This one is a mess because we didn't go by a calendar month in 2005 but we do in 2006
//not required to go into 2004
if {aa_dch_PercentOfGrossCollections;1.ClosingDate} < #01/08/2005 00:00#
Then "Month Not Available"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #01/08/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #02/02/2005 00:00#
Then "01 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #02/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #03/02/2005 00:00#
Then "02 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #03/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #04/02/2005 00:00#
Then "03 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #04/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #05/03/2005 00:00#
Then "04 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #05/03/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #06/02/2005 00:00#
Then "05 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #06/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #07/02/2005 00:00#
Then "06 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #07/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #08/02/2005 00:00#
Then "07 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #08/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #09/02/2005 00:00#
Then "08 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #09/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #10/04/2005 00:00#
Then "09 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #10/04/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #11/02/2005 00:00#
Then "10 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #11/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #12/02/2005 00:00#
Then "11 / 05"
Else
If {aa_dch_PercentOfGrossCollections;1.ClosingDate} >= #12/02/2005 00:00# and
{aa_dch_PercentOfGrossCollections;1.ClosingDate} < #01/01/2006 00:00#
Then "12 / 05"
Else
If (year({aa_dch_PercentOfGrossCollections;1.ClosingDate})) > 2005
Then
{@TwoDigitMonth} & " / " & right(totext(year({?@EndDate})),2)