Jump to content

tricky date calculation


This topic is 4824 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am a doctor and working on a research project. I have patients who have a lab value measured several times a day. If the value is above a certain level, we start a medication and we adjust the dosage several times a day. I record the lab value in LabValues:value and the time when the lab value was measured in LabValues:timestamp. I record the medication dosage in Medication:dosage and the time when the medication dosage was adjusted in Medication:timestamp. I want to find the last lab value that was recorded before the medication was started and color it red. I cannot figure out the formula to do that. Can anybody help?

Thanks

Andreas

(Using FM11 on a Mac)

Link to comment
Share on other sites

This part is not quite clear:

I want to find the last lab value that was recorded before the medication was started and color it red.

The "last lab value" is different for each change of dosage, isn't it? So where exactly do you want to find it? You could, if you wanted, link each dosage to its own "last lab value" using a relationship.

Link to comment
Share on other sites

  • Newbies

No, that's part of the problem. The lab values get measured independently of the dosage changes. So I want to find the lab value that triggered the first dosage change (i.e. starting the medication). That would be the lab value that was measured just before or right at the time of the first dosage change. I tried the following formula to conditionally format the LabValues:value field:

If ( LabValues::Timestamp <= Min ( Medication::Timestamp ) ; 1 ; 0 )

This allows me to color all lab values that were measured up to the time when the medication was started, but I only want to color the very last value that was measured before the medication was started.

Hope this is more clear. Thanks for your help!

Andreas

Link to comment
Share on other sites

This topic is 4824 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.