Hello there.
I have created a query that reflects a summary of the volume by account for a specific range of dates. This query works great.
I have a request to compare this summary to the previous five day average volume. I am not even sure where to begin.
Any suggestions on where to start on something like that? My current SQL is below. Thanks for your help.
SELECT [tbl_Incoming Returns_FORMATTED].CBAcct, [tbl_Incoming Returns_FORMATTED].CustomerName, [tbl_Incoming Returns_FORMATTED].CustomerName2, [tbl_Incoming Returns - Remotely Created Check Customers].RCC, Count([tbl_Incoming Returns_FORMATTED].Amount) AS CountOfAmount, Sum([tbl_Incoming Returns_FORMATTED].Amount) AS SumOfAmount, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",0,IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],1)="*",1,0))) AS CountOfRedeposit, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="*",[Amount],0)) AS SumOfRedeposit, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",1,0)) AS CountOfRedeposit1, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",[Amount],0)) AS SumOfRedeposit1, [CountOfAmount]-[CountOfRedeposit]-[CountOfRedeposit1] AS Expr1, [SumOfAmount]-[SumOfRedeposit]-[SumOfRedeposit1] AS Expr2
FROM [tbl_Incoming Returns - Remotely Created Check Customers] RIGHT JOIN [tbl_Incoming Returns_FORMATTED] ON [tbl_Incoming Returns - Remotely Created Check Customers].AccountNumber = [tbl_Incoming Returns_FORMATTED].CBAcct
WHERE ((([tbl_Incoming Returns_FORMATTED].Date) Between [Start Date] And [End Date]))
GROUP BY [tbl_Incoming Returns_FORMATTED].CBAcct, [tbl_Incoming Returns_FORMATTED].CustomerName, [tbl_Incoming Returns_FORMATTED].CustomerName2, [tbl_Incoming Returns - Remotely Created Check Customers].RCC;
I have created a query that reflects a summary of the volume by account for a specific range of dates. This query works great.
I have a request to compare this summary to the previous five day average volume. I am not even sure where to begin.
Any suggestions on where to start on something like that? My current SQL is below. Thanks for your help.
SELECT [tbl_Incoming Returns_FORMATTED].CBAcct, [tbl_Incoming Returns_FORMATTED].CustomerName, [tbl_Incoming Returns_FORMATTED].CustomerName2, [tbl_Incoming Returns - Remotely Created Check Customers].RCC, Count([tbl_Incoming Returns_FORMATTED].Amount) AS CountOfAmount, Sum([tbl_Incoming Returns_FORMATTED].Amount) AS SumOfAmount, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",0,IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],1)="*",1,0))) AS CountOfRedeposit, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="*",[Amount],0)) AS SumOfRedeposit, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",1,0)) AS CountOfRedeposit1, Sum(IIf(Left([tbl_Incoming Returns_FORMATTED].[Redeposit],2)="**",[Amount],0)) AS SumOfRedeposit1, [CountOfAmount]-[CountOfRedeposit]-[CountOfRedeposit1] AS Expr1, [SumOfAmount]-[SumOfRedeposit]-[SumOfRedeposit1] AS Expr2
FROM [tbl_Incoming Returns - Remotely Created Check Customers] RIGHT JOIN [tbl_Incoming Returns_FORMATTED] ON [tbl_Incoming Returns - Remotely Created Check Customers].AccountNumber = [tbl_Incoming Returns_FORMATTED].CBAcct
WHERE ((([tbl_Incoming Returns_FORMATTED].Date) Between [Start Date] And [End Date]))
GROUP BY [tbl_Incoming Returns_FORMATTED].CBAcct, [tbl_Incoming Returns_FORMATTED].CustomerName, [tbl_Incoming Returns_FORMATTED].CustomerName2, [tbl_Incoming Returns - Remotely Created Check Customers].RCC;