Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Select Max Effective Date for Sales Percentage Post Reply Post New Topic
Author Message
Elisha83
Groupie
Groupie


Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
Quote Elisha83 Replybullet Topic: Select Max Effective Date for Sales Percentage
    Posted: 21 Dec 2008 at 11:45pm
Hi there~
 
I need a guidance on how to get a Max effective date for my Sales percentage based on the date that I enter in the date parameter.
 
For example, I have set 3 Sales percentage and assign each effective date taken.
 
Date                    Sales Percentage
31/01/08                          5
30/06/08                        10
01/12/08                        15
 
 
Lets say I enter 28/02/08 in the date parameter, then it will show Sales Percentage = 5. If I enter 30/07/08, then it will show Sales Percentage = 10.
 
 
How should I do in order for me to achieve that results? Please advice~
 
 
 
Thanks & Regards,
Elisha Smile
3Lish@
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 22 Dec 2008 at 1:59am
Hi
 
What you can do is create two formulas to extract the date and year part from the date in parameter field,
then for the month formula of parameter field check for month of jan  to give you dec records....
 
if month({?MY_Date}) = 1 then  
month({?MY_Date})
else
Month({?MY_Date})-1
 
then in your record selection formula
 
 
check for
month({Table.FieldName}) = {@Frm_Prm_Month} and
Year({Table.FieldName})= {@Frm_prm_year}
 
What i have done is to subtract month from the parameter to match the month in table field i.e.Month({?MY_Date})-1
 
if you could post few more sample records i.e. dates for month of Jan,June, and so on not just one date .... i could test with all possible commbinations,currently what will happen is even when you select 28/02/08 or 01/02/08 you will get record for 31/01/08                          5
 
 
 
Cheers
Rahul
IP IP Logged
Elisha83
Groupie
Groupie


Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
Quote Elisha83 Replybullet Posted: 22 Dec 2008 at 5:25am
Hi Rahul,
 
I guess I didn't write clearly on what I want.
 
For example, I have set 3 Sales percentage and assign each effective date taken in my system.
 
Date                    Sales Percentage
31/01/08                          5
30/06/08                        10
01/12/08                        15
 
 
Lets say I enter a date in between date range of 31/01/08 to 29/06/08, then I will get Sales Percentage = 5. If I enter a date in between date range 30/06/08 to 30/11/08 then i will get Sales Percentage= 10. If the date that I enter is on or after 01/12/08, then it will show Sales Percentage = 15.
 
So, what can I do to achieve this results? Should I still use the Summary Group for Effective Date and put Max?Please advice~
 
 
 
Thanks & Regards,
Elisha Smile
3Lish@
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 23 Dec 2008 at 3:42am

Hi

You just need a simple record selection then
 
{Table.Date} in {?Startdate} to {?EndDate}
 
Cheers
Rahul
IP IP Logged
Elisha83
Groupie
Groupie


Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
Quote Elisha83 Replybullet Posted: 11 Jan 2009 at 10:38pm
Hi rahul,
 
I have only 1 date parameter which is call "Cut off date".
 
If I use that formula and enter my Cut Off Date as 01/07/08, it will show Sales percentage = 5  and Sales Percentage = 10 at the same time.
 
But, I just want it to show the latest Sales Percentage based on my cut off date, which means it suppose to show Sales Percentage = 10.
 
How can I do that? Please advice..
 
 
 
Thanks in advance.
 
 
Regards,
Elisha
3Lish@
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Jan 2009 at 8:14am
If you are OK with just suppressing items rather than excluding them and these sales dates are related to another item like "Company" or "Sales Rep" that you can group on, here is an approach.
Use your "Cut off Date" to select the records as you were doing.
Create a group on the field you need to present these by. I'll use "Company" as an example.
Suppress your detail records where using this:
{DatefField}<>Maximum({DateField},{CompanyField})
This will suppress all of the records that are not the maximum sales date per Company.
 
 
IP IP Logged
Elisha83
Groupie
Groupie


Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
Quote Elisha83 Replybullet Posted: 13 Jan 2009 at 2:12am
Thanks DBlank~ It solves my problems. Thanks a lot for your help.
 
 
 
 
Regards,
Elisha
3Lish@
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.