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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
agni_gold
Specialist III
Specialist III

How to make days bucket in dimension

Hi have a data like

 

NameDays
A6
B7
C8
D12
E16
F25
G26
H28
I16
G35
H

26

I wnat the structure like this

Requirement.jpg

i want this type of dimension in my chart , count of those who like in the range .

4 Replies
sunny_talwar

To create buckets you can use the class function in your dimension:

=Class(Days, 10, '-')

or you can do it in the script also:

Class(Days, 10, '-') as Buckets

agni_gold
Specialist III
Specialist III
Author

How can you please explain in detail

sunny_talwar

Try this script:

Table:

LOAD *,

  Replace(Replace(Class(Days, 10, '-'), '<=', ''), '<', '') as Bucket;

LOAD Name,

    Days

FROM

[https://community.qlik.com/thread/164893]

(html, codepage is 1252, embedded labels, table is @1);


Output:

Capture.PNG


MarcoWedel

Hi,

another solution could be:

LOAD *,

    Dual(Replace(Class(Days,10),'<= x <','-'),Class(Days,10)) as DaysClass

FROM [https://community.qlik.com/thread/164893] (html, codepage is 1252, embedded labels, table is @1);

QlikCommunity_Thread_164893_Pic1.JPG

this way the DaysClass field will be dual, i.e. it will be numericaly sortable.

hope this helps

regards

Marco