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

Current Quarter Date 1

Status
Not open for further replies.

southbean

Technical User
Jun 3, 2005
147
US
Hello all,

I’m trying to create a formula that I can use to create a Group. This Group should limit the records to those in the current quarter. For example, if I run the report in June, I should get only those records for April, May & June. So far I have this to display the month:
Code:
//@Monthly
If CurrentDate in Calendar1stQtr Then monthname(month({Table.DateField})) Else
If CurrentDate in Calendar2ndQtr Then monthname(month({Table.DateField })) Else
If CurrentDate in Calendar3rdQtr Then monthname(month({Table.DateField })) Else
If CurrentDate in Calendar4thQtr Then monthname(month({Table.DateField }))
Now, how can I limit it to only those in the Current Quarter?

Thanks for any/all assistance!!!

t.
 
You could just limit the records in the record selection formula like this:

datepart("q",{table.date}) = datepart("q",currentdate) and
year({table.date}) = year(currentdate)

Then you could insert a group on {table.date} and choose "print on change of month". You can then format the date to appear as the month name by clicking on the date->format field->date->customize->month: March->day: None->Year: None.

-LB
 
LB,

You're the BEST! Thank you.

One question: I'm going to use a sub-report in this report. If I put your formula in the 'record selection formula' of the parent report, will it limit the records in the child report to those records as well? The sub-report will use the same database.

Thank you again!

- t.
 
Record selection in the subreport is independent of the main report. You can pass values down from the main report, but a major use of subreports is to show stuff that the main report does not include.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
In this case, you might be able to just copy the main report selection formula and use it in your subreport as well, although it depends really on where you are putting the subreport, and what you are trying to achieve with it. So, I suggest you provide that info.

-LB
 
Madawc & LB,

Thank you both for your replies!

I'm anticipating I may need to add further data to this report and therefore was hesitant to limit all the records by using the formula in the record selection formula.

What I ended up doing was taking LB's formula (called it @CurrentQuarter) and conditionally suppressed the date group in the 'Section Expert' like so: {@CurrentQuarter} = False.

It seems to work just fine with the sub-reports.

Thank you both again. This is a GREAT forum!

t.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top