Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formula help Post Reply Post New Topic
Author Message
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Topic: formula help
     Posted: 06 Oct 2010 at 5:21am
how would I build the formulas for the following?
Date of last sale (orders.order_date)
How many ordered in the last 6 months (orders.order_date, order_lines.quantity_ordered)
 
Thanks in advance for your help!
Ariel
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Oct 2010 at 5:48am
Originally posted by Ariel

Date of last sale (orders.order_date)
Maximum(orders.order_date)
Originally posted by Ariel

How many ordered in the last 6 months (orders.order_date, order_lines.quantity_ordered)
a few ways to do this but a Running Total would be eaisest
New RT
Name=Total_Last_6_Months
Field to summarize=order_lines.quantity_ordered
type=SUM
evaluate=use a formula ...not sure how youa re defining last 6 months but here is opne way...
orders.order_date>=dateadd('m',-6,currentdate)
reset=never
place in report footer (RTs do not work in headers)
 
IP IP Logged
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Posted: 06 Oct 2010 at 6:26am
OK, maybe I got ahead of myself a bit.  My CFO needs a report that shows 1 line for each product code and in that line are the following fields:
PRODUCT_CODE
QUANTITY_ON_HAND
The date the last time this product was ordered
How many were ordered at that time, in that order
how many of that product have been order in the last 6 months
 
I'm not sure what my select criteria should be but right now it's giving me the same date for all products (using the formula above).  I'm also getting multiple lines for each product code - I can group them and hide the detail I think, right?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Oct 2010 at 6:45am
those formulas were for the entire report not a grouping.
group on the product and change the formulas to be used in the group footer.
Maximum(orders.order_date,table.product)
 
For the RT
Name=Total_Last_6_Months
Field to summarize=order_lines.quantity_ordered
type=SUM
evaluate=use a formula ...not sure how youa re defining last 6 months but here is opne way...
orders.order_date>=dateadd('m',-6,currentdate)
reset=group1


Edited by DBlank - 06 Oct 2010 at 10:05am
IP IP Logged
Ariel
Newbie
Newbie


Joined: 10 Jun 2010
Location: United States
Online Status: Offline
Posts: 33
Quote Ariel Replybullet Posted: 06 Oct 2010 at 10:00am
thanks so much!
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum