BananaFury
asked on
Crystal Formula
Hi,
I am trying to make the following formula work. I guess, I am looking for a sub query. I have tried the following..
local numbervar CntInformedRes;
CntInformedRes :=
if date({Archive_tblEvents.Ta bleDate}) = today
and {Archive_tblEvents.SubStat usGroup} = "Accepted - Informed Reserve"
then 1 else 0;
local numbervar SumInformedRes;
SumInformedRes :=
if date({Archive_tblEvents.Ta bleDate}) = today
and {Archive_tblEvents.SubStat usGroup} = "Accepted - Informed Reserve"
then {Archive_tblEvents.Outstan dingReserv es} else 0;
Sum(SumInformedRes) / Sum(CntInformedRes)
This doesn't work, it wants a field. It doesn't accept the variables assigned.
And..
Sum(
if date({Archive_tblEvents.Ta bleDate}) = today
and {Archive_tblEvents.SubStat usGroup} = "Accepted - Informed Reserve"
then 1 else 0
)
/
Sum(
if date({Archive_tblEvents.Ta bleDate}) = today
and {Archive_tblEvents.SubStat usGroup} = "Accepted - Informed Reserve"
then {Archive_tblEvents.Outstan dingReserv es} else 0
)
but with this it wants fields.
I think it is fairly clear what I am trying to achieve, and I bet the answer is simple.
Thanks
I am trying to make the following formula work. I guess, I am looking for a sub query. I have tried the following..
local numbervar CntInformedRes;
CntInformedRes :=
if date({Archive_tblEvents.Ta
and {Archive_tblEvents.SubStat
then 1 else 0;
local numbervar SumInformedRes;
SumInformedRes :=
if date({Archive_tblEvents.Ta
and {Archive_tblEvents.SubStat
then {Archive_tblEvents.Outstan
Sum(SumInformedRes) / Sum(CntInformedRes)
This doesn't work, it wants a field. It doesn't accept the variables assigned.
And..
Sum(
if date({Archive_tblEvents.Ta
and {Archive_tblEvents.SubStat
then 1 else 0
)
/
Sum(
if date({Archive_tblEvents.Ta
and {Archive_tblEvents.SubStat
then {Archive_tblEvents.Outstan
)
but with this it wants fields.
I think it is fairly clear what I am trying to achieve, and I bet the answer is simple.
Thanks
ASKER
That's a shame.. I was aware that this could be tackled with three separate formulas, but I was really hoping it could be handled in one. Is there no other way of dealing with such formula?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, I need all the records for other areas of the report. Usually I would either use a sub report for just the records required, but having subs on reports with large tables and multiple groups isn't great, or multiple formulas, which was your approach, but that means of course if a report needs 10 Average formulas I end up with 30 formula fields, which is painful to build and maintain.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks people. That counted weighted averages in an interesting approach. I haven't tried it so far to be honest, I just built it the way I was comfortable, but I will definitely experiment with it
Formula 1 - CntInformedRes
Open in new window
Formula2 - SumInformedRes
Open in new window
Formula 3 - MySummary
Open in new window
The problem is summary formulas are evaluated over the entire recordset but that variable only has a value for 1 record. The formula can't be evaluated for each record except as each record is handled so all the values don't exist.
mlmcc