Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Totals from two different date ranges Post Reply Post New Topic
Author Message
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Topic: Totals from two different date ranges
     Posted: 30 Jul 2013 at 6:34am
I have a report that shows the usage of parts by quater.  The powers that be (usually the ones who life more difficult) would like to see the Number of parts sold in the current quater in one column and then the total used for the the last 6 months in another. 
 
How can I do this?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Jul 2013 at 6:57am

a number of ways to handle it.

one simple solution is to create a 2 formula fields to 0 out rows that dont meet your condition.
//current quarter
if datefind in range then sold_field else 0
//last 6 months
if datefield in new range then sold_field else 0


Edited by DBlank - 30 Jul 2013 at 7:00am
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 30 Jul 2013 at 7:36am
I'm having trouble finding the right syntax for the ranges
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Jul 2013 at 7:57am
please define your specific definitions of current quarter and last 6 months
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 07 Aug 2013 at 7:16am
my appologies for taking so long to respond.  I am trying to chart trends of usage.  If we run the report today 8/7/13 I would like the report to look like the following
 
Part Number                Qty used This Quater            Qty used last 6 months
ABC123               3(2nd quater numbers May-AUG)   7 (usage  FEB- AUG)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Aug 2013 at 8:55am
so you are  defining both current quarter and last six months based on today's date only?
last 6 months is (based on today) 2-1-13 to present?
current quarter (based on today) is 7-1-13 to today?


Edited by DBlank - 07 Aug 2013 at 8:55am
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 07 Aug 2013 at 9:46am
Yes that is exactly what I am trying to to. I also what year to date but I figured I could just see what wad done for the six month interval
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Aug 2013 at 10:03am
//current quarter
if datepart('q',{table.date})= datepart('q',currentdate) and  datepart('yyyy',{table.date})= datepart('yyyy',currentdate) then table.sold else 0
//last 6 months
if {table.date} in dateserial(year(currentdate),month(currentdate)-6,1) to currentdate then table.sold else 0
//year to date
if {table.date} in YearToDate then table.sold else 0


Edited by DBlank - 07 Aug 2013 at 10:04am
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 09 Aug 2013 at 6:12am
Thank you.  that did the trick
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum