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!

Crystal Reports percent change in rolling months

Status
Not open for further replies.
Mar 16, 2015
3
0
0
US
I've got two categories that I need to show totals for the previous 6 months. The tricky part is I need to show the change from one month to the next in a percentage. I think I've got my Select Expert set to show a rolling 6 months: {table.mydate} >= DateAdd("M",-6,CurrentDate()) and {table.mydate} <= CurrentDate()

I've grouped by month, and then added a group by category. I did a count of orders for each category, which looks like this:

May
Apples - 20
Oranges - 15

June
Apples - 25
Oranges - 10

To get the percent change for Apples from May to June, I would need to do (25-20)/25*100, which would get me 20%. Oranges would get me -50%.

Ideally, this would be a crosstab. I've tried using Previous, but that doesn't work with groups. This is my goal:

May %Change June %Change July %Change
Apples 20 0% 25 20% 31 19%
Oranges 15 0% 10 -50% 17 41%

Any ideas on how to accomplish that? Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top