Hi Jesse,
No problem. So we’re looking at minutes. Specifically how many minutes our staff have spent with each patient working on 3 different task types. I have 3 pivot tables for each of the 3 task types with patients as rows. The first column is “Duration_Minutes” which comes from our dataset. Within the pivot, this column shows for each patient the sum of their total minutes associated with that task type. Then I would like a second column that uses my ifelse statement above to say if Duration_Minutes >= 20, then give a 1, else give a 0.
You are right, I didn’t think I would need to use a sum within the ifelse either, but when I execute that formula without the sum I can see that many patients who have over 20 in Duration_Minutes are not given a 1. I think this is because it’s looking at rows in our dataset to see if the patient has at least 1 record where Duration_Minutes is >= to 20, not looking at the summed value under Duration_Minutes in the pivot.
To your last question, yes ultimately I’d like to count up the 1’s resulting from that ifelse to say how many patients have at least 20 minutes for the 3 task types.