Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

sumitjadhav
Contributor II

how to create a bucket only for a date field?

how to create a bucket only for a date field?

1 Solution

Accepted Solutions
sumitjadhav
Contributor II

Re: how to create a bucket only for a date field?

table:

LOAD ID,

     date,

     Sales,

     Month(date) as mon,

     Day(date) as day,

     Year(date) as year

FROM

(ooxml, embedded labels, table is Sheet1);

new:

LOAD *,

if(Match(day,1,2,3,4,5,6,7) , 'bucket1',

if(Match(day,8,9,10,11,12,13,14), 'bucket2',

if(Match(day,15,16,17,18,19,20,21), 'bucket3',

if(Match(day,22,23,24,25,26,27,28), 'bucket4',

if(Match(day,29,30,31), 'bucket5'))))) as bucket

Resident table;

DROP Table table;

3 Replies
sumitjadhav
Contributor II

Re: how to create a bucket only for a date field?

date  Bucket  

1-7     1

8-14    2

15-21  3

22-28  4

29-date  5

sumitjadhav
Contributor II

Re: how to create a bucket only for a date field?

table:

LOAD ID,

     date,

     Sales,

     Month(date) as mon,

     Day(date) as day,

     Year(date) as year

FROM

(ooxml, embedded labels, table is Sheet1);

new:

LOAD *,

if(Match(day,1,2,3,4,5,6,7) , 'bucket1',

if(Match(day,8,9,10,11,12,13,14), 'bucket2',

if(Match(day,15,16,17,18,19,20,21), 'bucket3',

if(Match(day,22,23,24,25,26,27,28), 'bucket4',

if(Match(day,29,30,31), 'bucket5'))))) as bucket

Resident table;

DROP Table table;

jaaldurgam
Valued Contributor

Re: how to create a bucket only for a date field?

So Sumit,

You got answer yourself

Good one!

Sreeni

Community Browser