6 Replies Latest reply: Jun 24, 2013 6:17 PM by mark casselman RSS

    Set Analysis: Date Comparison Two Fields

      HI All,


      I have been searching on the community and have found similar examples but nothing that will quite do what I require.


      I am stuck with a set analysis (or If statement) expression using dates from two feilds. What I Require is:

      -         - To flag all the ‘hospital numbers’ that have a ‘Event One Date’ within 7 days of the ‘Event Two date’. This could be seven days before or seven days after.

      -         - There is also the added complication that there could be multiple ‘Event One’ or ‘Event Two’ for each hospital number. Where this is the case  we would want it to compare any ‘Event One Date +/- 7 days’ to any ‘Event Two Date’.


      Where have I got to?

      - Currently not very far!!! In the attached example I have just been trying to flag Hospital Numbers where Event one/two dates are equal. I was going to build on the expression from there however I am even having trouble doing this.

      - What I am thinking is that for each hospital number we would first need to create a set of all the possible ‘Event One Dates’ we then need  to look for the intersection with the ‘Event Two Dates’.


      Please see attached an Example file to play aorund with.


      Any help would be appreciated and I am really looking forward to increasing my understanding of how this would work.