Ed Pollack continues a series on gap and island analysis:
Gaps and islands analysis supplies a mechanism to group data organically in ways that a standard
GROUP
BY
cannot provide. Once we know how to perform an analysis and group data into islands, we can extend this into the realm of real data.For all code examples in this article, we will use a set of baseball data that I’ve created and maintained over the years. This data is ideal for analytics as it is large and contains data quality that varies between very accurate and very sloppy. As a result, we are forced to consider data quality in our work, as well as scrutinize boundary conditions for correctness. This data will be used without much introduction as we will only reference two tables, and each is relatively straightforward.
The code in this article gets a bit complex, but Ed shows off some powerful techniques.