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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date buckets ....

Hi All,

I have PO_Date which is in format of  7/18/2013  12:04:59 PM.  Based on today date i need to create buckets for the dates that have passed 

'PAST_0to30' , 'PAST_>30 and <=60' and "PAST_>60"  .

Please find attached spreadsheet

Thanks

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Let vToday = num(Today());

Table1:

LOAD po_line_item_id,

     po_id,

     qty,

     PO_Date,

     if($(vToday)-PO_Date<=30,

        'PAST_0to30',

        if($(vToday)-PO_Date<=60,

           'PAST_>30 and <=60',

           'PAST_>60')

     ) as Bucket

FROM

Buckets.xls

(biff, embedded labels, table is [Sheet1$]);

See attached example.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Let vToday = num(Today());

Table1:

LOAD po_line_item_id,

     po_id,

     qty,

     PO_Date,

     if($(vToday)-PO_Date<=30,

        'PAST_0to30',

        if($(vToday)-PO_Date<=60,

           'PAST_>30 and <=60',

           'PAST_>60')

     ) as Bucket

FROM

Buckets.xls

(biff, embedded labels, table is [Sheet1$]);

See attached example.


talk is cheap, supply exceeds demand
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this

Test:

LOAD

*,

          If(DaysDiff > 0 AND DaysDiff < 30, Dual('0-30', 1),

                    If(DaysDiff >= 30 AND DaysDiff < 60, Dual('30-60', 2),

                    If(DaysDiff >= 60, Dual('>=60', 3), 'N/A'))) AS Buckets;

LOAD po_line_item_id,

     po_id,

     qty,

     Date(PO_Date) AS PO_Date,

     Ceil(Num(Today()) - Num(PO_Date)) AS DaysDiff

FROM

C:\Users\hi\Desktop\Buckets.xls

(biff, embedded labels, table is [Sheet1$]);

Hope this helps you.

Regards,

Jagan.