Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month over month calculation in a report

Status
Not open for further replies.

dree

IS-IT--Management
Dec 5, 2000
1
0
0
CA
I have created a report to calculate the monthly increase in sales.

I have sorted the report by month [DATE] (eg 1,2,3...)
then by store [STORE] (eg, 11,22,33,...)
and calculated the monthly sum of sales by store [SALESSUM]

How can I get the increase in [salessum] by store and over the previous month.

Thanks
 
You need to save the current month data in a variable, use it in the folowing month to calculate the delta and then replace it with the current value. NEVER calculate the delta when the previous month's value is zero.

So, where ever [SALESSUM] is calculated:

If (PrevSalesSum <> 0) Then
[tab]SalesIncr = [SalesSum] - PrevSalesSum
Else
[tab]SalesIncr = &quot;N/A&quot;
End If
PrevSalesSum = [SALESSUM]

The above is just a raw snippet, you should use it as a 'plan' for your real needs, not a 'pulg-and-play' model.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top