Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: if else formula Post Reply Post New Topic
Author Message
Florina
Newbie
Newbie


Joined: 23 May 2011
Location: United States
Online Status: Offline
Posts: 9
Quote Florina Replybullet Topic: if else formula
     Posted: 24 May 2011 at 2:08am
 
I need your help please.
 
I am creating a crystal report and missing one column.
 I am having a trouble creating  an if else formula weith the follwoing: 
 
Sales     Product   Commission
 $10,000           A                  10%
  $23,000          B                   5%
and so on
   
 
My report has a few columns:
Customer 
Total sales (Sales)
Product sold (A,B..)
Formula under commission should be:
If product A sold then commission = 10%
If produc B sold then commission = 5%
 
 
Can you please suggest.
 
Kindly  let me know incase you need more info from my side.
 
Thank you
 
FlorinaCry


Edited by Florina - 24 May 2011 at 2:09am
Florina
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 24 May 2011 at 8:22am
If product A sold then commission = 10%
else
If produc B sold then commission = 5%
else
0
sharona
IP IP Logged
Keikoku
Senior Member
Senior Member


Joined: 01 Dec 2010
Online Status: Offline
Posts: 386
Quote Keikoku Replybullet Posted: 24 May 2011 at 8:43am
Create a formula and write something like the following, substituting the correct fields


Local numbervar commission := 0
if {productSold} = "A" Then
   commission := {sales * 0.1);
else if {productSold} = "B" Then
   commission := {sales * 0.05};
commissions;


Then drag onto report.

If you just want to write "10%" then declare it as a string and do what is suggested above.

Edited by Keikoku - 24 May 2011 at 8:44am
IP IP Logged
Florina
Newbie
Newbie


Joined: 23 May 2011
Location: United States
Online Status: Offline
Posts: 9
Quote Florina Replybullet Posted: 25 May 2011 at 2:49am

Thank you so much.

I am trying to do this  report with prior year comparison.
 
Customer name      Sales            Product          Commission
 
 
Customer A           
Year 
   2009                    $10,000          A                            10%
   2010                    $25,000          B                             5%
 
My data base has history from prior year.
How is this done?
 
Thank you
 
Florina
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 25 May 2011 at 3:07am
you can create a group by year based upon invoice date???
then create a parameter for year
so the end user can select the year or years they want to see
sharona
IP IP Logged
Florina
Newbie
Newbie


Joined: 23 May 2011
Location: United States
Online Status: Offline
Posts: 9
Quote Florina Replybullet Posted: 31 May 2011 at 10:12am

Over / Under

I have a report reflecting sales by customer year 2010 and 2009
I need a formula for over/under on each customer and on the total for the report.
 
How do I do that?
 
Thank you
 
Florina
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 01 Jun 2011 at 4:10am
please be more specific, over and under what????
if you need to create a formula that displays if something is greater than you would use the > and less than <
sharona
IP IP Logged
Florina
Newbie
Newbie


Joined: 23 May 2011
Location: United States
Online Status: Offline
Posts: 9
Quote Florina Replybullet Posted: 01 Jun 2011 at 4:19am
My report is as follows:
 
Customer A
Sales Year 2009
Sales Year 2010
 
Customer B 
Sales Year 2009
Sales Year 2010
 
I need a formula showing the difference between the years
 
Also, my report is grouped by territory. I am not sure how to insert a summary of total sales by year at each territory level as well as grand total.
 
For instance:
 
Territory East :
Total Sales year 2009
Total Sales year 2010
Over Under Total Sales year 2010-Total Sales year 2010
 
Territory West:
Total Sales year 2009
Total Sales year 2010
Over Under Total Sales year 2010-Total Sales year 2010
 
Grand Total:
Total Sales year 2009
Total Sales year 2010
Over Under Total Sales year 2010-Total Sales year 2010
 
Thank you bunch
 
 
Florina
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 01 Jun 2011 at 10:10am
your report should be grouped by territory then year
create a summary by year
then create a formula which subtracts year from year
 
sharona
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