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: 
Not applicable

Help with Peek function

Hi all

I am a new bee to the qlikview and having trouble with peek function ..

In my situation, I want to extract Start Date and Stop Date from following table as you can see i have only 1 Date column which contain Start/Change/Stop Date which depends on ACTION column :

01 - Start (New drug start)

02 - Change (Change of dose)

03 - Stop ( Drug Stopped)

The tricky bit is that When Action=02 dose is changed so the Change date should become Start date for the current dose and stop date for the previouse dose.

I am really confused with it,,

Any help will be greatly appreciated

 

IDActionDrugDoseDate
6FF01035.0009/04/2009 00:00:00
6FF020310.0015/03/2010 00:00:00
6FF02035.0004/07/2011 00:00:00
6FF020310.0027/02/2012 00:00:00
6FF0104250.0010/07/2008 00:00:00
6FF0304125.0009/04/2009 00:00:00
389010175.0002/10/2008 00:00:00
38901035.0015/12/2010 00:00:00
389030310.0023/03/2011 00:00:00
389010462.5030/01/2007 00:00:00
3890304125.0009/03/2007 00:00:00

Requred Ou

put

IDActionDrugDoseStart DateStop Date
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Not applicable
Author

Hi Abu,

So i guess you have to make a

TStart:

load distinct

ID, Drug, max(date)

from table

where action = '02'

group by

ID, drug;

this will give you the new start date

TStop:

Do the same with Action = 03 to get Stop date.

You can Concatenate (or Join) both table to get only 1 final table having only 1 start date and 1 stop date by Drug

best regards

Chris

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert

Many Thanks for the Answer, really appreciated