Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
megasupermoon
Contributor III
Contributor III

How to show IDs which are in ready status within certain time range

Hello, 

I'm making pivot table which shows those patients who have been in ready status between selected time range. '

My pivot table nowMy pivot table now

I have columns OWNER_ID, START_TIME & END_TIME. START_TIME & END_TIME are in hours, for example, 6.  OWNER_ID column contains those patients who have "ready status" SQL in Data Load Editor already gives only those rows which have "ready status".

For now my time selection is made with filter pane and you can select "0-2 o'clock", 3-5 o'clock", "6-8 o'clock" et cetera.

Time range selectionTime range selection

When I select a time range, for example 6-8 o'clock, pivot table shows those patients whose start time is 6, 7 or 8, but it should show those who have been in ready status between 6 and 8 o'clock. 

How to solve this? Thanks in advance.

More defined questions are welcome if needed.  Here are my Load codes just in case:

Load code: Time rangeLoad code: Time range

Labels (3)
1 Solution

Accepted Solutions
MarcoWedel

maybe one solution could be:

MarcoWedel_0-1668551748559.png

 

MarcoWedel_1-1668551778591.png

 

MarcoWedel_2-1668551834056.png

 

tabPatientTimes:
LOAD * Inline [
    OWNER_ID, START_TIME, END_TIME
    1, 1, 5
    2, 4, 5
    3, 5, 8
    4, 9, 18
    5, 7, 21
    6, 22, 23
    7, 16, 22
    8, 13, 20
    9, 11, 17
    10, 8, 23
];

tabLink:
LOAD OWNER_ID,
     START_TIME+IterNo()-1 as TIME
Resident tabPatientTimes
While START_TIME+IterNo()-1 <= END_TIME;

tabTimes:
LOAD Start+IterNo()-1 as TIME,
     Dual(Start&'-'&End&' o''clock', Start) as EHOUR
Inline [
    Start, End
    0, 2
    3, 5
    6, 8
    9, 11
    12, 14
    15, 17
    18, 20
    21, 23
]
While Start+IterNo()-1 <= End;

 

 

 

View solution in original post

1 Reply
MarcoWedel

maybe one solution could be:

MarcoWedel_0-1668551748559.png

 

MarcoWedel_1-1668551778591.png

 

MarcoWedel_2-1668551834056.png

 

tabPatientTimes:
LOAD * Inline [
    OWNER_ID, START_TIME, END_TIME
    1, 1, 5
    2, 4, 5
    3, 5, 8
    4, 9, 18
    5, 7, 21
    6, 22, 23
    7, 16, 22
    8, 13, 20
    9, 11, 17
    10, 8, 23
];

tabLink:
LOAD OWNER_ID,
     START_TIME+IterNo()-1 as TIME
Resident tabPatientTimes
While START_TIME+IterNo()-1 <= END_TIME;

tabTimes:
LOAD Start+IterNo()-1 as TIME,
     Dual(Start&'-'&End&' o''clock', Start) as EHOUR
Inline [
    Start, End
    0, 2
    3, 5
    6, 8
    9, 11
    12, 14
    15, 17
    18, 20
    21, 23
]
While Start+IterNo()-1 <= End;