So, I'm trying to build a segment that, in part, excludes certain date ranges. It's not really working out and, after troubleshooting a bit, I think the problem is simply that we can't build a segment that excludes a date range. This is really problematic since a common use case for segments is to filter out problematic data; sometimes, this can be date-bound.
I've created a very simple scenario to illustrate:
Pull up Key Metrics report with no segments applied to view Page Views, Visits, and Unique Visitors.
Create a segment called "Yesterday Segment", which is based on hits occurring "Yesterday" (i.e., the out-of-the-box "Yesterday" date range). Only data for yesterday is present in the report (yay!).
Create a segment called "EXCLUDE: Yesterday", which simply excludes the "Yesterday Segment". Or, you can base it on the "Yesterday" date range. I expected that data for all other days except yesterday would be present, but it seems to have eliminated all data. I've also tried wrapping the exclusion inside a container, in case that might do the trick, but no luck.
Anyone have any clever ideas? I've been fighting this all morning - in a much more complex segment and spent most of the morning figuring I have problems with contains, includes/excludes, ands/ors in other parts of the segment. It turns out it was just the time-based portion of the rule that isn't working....
I think I figured out what's going on. In order to exclude a date range, you must explicitly include a date range. Not sure if that's a bug or a feature....
In my example above, amending the segment to include something like "This Year" and excluding "Yesterday" does the trick. In my practical application, it means I have to create a date range that spans "all time", which I can use whenever I want to exclude specific date ranges.
Thanks for the update! I'll bring this up with the team to see if this functionality is working as designed. As a workaround, you could use a rolling daily custom date range that encompasses all data, at least as far back as your data retention policy allows. For most people that's going to be either 25 or 37 months (this number varies from organization to organization, and could be longer).