2 Replies Latest reply on Feb 22, 2017 8:02 AM by Aidan Holmes

    SQL Query Help - Packages delivered/undelivered - how to identify

    Aidan Holmes

      I'm attempting to setup a filter within Tableau and believe a SQL statement might be the best way to accomplish this task. I'd like to to identify various data that's for the sake of this question deliveries that are both delivered and undelivered. Lets say there's two packages with the same Order Number, they go out on two Trucks (which they shouldn't but we're people and mistakes happen) one gets marked in our system as "Delivered" one for whatever reason get's marked "undelivered", "rescheduled", "left with neighbor" etc. However our system tracks the order and identifies it as delivered which is only half true. Ideally it'd do a better job at that but it doesn't and this is where Tableau can assist. What I'm attempting to do is create a statement that will do the following within Tableau:

       

      If the same Order Number exists more than once and that condition is true then check if order status is "Delivered" for all trucks if showing anything other than "Delivered" flag or identify it.

       

      My data looks like this (more or less):

       

      Order Number          Truck             Status      

      0149                         2                    Delivered

      0149                         4                    Delayed

      0150                         7                    In Transit

      0151                         7                    Delivered

      0162                         2                    In Transit

       

      I'm trying to find how many instances we have packages both delivered and undelivered etc at the same time.

       

      Thanks for your assistance.