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

Last Month, Last year this month formula

Status
Not open for further replies.

cheeseman10

IS-IT--Management
Apr 27, 2010
7
US
Hi,
First post so please be easy on me.

I am trying to pull information on items with this month's info, last month, 2 months ago, this month last year, and next month last year. The problem is my date is saved in two seperate fields in my db; {month} and {year} and I do not know how to formulate them to pull this info.
Can someone please help me write a formula, I have spent WAY too much time on this problem already and searched everywhere with no luck.

Thanks!
Doug
 
Use a formula to create a date, somthing like:
Code:
Date({your.year}, {your.month}, 1)
Once you have your date, DateDiff is useful for finding past periods.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
I am still lost here.

I need to display my units used for this month and also display my units used for last month, and so on. I can display this month with no problem using a parameter field to select this month and this year but how can I also show last month's units used and two months ago and last year this month ect.

thanks!
 
Use DateDiff for months. Your HELP function should give you the details. You should get 0 for this month, 1 for last month etc.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top