Categories

Follow our news:

Follow canonburysvcs on Twitter Follow Canonbury Services on Facebook Follow Canonbury Services' news by RSS Follow Canonbury Services' news by Atom Follow Canonbury Services' news by email

NEWS & TECH BLOG

Quarters in Crystal

18/01/2011 – in Crystal

Crystal Reports gives you the option of grouping by quarters, but it’s not very obvious how to do calculations that rely on knowing which quarter a particular date falls in.

The answer is to use the datepart function.

For instance, to display the quarter for a particular date, formatted as ‘2011 – quarter 3’, you would use the following formula:

Totext (Year ({cal.ondate}), ‘0000’) + ” – ” +
Totext ( DatePart ( ‘q’ , {cal.ondate}) , ‘0’)

Share