Hey I'm trying to build a counter which counts based on actions.
So I have two tables
Table 1
name...Hire_Date...Effective_date...action
John...1/1/2015...1/1/2015..action1
John...1/1/2015...1/7/2015..action2
John...1/1/2015...1/6/2015..action3
John...1/1/2015...1/14/2015..action4
Table 2
Date Beg...Date End
1/1/2015...1/7/2015
1/8/2015...1/14/2015
Essentially I need to count all periods from table 2 where the hire date belongs in, but if action 2 occurs within the range then don't count that range. I had an initial sum(iif to get the total where hire date fits in but I'm having trouble in setting up a counter of sorts which knows to exclude the range if the effective date of action 2 occurs within that range.
The example here means that the total count for John should be 1 since action 2 on 1/7/2015 zeroes out the count by being in the range, but action 4 being outside of it still counting.