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

Dynamic time intervals

Greetings.

I am trying to create intervals to cover the entire day (00:00 - 23:59) based on the input table. My input table is as follows: 

CategoryTimeValue
A10:1515
A16:2925
A18:0030
B12:0029

 

Required output table

CategoryTime StartTime EndAvg Value Calculation
A00:0009:59AVG(15,25,30)
A10:0010:29AVG(15)
A10:3015:59AVG(15,25,30)
A16:0016:29AVG(25)
A16:3017:59AVG(15,25,30)
A18:0018:29AVG(30)
A18:3023:59AVG(15,25,30)
B00:0011:59AVG(29)
B12:0012:29AVG(29)
B12:3023:59AVG(29)

 

Appreciate any assistance.

Labels (1)
5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Is not clear how you get from your data to the required output.  For example the first three rows look inconsistent with interval mapping the input. And how are the intervals determined?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sbfernandes
Contributor III
Contributor III
Author

Hi Jontydkpi

Category A has values at 3 times 10:15, 16:29, 18:00.

I would like to create time bands for Category A to cover the entire day up to half hour interval.

For Time 10:15,

time band is 1000 - 1029.,

The previous time band will be 0000 - 0959

Next time band will be 1030 - 1559.

For time 16:29, time band is 1600 - 1629.

next time band is 1630 - 1759.

For 18:00, time band is 1800 - 1829.

As last value is 1800, the next time band will go upto end of day i.e. 1830 - 2359.

 

Hope this makes sense

jonathandienst
Partner - Champion III
Partner - Champion III

So you mean create a time band of 30 minutes for each time in your source?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Now please explain the average calc for A.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sbfernandes
Contributor III
Contributor III
Author

Yes.

For Time that exists, the time band will be 30 mins. I also need time bands that will cover the entire 24 hours. So for Category A, the immediate time bands will be 1000 - 1029 (10:15), 1600 - 1629 (16:29) and 1800 - 1829 (18:00). In addition, I need to create time bands 0000 - 0959, 1030 - 1559, 1630 - 1759 and 1830 - 2359. All these 7 time bands cover the entire day.

The average calculation is not an issue. When the Time is present then the average will be value in that time band. Eg: for 1000 - 1029, it will be based on value 15. For time bands that do not exist, it will be based on Average of the Category (in this case A) i.e. AVG(15,25,30).

Primarily i cant figure out how to get the time bands to cover 24 hours.