Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mscull10n
Contributor
Contributor

Find every seven days between two dates

Hi.  I have to find the date for every 7 days between two dates.  The two dates vary by record.  They are the admission date and end date.

For example:  

Admission Date:  12/2/2020 

Discharge Date:    12/22/2020

Total days = 21 

I need the dates from admission date for every 7 days (including admit date):  12/8/2020, 12/15/2020 and 12/22/2020 .

Mission:  Get number of time patient had 3 hrs of therapy a day, for 5  out of 7 days.   

I think I would get the dates in a load statement, but I just can't figure it out...

I have it flagged if their total therapy time was 3 hrs or more, 

=Count(if(aggr(sum(therapy_time), pat_mrn_id, pat_enc_csn_id, calendar_dt) >=180, 1))    BUT, my aggr needs to group by the 7 day Date.. whatever that may be....

Help!

Thanks! 

QlikView 

 

 

1 Solution

Accepted Solutions
MayilVahanan

HI @mscull10n 

Try like below

Sum({<calendar_dt={$(=chr(39)&Concat(Date(ValueLoop(Admission_dt, Discharge_dt, 7)),chr(39)&','&chr(39))&chr(39))}>}therapy_time)

Hope Admission_dt & Discharge_dt is user input / date selection.

valueloop helps to calculate between  from date (Value) and to date(Value) based on steps. 


I think, you will get some idea from here to proceed further.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

HI @mscull10n 

Try like below

Sum({<calendar_dt={$(=chr(39)&Concat(Date(ValueLoop(Admission_dt, Discharge_dt, 7)),chr(39)&','&chr(39))&chr(39))}>}therapy_time)

Hope Admission_dt & Discharge_dt is user input / date selection.

valueloop helps to calculate between  from date (Value) and to date(Value) based on steps. 


I think, you will get some idea from here to proceed further.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
mscull10n
Contributor
Contributor
Author

Hi,

admission_dt and discharge_dt are not user input fields.   they could select a date range, but essentially, the dates are driven off the date the therapist entered the therapy time, not the admission/dc .   I'll try the above code.  I thank you for your reply and support.  I'll let you know if it works!

Michelle

mscull10n
Contributor
Contributor
Author

It works to display the dates.  Thank you!