Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to create time interval selector?

Eg.

120 - 240min

240 - 360min

360 - 480min

every interval is 120min block, only 1st block is 15 - 120 min

Tags (3)
5 Replies
MVP
MVP

Re: How to create time interval selector?

Maybe like

LOAD *,

  if( Minutes < 120, Dual('15 - 120 Mins',65),

  Dual(floor(Minutes+1,120) & ' - ' & ceil(Minutes,120) & ' Mins', (Ceil(Minutes+1,120)+floor(Minutes,120))/2 ))

                                                                      as Class;

LOAD ceil(RAND()*1000)+15 as Minutes

AutoGenerate 11000;

MVP
MVP

Re: How to create time interval selector?

load

  Min,

  if(Start=0,

  dual('min 15' & ' - ' & End, 15),

  dual('min ' & Start & ' - ' & End, Start)

  ) as TimeInterval;

load

  IterNo() as Min,

  Div(IterNo(),120)*120 as Start,

  Div(IterNo(),120)*120+120 as End

AutoGenerate 1

While IterNo() <= (24*60)

;

Highlighted
Not applicable

Re: How to create time interval selector?

thanks! it works!

balrajahlawat
Esteemed Contributor

Re: How to create time interval selector?

You can do like this as well at script level:

IF(Minutes>=15 and Minutes<120, Dual('15-120 Min',1),       //Dual() helps you in sorting

IF(Minutes>=120 and Minutes<240, Dual('120-240 Min',2),

IF(Minutes>=240 and Minutes<360, Dual('240-360 Min',3)))) as IntervalFieldName

Hope this will help!!

Re: How to create time interval selector?

see also

Re: How to group mins into time interval

please don't post the How to group mins into time interval multiple times and close your open threadsby selecting correct (and possibly helpful) answers.

thank you

regards

Marco

Community Browser