Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Contributor

Divide Time into time slots/ time range?

Hi,

i have the following table and i need a timeslot column.

Table:

Trans
  Number
Time
19:00
29:15
98:17
1110:22
1812:00
209:01
310:01
48:09

output Required:

Trans
  Number
TimeTime Slot
19:009:00-9:30
29:159:00-9:30
98:178:00-8:30
1110:2210:00-10:30
1812:0012:00-12:30
209:019:00-9:30
310:3110:30-11:00
48:598:30-9:00

Kindly suggest.

7 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Divide Time into time slots/ time range?

Something like this:


Let vEpsilon  = Pow(2,-27);

LOAD

     [Trans Number],

     Time,

     Time(floor(Time + $(vEpsilon),1/48),'h:mm') & '-' & Time(ceil(Time + $(vEpsilon),1/48),'h:mm') as [Time Slot]

FROM ...


talk is cheap, supply exceeds demand
Highlighted

Re: Divide Time into time slots/ time range?

Hi,

assuming that the two last rows in your output tables include typos one solution could be:

QlikCommunity_Thread_169010_Pic1.JPG

QlikCommunity_Thread_169010_Pic2.JPG

tabTransactTimes:

LOAD @1 as [Trans Number],

    @2 as Time,

    Dual(Time(SubField(Class(@2,'00:30'),'<=',1),'hh:mm')&'-'&Time(SubField(Class(@2,'00:30'),'x <',2),'hh:mm'),Class(@2,'00:30')) as [Time Slot]

FROM [https://community.qlik.com/thread/169010] (html, codepage is 1252, no labels, table is @1, filters(Remove(Row, Pos(Top, 1))));

hope this helps

regards

Marco

Highlighted

Re: Divide Time into time slots/ time range?

Please close your thread if your question is answered.

Thanks

Regards

Marco

Highlighted
New Contributor III

Re: Divide Time into time slots/ time range?

Hi MArco,

I tried similar code for the 2hrs interval for timeslot it dint seem to work.And the input field is DateTime.

Can you help me how to acheive the same.Attached is the change in interval

Highlighted
New Contributor III

Re: Divide Time into time slots/ time range?

Hi MArco

 

Attach is the qvw which i tried with my file and the expectation image

 

Thanks

Thiru

Highlighted
New Contributor III

Re: Divide Time into time slots/ time range?

source file attached here

Highlighted
New Contributor III

Re: Divide Time into time slots/ time range?

qvw mised to attached in the previous thread