Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Days Range bucket as listbox

Hi,

I want to create a days range bucket starting from 0 always like 0-30, 0-60, 0-90...based on days diff.

Ex:

Name         Days diff

Harsha          15             (should be in all ranges like 0-30,0-60,0-90.....)

kosuri            55          (should be in both 0-60,0-90.....)

Thanks,

Harsha

10 Replies
Not applicable
Author

Hi harsh,

   Please find the attached file for your refernce.

VishalWaghole
Specialist II
Specialist II

Hi Harsha,

PFA

Hope its useful for you.

Thanks and Regards,

Vishal.

Not applicable
Author

@Sampath

I need the age grouping as 0-30 & 0-60.

Not applicable
Author

@Vishal

You used the pivot table, but I need the values like 0-15, 0-30... as listbox values.

Not applicable
Author

Workaorund:

I have created text box for values 0-30, 0-60, 0-90..... and on the actions i have set condition age(days diff) <=highest value in range.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can create the bucket field in the script or in the Listbox as an Expression. Two ways I can think of:

=class(Daysdiff, 30)

That gives you the class formatting which you may not like.

0 <= x < 30

30 <= x < 60

Or to get the exact formatting you asked for, use an expression:

=if(len(Daysdiff)>0,

div(Daysdiff,30)*30 & '-' & (div(Daysdiff,30)+1)*30

)

That gives:

0-30

30-60

The if() only seems to be required in the Listbox expression (not the script) to prevent a single row with "-" appearing.

-Rob

http://robwunderlich.com

Not applicable
Author

Hi Rob,

I need buckets 0-30,0-60,0-90 rather than 0-30,30-60,60-90..

Thanks,

Harsha

Not applicable
Author

Hi Harsha

You can create a table with values like below (this can be done using "load inline");

TableX:

bucket       lowerlimit   upperlimit

0-30           0               30

0-60           0               60

0-90           0               90

then use IntervalMatch as

IntervalMatch (days diff) LOAD lowerlimit, upperlimmit Resident <TableX>;

this should give you desired result

Regards

Vikas

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The intervalMatch solution is a good one.

Or to create the field in UI, with a 0 start, just modify the expression I gave you earlier:

=if(len(Daysdiff)>0,

'0-' & (div(Daysdiff,30)+1)*30

)

-Rob