Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
didierodayo
Partner - Creator III
Partner - Creator III

Date bucket from date fields

Hello,

I have the date list in the attached file below, I am trying to create a bucket list from the date field as follow.

'< 3Months'

'3 - 6Months'

'6 - 12 months'

'12 -24 Months'

'24 - 36 Months'

any suggestion is welcomed.

Thanks

1 Solution

Accepted Solutions
rubenmarin

Hi Didier, as an idea you can use IntervalMatch:

Dates:

LOAD @1, RowNo() as NumDate

FROM

[.\date list.xls]

(biff, no labels, table is Sheet1$);

Ranges:

LOAD * Inline [

Min ,Max ,Text

1 ,2 ,'< 3Months'

3 ,6 ,'3 - 6Months'

7 ,12 ,'7 - 12 months'

13 ,24 ,'13 -24 Months'

25 ,36 ,'25 - 36 Months'

];

Inner Join IntervalMatch (NumDate)

LOAD Min, Max

Resident Ranges;

I don't know the real scenario, but another idea can be loading the min and/or max dates and extract the difference in months when loading.

View solution in original post

2 Replies
rubenmarin

Hi Didier, as an idea you can use IntervalMatch:

Dates:

LOAD @1, RowNo() as NumDate

FROM

[.\date list.xls]

(biff, no labels, table is Sheet1$);

Ranges:

LOAD * Inline [

Min ,Max ,Text

1 ,2 ,'< 3Months'

3 ,6 ,'3 - 6Months'

7 ,12 ,'7 - 12 months'

13 ,24 ,'13 -24 Months'

25 ,36 ,'25 - 36 Months'

];

Inner Join IntervalMatch (NumDate)

LOAD Min, Max

Resident Ranges;

I don't know the real scenario, but another idea can be loading the min and/or max dates and extract the difference in months when loading.

didierodayo
Partner - Creator III
Partner - Creator III
Author

Thanks Ruben.