How can I get a running total to be evaluated only on change of group?
I have a report where I capture patient information, some of which is stored in the patient table and some of which is stored in the observations table. Taking date of birth as my example, if I count all the records for which the DOB has been supplied, I
get significantly more than the total number of patients, because of the join to the observations table. How do I evaluate the running total only once for each group?
Edit: sample data at http://sqlfiddle.com/#!3/27b91/1/0.
June 11th, 2012 1:20pm
Hi There
You just need to create a group report on the filed which are unique inside your data and then take a distinct count of your group.
=CountDistinct(Fields!pid.Value)
I am putting some screenshot for your help.
Many thanks
Syed Qazafi Anjum
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
June 11th, 2012 5:37pm
I didn't ask how many patients I had, I asked how many patients supplied a date of birth.
June 12th, 2012 8:44am
Hi There
Please change the expression
=CountDistinct(Fields!dateOfBirth.Value)
=CountDistinct(Fields!dateOfBirth.Value)
The result will be 2. is this what you after
Please update
many thanks
Syed
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2012 8:52am
...which will count how many distinct dates of birth there are, not how many distinct patients supplied a date of birth. If you have twins, you'll count them once with the above code, not twice.
June 12th, 2012 12:17pm
I think I figured it out -- this seems to work as I expected it to.
=RunningValue(Iif(Not IsNothing(Fields!DATEOFBIRTH.Value) , Fields!PATIENTID.Value , Nothing) , CountDistinct , Nothing )
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2012 5:14pm