Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Count occurrences in a time interval

Hi everyone, Have been struggeling with this for a while so I have to ask if someone can help me. Been going through many forum threads but I can't get anything to work.   I need to count the occu...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Try this and let me know if it works:

    Count = 
    VAR TwoWeeksafter = [Date] + 14
    VAR TwoWeeksbefore = [Date] - 14
    VAR PHtoCheck = [PhoneNumber]
    RETURN
    CALCULATE (
    	COUNTROWS (Table);
    	ALL (Table);
    	Table[PhoneNumber] = PHtoCheck;
    	Table[Date] <= TwoWeeksFromDate;
    	Table[Date] >= TwoWeeksbefore;	
    )