The BIN function is specifically designed to classify a numeric expression into a defined number of equal-width buckets. Oracle documents syntax in which a numeric expression is evaluated at a specified grain using the BY clause, followed by INTO n BINS. The function can return the bin number or one of the interval boundary values , making it appropriate when the analysis needs both dynamic bucketing and a usable representation of each bucket.
In this scenario, Revenue is the numeric measure, while item type and Per-Year-Month establish the required analytical grain. Specifying four bins therefore partitions Revenue values into four dynamically calculated ranges at that grain.
MSUM calculates a moving sum across rows; it doesn't classify values into buckets. PERIODROLLING performs time-series aggregation over a specified period. RANK returns relative ordering, while TOPN identifies the highest-ranked members. None of these functions creates equal-width numeric bins.
Therefore, BIN applied to Revenue at the required grain and configured for four bins directly satisfies the requirement. Oracle's function reference explicitly defines BIN for this purpose.
Reference Topic: Formatting Data and Managing Filters, Selection Steps, and Variables — Analysis Functions and BIN
===============
Submit