Print Page | Close Window

previous year

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=14000
Printed Date: 03 May 2024 at 4:24pm


Topic: previous year
Posted By: abernut
Subject: previous year
Date 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



Replies:
Posted By: abernut
Date 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 ...


Posted By: DBlank
Date Posted: 08 Aug 2011 at 11:24am

one option

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



Posted By: abernut
Date 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.


Posted By: abernut
Date 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    


Posted By: DBlank
Date 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)
 


Posted By: abernut
Date 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.



Print Page | Close Window