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

How to display 30 Minutes time range in Straight table?

How to display 30 Minutes time range in Straight table?

I have three Columns in this below table. One Column having DATE with TIME, and another columns are Pieces and Shipment Number.

  

Date&TimePieceShipmentNumber
05-03-2018 9:10:00501625059683P
05-03-2018 12:30:001201625071970P
06-03-2018 7:25:002401625077802P
05-03-2018 6:08:004401625094193P
07-03-2018 3:15:00302042855341P
07-03-2018 2:09:003502042855352P
07-03-2018 10:18:005502069121780P
06-03-2018 4:28:007602069121916P
06-03-2018 5:30:003202069130504P
05-03-2018 0:00:006502069130526P

So, when I select on particular DATE calender (Eg: 05-03-2018) in filter, the data should display in straight table below like this with 30 minutes time range.

OUTPUT:

Time               Pieces

01:00  01:30     15

01:31  01:59     15

02:00  02:30       0

02:31   02:59     08

03:00   03:30      0

03:31   03:59      0

04:00   04:30    33

04:31   04:59    89

8 Replies
tresesco
MVP
MVP

Are you looking for something like:

Capture.JPG

If this output looks good for your sample data, you could try using class()

ogautier62
Specialist II
Specialist II

Hi,

it should be this :

as dimension :

day,

floor((hour([Date&Time])*60 + Minute([Date&Time])) / 30)      (you can hide)

as expression

bucket beginning :

if(mod(floor(min(floor((hour([Date&Time])*60 + Minute([Date&Time])) / 30))/2),2)=0,

     floor(min(floor(hour([Date&Time])*60 + Minute([Date&Time]) ) / 30) /2)  & ':00',

     floor(min(floor(hour([Date&Time])*60 + Minute([Date&Time]) ) / 30) /2) & ':31'

    )

bucket and :

if(mod(floor(min(floor((hour([Date&Time])*60 + Minute([Date&Time])) / 30))/2),2)=1,

     floor(min(floor(hour([Date&Time])*60 + Minute([Date&Time]) ) / 30) /2)  & ':59',

     floor(min(floor(hour([Date&Time])*60 + Minute([Date&Time]) ) / 30) /2) & ':30'

    )

regards

whitestonek
Contributor II
Contributor II
Author

Thank you Tresesco,

Can you please send that script.

whitestonek
Contributor II
Contributor II
Author

Thank you Tresesco,

Can you please send that script.

tresesco
MVP
MVP

Here its is:

Load *,

      Dual(Time(SubField(ClassTime, '<= x <',1),'hh:mm')& ' - '&Time(SubField(ClassTime, '<= x <',2),'hh:mm'),Frac("Date&Time")) as ClassTime2;


Load *,

    Class("Date&Time",1/24/2) as ClassTime

ogautier62
Specialist II
Specialist II

very nice and elegant

whitestonek
Contributor II
Contributor II
Author

Hi Tresesco, I seen your script.But here i am confusing one thing is those 2 scripts i need to apply in script editor or in expressions or what?I want to display data in straight table.I want to see output like below by using calender object as a filer.

OUTPUT:

Time               Pieces

01:00  01:30     15

01:31  01:59     15

02:00  02:30       0

02:31   02:59     08

03:00   03:30      0

03:31   03:59      0

04:00   04:30    33

04:31   04:59    89

tresesco
MVP
MVP

PFA