cancel
Showing results for 
Search instead for 
Did you mean: 

How do we create a variable on WEBI that calculates if the patients do the same labs within 60 days,

SAR_22
Explorer
0 Kudos
342

 

HOW TO calculate the number of days between 2 labs?

HOW TO calculate the number of patients how did the 2 labs within 60 days? 

 

USING THE LAB PERFORMED DATE&TIME

 

nachtaktiv
Participant
0 Kudos
be sure that your "date" is a real date-format, then calculate with DaysBetween()
Ronaldbbb
Discoverer
0 Kudos

To create a variable in Web rope Intelligence (WebI) that calculates whether patients did the same labs within 60 days, follow these steps:

Step 1: Create a Variable to Calculate the Difference in Days

  1. Create a variable to calculate the number of days between two lab tests.
    • Use the DaysBetween function.
    • Example formula:
      plaintext
      Copy code
      =DaysBetween([Lab Performed DateTime]; Previous([Lab Performed DateTime]))
    • This will calculate the number of days between the current lab test and the previous one for each patient.

Step 2: Filter the Labs Within 60 Days

  1. Create another variable to flag the lab tests that occurred within 60 days.
    • Example formula:
      plaintext
      Copy code
      =If([Days Between] <= 60) Then "Within 60 Days" Else "More than 60 Days"

Step 3: Calculate the Number of Patients

  1. Create a variable to count the number of patients  who did labs within 60 days.
    • Use the Count function.
    • Example:
      plaintext
      Copy code
      =Count([Patient ID] Where ([Days Between] <= 60))

This should give you the number of patients who performed the same lab test within 60 days. You can adjust this further based on your data structure. Let me know if you need more details !

SAR_22
Explorer
0 Kudos
The DaysBetween function will calculate the days between the first patinet and second patients which is not what I look for. What I want is to calculate the number of days between 2 labs for the same patients
View Entire Topic
SAR_22
Explorer
0 Kudos

 

Yes, I already calculate the number of days between the two labs, but how to calculate the number of patient who did the 2 labs

G-Garlatti
Explorer
0 Kudos

Hey, I don't know if you have resolved your problem. In any case, you could use a variable "Couple" where Couple is the concatenation of the 2 lab you search.

After that you could use your 60days measure where lab1+lab2 = "couple"...dunno if it help, without data samples can't answer correctly.

SAR_22
Explorer
0 Kudos
the formula "Couple" is not available in webi, could your please provide another formula
G-Garlatti
Explorer
0 Kudos

There not couple function because is not what i wrote. Could you first give us a simplified sample of your dataset ?
ex :

client numbernb dayslab 1lab2
xxx150structure 1structure 2
xxx230structure 2structure 2
xxx30structure 1-
xxx4100structure 1structure 4
...   

Is it something like that ?
So here it will be number([client number]) where ([nbdays]<=60)
or number([client number]) where ([nbdays]<=60 and [lab2]<>"-")

SAR_22
Explorer
0 Kudos

No,  here is a sample of the data which contains the following column.

what I want is to count the number of patients who did 2 labs within 60 days

SAR_22_0-1729403876802.png

 

G-Garlatti
Explorer
0 Kudos

@SAR_22so, If I follow your data, you have a table organised like that :

Customer key | MRN - organization (Lab ?) | Performed Date/time | Status of the operation performed | other data and probably an "operation key"

  • 1 line = 1 analyse performed by customer in a lab
  • You could have n ligne for 1 customer.

So first, you need to know the order of each performed analyse with Rank(measure;[ranking_dims][;Top|Bottom][;reset_dims]) and put it in an object like OrderRanked

This rank give you a list from the first analyse to the last.
With number(operation key) in (customer key) you cound know how many performed analyse you have by customer.

With the [Performed Date/time] where(OrderRanked="1") you obtain the first date of your list.
After that, for each line you could calculate with datebetween() the first date and the date in the line.

You could also mark your customer whose answer your parameters (you stop the calcul when you find what you want)