You asked for more info - you may be sorry, as this is rather long-winded!
I have a total of 5 dates:
Chemo6 (for people who receive 6 months of chemotherapy... some need no more)
Chemo8 (for people who receive 8 months of chemotherapy)
Vaccine (for people who complete chemotherapy & then receive vaccine... but
some folks don't respond to chemotherapy & therefore don't receive vaccine)
Relapse (for people whose disease comes back at some point... This time
point varies from person to person. Not all people relapse, and if they do,
it may be after 6 months of chemotherapy, 8 months of chemotherapy, or
vaccine.
In my query, I figured out the last day of chemo as follows: LastChemo:
IIf([Chemo8]>[Chemo6],[Chemo8],[Chemo6])
In my query, I figured out the last day of therapy as follows: LastTx:
IIf([Vaccine]>[LastChemo],[Vaccine],[LastChemo])
Then in my query, I figured out the number of days between the end of
therapy (whether 6 or 8 months of chemo or vaccine) and relapse as follows:
DaysToRelapse: ([RelapseDate])-([LastTx])
In my report, I totalled the # of patients treated: =Count(*)
I then figured out the percentage of patients who were treated and, at some
point, relapsed: =Sum((IsNull([RelapseDate])+1))/Count(*)
I then figured out the average # of days til relapse: =Avg([DaysToRelapse])
I want to be certain that my "Percentage of patients in relapse" and
"Average # of days to relapse" are accurate. Some patients are still
undergoing treatment, so they haven't completed chemotherapy or received
vaccine. I want to exclude them when calculating the percentage of patients
in relapse. And some patients who have completed treatment haven't relapsed,
so they need to be excluded from "average # of days to relapse".
The point is, after all the calculations, I've gotten a bit "lost in space".
Do I need to fine-tune my calculations in either the report or the underlying
query to get what I want?
Many, many, many thanks!
--
Thanks for your time!
Jeff Boyce said:
How are you calculating the average? How do you know it includes records
with nulls?
In query design mode, you can:
* use the Totals toolbar button (greek sigma) to calculate an average (IF
your data structure is well-normalized)
* use the criterion of "Not Is Null" to exclude records w/ nulls
Bottom line is based on your starting point. Describe your data structure,
give an example...
--
More info, please ...
Jeff Boyce
<Office/Access MVP>
I'm a newbie, so please be gentle with me...
I don't really know how to do calculations in a query. I've set up a
report
based on a query, and with lots of trial & error managed to insert
calculated
fields in the report footer which give me the total number of patients
treated, the percentage of these patients who have relapsed (i.e. their
disease recurred), and the average number of days between the end of
treatment and relapse. The problem is, I've got an average that includes
null
values - and these should be excluded.
What is the best way to get this information into my report? Should I do
this in the query on which the report is based, or should I do this within
the report using a calculated control? And if the query is the best
approach, can you please walk me through the steps?
Appreciate all your help!