Joined: 26 Mar 2010
Online Status: Offline
Posts: 2
Topic: Boolean as condition in Average Summary Posted: 20 May 2010 at 12:09pm
Thank you in advance for any advice.
I am trying to calculate the average of one field based on the value of another, and would like to make these formulas work and not use running totals (as this is only one part of a much larger calculation).
The field I would like to average is: {Sheet1_.Arguing} It is a number field with values 1-5.
The field that I would like to use as the condition is: {Sheet1_.Time} This can have the values: "Intake", "Annual", and "Discharge".
I want to calculate the average of {Sheet1_.Arguing} separately for when {Sheet1_.Time}="Intake" and {Sheet1_.Time}="Discharge"
In order to use the average(field,condfld) i created two booleans to evaluate true depending on if {Sheet1_.Time}="Intake" or "Discharge". @Intake_True: {Sheet1_.Time}="Intake" @Discharge_True: {Sheet1_.Time}="Discharge"
Then made the formulas: average({Sheet1_.Arguing},{@Discharge_True}) average({Sheet1_.Arguing},{@Intake_True})
Both booleans work accurately.
Only the average({Sheet1_.Arguing},{@Intake_True}) works.
average({Sheet1_.Arguing},{@Discharge_True}) returns the same value as when evaluating for {@Intake_True}.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 25 May 2010 at 4:01am
Not exactly sure what your logic is here with the over all design.
You would need to make groupings on your 2 formulas. If you can group then just group on the Sheet1_.Time field and get your values there.
Also using a Running Total (RT) would not preclude you from using your results from that RT in another formula as long as it is evaluated at the end of the report.
Joined: 26 Mar 2010
Online Status: Offline
Posts: 2
Posted: 27 May 2010 at 1:11pm
Thank you for responding!
I made sure to have a group for each of my boolean formulas: @Intake_True and @Discharge_True.
Unfortunately, using either of them as my group in the following formula average({Sheet1_.Arguing},{@Discharge_True} still results in a value that only corresponds to @Intake_True.
Using running totals for the report I'm building would take significantly longer than if I could get this type of formula to work. It would be a difference of three running totals per item versus one formula per item (and it's a report of 100s of items).
I'll keep working with the groupings, but if you have any other advice I would VERY MUCH appreciate it.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 01 Jun 2010 at 4:12am
Still not understanding your overall design or result desired but you can just group on the {Sheet1_.Time} field and it will seperate your rows into 2 groups as "Intake" or "Discharge". YOu do not really need your formulas for this.
From there you can do your calculations on any fields at these group levels.
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