Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Compare data with the year before

Hello,

My name is Wessel van Erp and I'm student who just has started to work with Crystal Reports and SAP Business One. I'm really new to this kind of stuff. I've learned the basics using several tutorials and yt-videos, but at the moment I am stuck.

I am working on a cost report where I want to compare the total costs per account to the same time the year before. I managed to create a table to show the costs per account over a time set using a filter that's connected to a time range parameter. I want to compare these results to the exact same time the year before. So if the range is set as 01-04-2014 to 30-04-2014 it should automatically calculate the costs over 01-04-2013 to 30-04-2013. I want to show these two columns next to each other. So like this:

Costs by ledgerCurrentYear before
General costsxxxxxx
Labor costsxxxxxx
Depreciationxxxxxx
Material costsxxxxxx

I use the JDT1 table to find the journals which are in the Debit and Credit column, and dates are entered in the RefDate column.

I'm sure there is a easy workaround for this, but i'm not able to find it. As I told I'm really new to this, so I really need some good help. It is possible that I explained it a bit unclear, so I'm standby for all your questions. I've searched for people with the same problems, but none helped. Probably because of my lack of skills. It is not that I'm lazy or something.

Thanks in advance for helping me!

Former Member
replied

Hi Wessel,

Try this please:

1) Modify the existing record selection formula (Report > Selection formulas > Record) so that you're not restricting the records to just the range you've selected. It should be something like:

{Database_date_field} IN [Minimum({?DateRangePrompt}) TO Maximum({?DateRangePrompt})]

OR

{Database_date_field} IN [cdate(Year(Minimum({?DateRangePrompt}))-1, Month(Minimum({?DateRangePrompt})), Day(Minimum({?DateRangePrompt}))) TO cdate(Year(Maximum({?DateRangePrompt}))-1, Month(Maximum({?DateRangePrompt})), Day(Maximum({?DateRangePrompt})))]

2) Insert a Crosstab and place this on the Report Header

3) Use the 'Costs by ledger' field as the 'Row' of the Crosstab. Use the Date field from the database as the 'Column' of the crosstab and choose the 'measure' field as the 'Field to summarize'

4) While in the Crosstab Expert, highlight the date field under columns > choose Group Options > Where it says 'this section will be printed', choose 'For Each Year' from the drop-down.

-Abhilash

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question