9 Replies Latest reply: Jan 25, 2012 11:18 AM by Chris Theobald RSS

    Help to categorise names as either "included" or "Excluded" based on varied criteria

      Hi,
      Firstly please let me apologise if this is the wrong place to ask, but we are really stuck here, and its a solution we need relativley quickly.
      Also, secondly let me apologise if the subject line was a little confusing, i know what im trying to do, but summing it up didnt seem so easy!
      Anyway!
      We are trying to get a list of hospital wards to fall into either "Included" or "Excluded" brackets, based on criteria, however, the criteria can be different depending on the ward. For example.
      if its Ward1 or Ward2 they are excluded, but if its Ward 3 with patients admitted after 9am they are excluded. I have figured a nested IF would be the easiest way of doing this, and (to be honest) im hoping this is wrong rather than our data.
      I have written a bit of code in the back of qlikview which calls a function that returns time as a var char (For example 09:00)
      once this is in qlikview it is changed to 09:00:00 so i presume this has been converted to a time?
      I use the code below in a lsit box to try and get the 2 options;
      =If(Ward=1
      OR Ward=2
      OR Ward=3,'Exclude',
      IF(Ward='4' AND Start_Time >='09:00:00','Exclude','Include'))
      However, Ward 4 shows up in both categories
      I cant for the life of me work out whats going wrong any help would be great!
      thank you.