Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: previous year Post Reply Post New Topic
Author Message
abernut
Newbie
Newbie
Avatar

Joined: 25 Aug 2010
Location: United States
Online Status: Offline
Posts: 25
Quote abernut Replybullet Topic: previous year
    Posted: 08 Aug 2011 at 11:07am
Hello,
I am using Crystal Reports 11. I am trying to find a way to display total units shipped for a previous year.

I have found the LastYearYTD. But I need total for last year. ie... The total qty_shipped for 2010.

The table this is coming from is "OrderLineItem" and the columns I am trying to report on is "DateBilled" and "QTY_Shipped".

Thank you,
Mike
IP IP Logged
abernut
Newbie
Newbie
Avatar

Joined: 25 Aug 2010
Location: United States
Online Status: Offline
Posts: 25
Quote abernut Replybullet Posted: 08 Aug 2011 at 11:17am
I should also add that this same report will also display the current qty_shipped YTD. Which I am using

IF {OrderLineItem_sql.DateBilled} in YearToDate ...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Aug 2011 at 11:24am

one option

year({OrderLineItem_sql.DateBilled})= year(currentdate)-1

IP IP Logged
abernut
Newbie
Newbie
Avatar

Joined: 25 Aug 2010
Location: United States
Online Status: Offline
Posts: 25
Quote abernut Replybullet Posted: 09 Aug 2011 at 2:33am
Thank you,
I still can't seem to get it to work. I think my issue may be in the grouping. This report is grouped by Item number. I then have a SUM BY GROUP for qty_shipped

I am using:
If year({OrderLineItem_sql.DateBilled})=Year(Currentdate)-1 then Sum ({OrderLineItem_sql.qty_shipped}, {OrderLineItem_sql.item_no}) else 0


Thank you for your help.
IP IP Logged
abernut
Newbie
Newbie
Avatar

Joined: 25 Aug 2010
Location: United States
Online Status: Offline
Posts: 25
Quote abernut Replybullet Posted: 09 Aug 2011 at 3:49am
If I use the select expert and manually set the DateBilled to be between (1/1/2010 and 12/31/2010) My numbers are spot on. Unfortunately all my YTD numbers are 0    
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Aug 2011 at 4:06am
you cannot conditionally sum like you had
you can either make a new formula field to sum (at any group level) like
If year({OrderLineItem_sql.DateBilled})=Year(Currentdate)-1 then {OrderLineItem_sql.qty_shipped} else 0
or you can make a running total with an evaluate formula to conditionally count
name= whatever
field to summarize= OrderLineItem_sql.qty_shipped
type of summary = sum
evaluate=use a formula
year({OrderLineItem_sql.DateBilled})=Year(Currentdate)-1
reset=at group 1 if you want values for each group
palce in group footer (RTs do not work in headers)
 
IP IP Logged
abernut
Newbie
Newbie
Avatar

Joined: 25 Aug 2010
Location: United States
Online Status: Offline
Posts: 25
Quote abernut Replybullet Posted: 09 Aug 2011 at 5:02am
Thank you sir.
That is exactly what I had to do.
Create a new formula and then sum that.

Between trying to learn this and trying to learn SSRS 2005, my brain is nearing capacity.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.