Reputation: 35
I want to find consecutive missed visit by the site. First I created a flag if visit completion = missed then 1 else 0 Next, I created the following calculation to count the consecutive
Now my questions are following, 1) If I am counting consecutive missed visits, then shouldn’t I ignore the first index/occurrence? i.e., in this case, the count should show 8? How to do that? 2) How to aggregate it up to site level?
Looking forward to your help. Thank you in advance.
Upvotes: 1
Views: 166
Reputation: 1735
For part 1 of your question, to set the first occurence as 0, you can tweak your existing calculation: (picking up from the middle of your formula...)
...THEN IF FIRST()=0 THEN 0 ELSE PREVIOUS_VALUE(0)+1 END...
Part 2, to aggregate to site level, is more tricky. You'll need the VisitNo on Detail as it's needed for the calculation. You may need to wrap the entire calculation in:
IF LAST()=0 THEN [FormulaCalcField] END
Hence only keeping the final result of the calc. These things are complicated...
Upvotes: 2