Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If, then question

Status
Not open for further replies.

luv2bike2nv

IS-IT--Management
Jun 28, 2007
90
US
Crystal Reports 8.5

I have been creating "simple" reports, nothing fancy.
Now I have a user that wants a report with a bar chart with percentage of ontime delivery on the X Axis and the month on the Y Axis.

I haven't not done this, however I believe it can be done. I need a count on how many lines there are in a group (month) (which i believe i should get the count by creating a Running Total, correct me if I am wrong). I need to add one to a total for each ontime delivery (optional -- add one for each late delivery). Then get a percentage for each month for ontime deleivery to be used in a Bar Chart.

I have an if, then, else statement for:

@Ontime
if {cusdue} >= {shpdte}
then {cusdue} - {shpdte}

and one for late delivery
@Late
If {CUSDUE} <= {SHPDTE}
then {SHPDTE} - {CusDue}

I also have an if,then for counting:
@ontimecount
if cusdue >= (shpdte)
then 1

and
@latecount
if cusdue <= shpdte
then 1

question 1:
can i nest the two if then formulas that have >= into one, the same with the 2 if then that have <=? if so, how would i go about doing that?

Question 2:
which function can i (or should I) use to get the percentage of ontime deliveries. i believe i would use the Running Total (total number of lines in the group)
Runnting Total formula:

#linecount
Summary
Field to summarize: Delnum (delivery line number)s
Type of Summary: Count

Evaluate
on Change of group: CusDue

Reset
On Change of group: Cusdue

I am using CusDue for the Month which the Group header/footer is set for Month.

Any help would be appreciated.

Thanks so much.


 
First, you need to remove the equal sign from your {@latecount} formula, since the way you have it now, some orders could be both ontime and late. Do not use running totals. Instead create two formulas:

//{@late%}:
sum({@latecount},{table.date},"monthly")%count({table.deliveryID},{table.date},"monthly")

//{@ontime%}:
sum({@ontimecount},{table.date},"monthly")%count({table.deliveryID},{table.date},"monthly")

Insert a chart that uses {table.date} as the on change of field->order button->print on change of month. Add {@late%} and {@ontime%} as your summary fields (do not summarize should be checked for each). Place the chart in the report header or report footer.

-LB
 
Thank you LB.

I will follow your instructions, I appreciate your feed back. I will come back with my results.

RI
 
You'd better show the content of the formulas and the nested formulas.

-LB
 
I don't have any nested formulas but here is what i have

@ontimecount
if {SO_Detail.CUSDUE_28} >= {SO_Detail.SHPDTE_28}
then 1

@ontime%
Sum ({@ontimecount},{SO_Detail.CUSDUE_28} , "monthly") % Count ({SO_Detail.SHPDTE_28},{SO_Detail.CUSDUE_28} , "monthly")

@ontime
if {SO_Detail.CUSDUE_28} >= {SO_Detail.SHPDTE_28}
then {SO_Detail.CUSDUE_28} - {SO_Detail.SHPDTE_28}

@late
If {SO_Detail.CUSDUE_28} < {SO_Detail.SHPDTE_28}
then {SO_Detail.SHPDTE_28} - {SO_Detail.CUSDUE_28}

@late%
Sum ({@latecount},{SO_Detail.CUSDUE_28} , "monthly") % Count ({SO_Detail.SHPDTE_28},{SO_Detail.CUSDUE_28} , "monthly")

@latecount
if {SO_Detail.CUSDUE_28} < {SO_Detail.SHPDTE_28}
then 1

These are the only formulas I have created.
Is this what you looking for?
Thanks so much,
RI
 
On the type tab, which bar chart did you select? You should just use the side by side bar chart, not the percent bar chart, and you can add both ontime% and late% to the same chart.

-LB
 
The Bar Chart I am using is the Side by Side one.

I have attached screen prints of the Chart Expert.
maybe there is something that i configured that i should not have.

on the Axes screen i configured it that way because i was not getting the percentage on the X axes. if that is not what i should have done, please advise on how i can get the percentage on the X axes

Thanks,
RI
 
 http://www.mediafire.com/file/7zid4eyac3txlp4/Chart%20configuration.doc
In the late% and ontime% formulas, replace the % with /.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top