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: 
Anonymous
Not applicable

Define field based on date

Please help the to create status field based on date as per below. Attached source data.

imglo.PNG

2 Replies
devarasu07
Master II
Master II

Hi

try to use interval function to find date diff. and then create conditional statement to have year age group bucket.

Method 1:

like this

load *, if( Numberofdays<=31 or Numberofdays<=30 or Numberofdays<=28 or Numberofdays<=29, Dual('New Month',1),

if( Numberofdays >31 and (Numberofdays<=365 or Numberofdays<=366), Dual('1 Year',2),

if( Numberofdays >365 and (Numberofdays<=732 or Numberofdays<=731), Dual('2-3 Year',3),

if( Numberofdays >1460 and (Numberofdays<=1825 ), Dual('4-5 Year',4),Dual('>5 Years',5)

)))) as Bucket;

load *, Today()-[sales date] as Numberofdays;

LOAD [Cust ID],

     [Sales ITM],

     [sales date]

FROM

(ooxml, embedded labels, table is Sheet1);

Buckets

Capture.JPG

Anonymous
Not applicable
Author

Is it possible my month instead of days?