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

Create buckets based on Outstanding, Completed and Hold

Hello all:

I need help creating a graph that show T-shirt size items that are Outstanding vs.. completed vs. Hold in buckets in Months

Instead of showing Jan, Feb, Mar.....

It needs to show <1 , 1-3, 4-6, 7-9, 10-12

Month.jpg

The T-Shirt Size field contains (XS, S, M, L, XL, TBD

The Status field contains (Active, Closed, Completed, On Hold and Requested

This is how far I've gotten

AgeBucket:
LOAD *,
Interval(Now()-[Rqstd. Compl.]-30, 'MM') As DateOutstanding;
 
LOAD
Date(Floor(Today()-Rand()*140)) As DateCompleted, 1 As exp AutoGenerate 10000;

Below is the list of available fields

Month3.jpg

See attached file.

6 Replies
Frank_Hartmann
Master II
Master II

Can you upload a small sample with reduced and obfuscated data?

Without knowing your script and expressions it will be hard to assist

Not applicable
Author

Hi Frank,

Here is a sample set of the data.  Thank you for help.

   

Request#Demand TypeStatusDate RqstdRqstd. Compl.Bus. or Dept.DomainT-Shirt SzEst. Compl. DateActual Compl. DateYr Compl. a/o ClosedCreated
1755MaintenanceRequested7/21/20169/30/2016ABC12SalesTBD7/21/2016 17:38

   

5/18/2016
1754OperationalRequested7/21/20168/1/16 if possibleCTE12MarketingTBD7/21/2016 17:32
1753OperationalRequested7/20/20168/1/2016FJR34OperationsTBD7/21/2016 8:20
1752OperationalRequested7/19/20168/31/2016CKE59MaintenanceTBD7/19/2016 14:29
1751OperationalRequested7/15/2016asapLSL09FinanceTBD7/18/2016 13:58
1750OperationalRequested7/7/2016ASAPCMK94Human ResourcesTBD7/8/2016 8:30
1749ComplianceRequested7/5/20161/1/2017ACI00Supply ChainTBD7/6/2016 9:49
1748OperationalRequested7/1/20169/1/16TTY90Lab & QualityTBD7/6/2016 8:10
1747OperationalRequested6/30/20169/15/2016WQI49MaintenanceTBD6/30/2016 16:19
1746OperationalRequested6/30/201610/30/2016SPC48Supply ChainTBD6/30/2016 16:12
njmaehler
Partner - Creator
Partner - Creator

Would CLASS not work?

class(expression, interval [ , label [ , offset ]])

Creates a classification of expressions. The bin width is determined by the number set as interval. The result is shown as a<=x<b, where a and b are the upper and lower limits of the bin. The x can be replaced by an arbitrary string stated in label. 0 is normally the default starting point of the classification. This can be changed by adding an offset.

Examples:

class( var,10 ) with var = 23 returns '20<=x<30'

class( var,5,'value' ) with var = 23 returns '20<= value <25'

class( var,10,'x',5 ) with var = 23 returns '15<=x<25'

Anonymous
Not applicable
Author

Try this code Patricio:

AgeCompleted:

LOAD *,

    IF(DateOutstanding<1,'<1',

        IF(DateOutstanding<4,'1-3',

            IF(DateOutstanding<7,'4-6',

                IF(DateOutstanding<10,'7-9',

                    IF(DateOutstanding<13,'10-12','>12'))))) as TimeElapsedGroup;

LOAD

    Distinct

    [Actual Compl. Date],

    [Rqstd. Compl.],

    [Date Rqstd],

    If(Interval(IF(IsNull([Actual Compl. Date]),Now(),[Actual Compl. Date])-[Date Rqstd]-30, 'MM')<0,0,

        Interval(IF(IsNull([Actual Compl. Date]),Now(),[Actual Compl. Date])-[Date Rqstd]-30, 'MM')) As DateOutstanding

RESIDENT ITServiceRequest;

I don't know how you will calculate your elapsed time, because [Rqstd. Compl.] field is not a date.

Regards!!!

Not applicable
Author

Hi Manuel,

When I inserted the code you suggested below:

LEFT Join (ITServiceRequest)
LOAD DISTINCT [Rqstd. Compl.],
Date([Rqstd. Compl.]) as [Req Compl Date]
RESIDENT ITServiceRequest;

AgeCompleted: 
LOAD *, 
IF(DateOutstanding<1,'<1', 
IF(DateOutstanding<4,'1-3', 
IF(DateOutstanding<7,'4-6', 
IF(DateOutstanding<10,'7-9', 
IF(DateOutstanding<13,'10-12','>12'))))) as TimeElapsedGroup;
 
//
//AgeBucket:
//LOAD *,
//Interval(Now()-[Rqstd. Compl.]-30, 'MM') As DateOutstanding;

//LOAD
//Date(Floor(Today()-Rand()*140)) As DateCompleted, 1 As exp AutoGenerate 10000;

LOAD 
Distinct 
[Actual Compl. Date] as ActComplDate
[Rqstd. Compl.] as [Requested Completed]
[Date Rqstd] as [Date Requested]
If(Interval(IF(IsNull(ActComplDate),Now(),(ActComplDate)-[Date Requested]-30, 'MM')<0,0, 
Interval(IF(IsNull(ActComplDate),Now(),(ActComplDate)-[Date Requested]-30, 'MM')) As DateOutstanding 
RESIDENT ITServiceRequest; 

I get the below error

Error in expression: If takes 2-3 parameters

LOAD 
   Distinct 
   [Actual Compl. Date] as ActComplDate, 
   [Rqstd. Compl.] as [Requested Completed], 
   [Date Rqstd] as [Date Requested], 
   If(Interval(IF(IsNull(ActComplDate),Now(),(ActComplDate)-[Date Requested]-30, 'MM')<0,0, 
        Interval(IF(IsNull(ActComplDate),Now(),(ActComplDate)-[Date Requested]-30, 'MM')) As DateOutstanding 
RESIDENT ITServiceRequest

Anonymous
Not applicable
Author

Hi Patricio,

Try This:

If(Interval(IF(IsNull(ActComplDate),Now(),ActComplDate)-[Date Requested]-30, 'MM')<0,0,

Interval(IF(IsNull(ActComplDate),Now(),ActComplDate)-[Date Requested]-30, 'MM')) As DateOutstanding 

You have written more than allowed parentheses.

Regards!