0

Is there anybody who can help me out with a Crystal Reports question? I did a groupresult as average. The Option Average from the groupresults shows me per example 4.3, 5.4, 6.3.

The question is, if there are some options to round these results from the groupsum to

4.3 -> 4.5, 
5.4 -> 5.5, 
6.3 -> 6.5.

I tried the formula round(x,y) operator but it is not working well. The round function does not show me the correct results, because I try to round up the Groupingresult. And If I click on the field edit Groupresults (Running Total) I can just choose round to decimals. But if I do so, it will show me 4.3, 5.4 and 6.3 as examples. A not 0.5. For my case, the group result shall be calculating the average and rounding it up to half degrees.

here the code i got in group results: Round (average({Orders.SumOrders}), 1)

Thank you very much for your help :)

Zan
  • 1
  • 1

2 Answers2

0

The simplest solution is to use the mround() function.

For example, mround(4.3, 0.5) would result in 4.5

MilletSoftware
  • 3,521
  • 2
  • 12
  • 15
  • I tried this also. But since the average was made with an running count (average) it does not allow me to do that :/ Thx for your effort. – Zan Sep 22 '22 at 15:04
  • Please clarify the problem. Rounding should be possible for any value, regardless of how it was derived. If the problem is related to trying to average a summary value (for example, average a summary value across groups), that problem can be solved by using a 3rd-party UFL (User Function Library) or by precomputing the group values in the data source (using a View, Stored Procedure or Command). – MilletSoftware Sep 22 '22 at 17:25
  • The thing is: The average is calculated in a running total (you know in the field explorer, you may calculate with the RUNNING TOTAL average, sum, median etc.. ) And i cant go just there and write a formula in to an running total. Thats why the mround function does not work there. And in the round option from crystal where you can edit a field and edit the number like (date, date and hour, round etc..) -> there i cannot write the formula to. every time 4.4 shows me 4.4 and not 4.5 as it should be :) – Zan Sep 23 '22 at 08:22
0

Assuming your running total is called {#RTotal1}, you can simply create a new formula like:

mround({#RTotal1}, 0.5)

and place that formula on the report canvas.

MilletSoftware
  • 3,521
  • 2
  • 12
  • 15
  • i could solve it with an integer parsing. The problem was in running total field, it couldnt identify the datafields value. and with 0.5 after Rtotal1 it did not work. but i could solve this problem also with the aid of yours and the input gave me the idea to parse integer it. Thank you very much :) – Zan Sep 23 '22 at 13:58