Oracle Analytic Function RATIO_TO_REPORT |
This is an example of Oracle analytic function
RATIO_TO_REPORT to analyze monthly sales as a
percentage (ratio) of annual sales. The monthly
to annual sales ratio is computed as Jan/(Sum of
12 months), Feb/(Sum of 12 months) etc. For
January it is 11000/183500 = 0.0599, February it
is 12000/183500 = 0.0654 etc. as shown in the
query output
.
The next example shows analysis of quarterly sales as a percentage of annual sales ( quarter/annual ratio ). Based on type of analysis being performed, the PARTITION BY clause can be used to group the data ( mixed year data ). If it is blank or null, the function is computed for the complete result set of the query. Note: The NTILE(4) splits the year into four quarters evenly since there are twelve months. If partial year data is available (current year analysis with less than 12 months), then use the syntax shown in the quarter query to get exact quarter for the month/year combination. |
73950