The RATIO_TO_REPORT function is extremely useful. This function
can be used to return a ratio of a value for a current row as compared to an
aggregation of values. The aggregation can be for the entire report or a sub-
section of a report based on a PARTITION BY clause. Obviously, rankings
can also be utilized to check for rankings of ratio to report calculations. A
simple example using the RATIO_TO_REPORT function is shown in Fig-
ure 9.20.
9.5.2Lead and Lag Functionality
The LAG and LEAD functions allow for comparisons between rows in que-
ries. The LAG functions lags behind, and the LEAD function leads ahead. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.