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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting data rom last month in current month

Status
Not open for further replies.

crysln

Technical User
Jun 24, 2009
9
BH
Hi
I am new user for crystal reports. I am using MS SQL data base. There is one table which stores all the information of employee with regards his salary details. I want to make report which will show salary details of emplyee for the current month as well as last month.
example: Current Month is June, then repeort will show salary details for current month and last month(i.e) May.
then i want to take difference.
Please help.
 
Do you have records for both months? Then select, group by employee and use 'Previous' to compare.

Another method would be to add the dataset twice, for the current month and as an 'alias' for the previous month. But this would run into trouble if they had started this month.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options. In this case, it probably makes no difference.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Use a record selection formula like this:

{table.date} in dateadd("m",-1, currentdate-day(currentdate)+1) to currentdate

This will bring in both months of data. Then insert a group on {table.date} on change of month to get the two sets of salary detail.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top