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

Query for Desired Quarter

Status
Not open for further replies.

LouieGrandie

Technical User
Mar 3, 2011
136
0
0
US
Currently have a report that shows current month sales, year to date sales, last year current month sales and last year year to date sales. Now the sales department wants it changed so they can select which quarter, 1, 2, 3, 4 and show that quarters sales instead of the current month sales. Kinda of a beginner with Crystal and not sure how to do the parameter so that the user is prompted for which quarter they want to report on. Any suggestions.

Visit Sage's Online Community
 
Would the year to date total be year to date through that quarter then?

~Brian
 
Assuming that you're using calendar year.
Let's put in a parameter for the year {?year}
and a parameter for the quarter {?quarter}

Then you need two formulas:
{@begindate}
if {?quarter} = 1
then date({?year},1,1)
else
if {?quarter} = 2
then date({?year},4,1)
else
if {?quarter} = 3
then date({?year},7,1)
else
date({?year},10,1)

and just use those in your select: {table.date} in {@begindate} to {@enddate}


{@enddate}
if {?quarter} = 1
then date({?year},3,31)
else
if {?quarter} = 2
then date({?year},6,30)
else
if {?quarter} = 3
then date({?year},9,30)
else
date({?year},12,31)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top