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

Calculating shifts

Hi, i am trying to calculate how many people are working at a particular time when they have different start and finish times.

For example

08:00  30 people start and finish at 16:00

10:00 20 people start and finish at 18:00

i want to know how many people are available each hour

2 Replies
Vegar
MVP
MVP

I suggest you to look into IntervalMatch(), it can help you to achieve what you are trying to do.

 

Vegar
MVP
MVP

You could look at this sample script. 

 

Schema:
Load
  Name,
  Time(Start) as Start,
  Time(Stop) as Stop
Inline [
  Name, Start, Stop
  Alfa, 08:00, 16:00
  Bravo, 08:00, 16:00
  Charlie,08:00, 16:00
  Delta,08:00, 16:00
  Echo, 08:00, 16:00
  Foxtrot,08:00, 16:00
  Golf,08:00, 16:00
  Hotel,08:00, 16:00
  India,08:00, 16:00
  Juliett,10:00,18:00
  Kilo,10:00,18:00
  Lima,10:00,18:00
  Mike,10:00,18:00
  November,10:00,18:00
  Oscar,10:00,18:00
  Papa,10:00,18:00
  Quebec,10:00,18:00
  Romeo,10:00,18:00
  Sierra,10:00,18:00
  Tango,10:00,18:00
  Uniform,10:00,18:00
  Victor,10:00,18:00
  Whiskey,10:00,18:00
  X-ray,10:00,18:00
  Yankee,10:00,18:00
  Zulu,10:00,18:00
];


LOAD maketime(RowNo()-1) as Hour
AutoGenerate 24;

Intervalmatch:
IntervalMatch(Hour) LOAD Start, Stop Resident Schema;