NEWS & TECH BLOG
Quarters in Crystal
18/01/2011 – in CrystalCrystal 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’)