Functions used in aggregate calculations
This section describes the range of functions that perform aggregate calculations. In Interactive Viewer, you can perform aggregate calculations across the data rows in a group, section, or across an entire report table.
Table 8-1 Aggregate functions Returns the average, or mean for a set of data rows. For example, if a report column contains values 5, 2, 7, and 10, AVERAGE returns 6. Counts the number of data rows. If a column contains values 5, 2, 7, and 10, COUNT returns 4. Counts the number of unique values in a set of data rows. If a report column contains values 5, 2, 5, 7, and 10, COUNTDISTINCT returns 4. Returns the first value in set of data rows. If a report column contains data rows 5, 2, 7, and 10, FIRST returns 5. IS-BOTTOM-N Returns a Boolean value that indicates if a data row is one of the bottom n values. If a report column contains data rows 5, 2, 7, and 10, and you specify 2 as the n value, IS-BOTTOM-N returns true for values 5 and 2, and false for values 7 and 10. IS-BOTTOM-N-PERCENT Returns a Boolean value that indicates if a data row is one of the bottom n values. If a report column contains data rows 5, 2, 7, and 10 and you specify an n value of 25 (percent), IS-BOTTOM-N-PERCENT returns true for 2, and false for 5, 7, and 10. IS-TOP-N Returns a Boolean value that indicates if a data row is one of the top n values. If a report column contains data rows 5, 2, 7, and 10, and you specify an n value of 2, IS-TOP-N returns false for 2 and 5, and true for 7 and 10. IS-TOP-N-PERCENT Returns a Boolean value that indicates if a data row is one of the top n values. If a report column contains data rows 5, 2, 7, and 10, and you specify an n value of 25 (percent), IS-TOP-N-PERCENT returns false for 5, 2 and 7, and true for 10. Returns the last value in a set of data rows. If a report column contains data row values 2, 5, 7, and 10, LAST returns 10. Returns the largest value in a set of data rows. If a report column contains data row values 5, 2, 7, and 10, MAX returns 10. For string values, MAX returns the last alphabetical value. For date values, MAX returns the latest date. Returns the median, or middle value in a set of data rows. If a report column contains values, 5, 2, 7, and 10, MEDIAN returns 6. Returns the smallest value in a set of data rows. If a report column contains data row values 5, 2, 7, and 10, MIN returns 2. For string data, MIN returns the first alphabetical value. For date values, MIN returns the earliest date. Returns the mode, or the value that occurs most frequently in a set of data rows. If a report column contains values, 5, 2, 5, 7, and 10, MODE returns 5. Returns the moving average for a set of data rows across an interval or number of data rows. Typically, you use moving averages to analyze stock price trends. You can, for example, display the moving average of stock prices over three days. If a set of data rows contains values 5, 2, 7, and 10, and you select 3 as the interval, MOVINGAVE returns null, null, 4, 4.66, and 7.33 for each row respectively. Returns the percentile value in a set of data rows, given a specific percent rank. For example, you can calculate the score that represents the 50th percentile of all scores on a test. If a set of data rows contains 50, 75, 80, 90, and 95, and you specify a percent rank of 0.9 (to get the 90th percentile value) PERCENTILE returns 93. PERCENT-RANK Returns the rank of a value in a set of data rows, as a percentage of the set. The return value ranges from 0 to 1. If a set of data rows contains 50, 75, 80, 90, and 95, PERCENT-RANK returns 0, 0.25, 0.5, 0.75, and 1 for each row respectively. PERCENT-SUM Returns the percentage of a total. If a set of data rows contains 50, 75, 80, 90, and 95, the sum of values is 390. PERCENT-SUM returns 0.128 (50/390), 0.192 (75/390), 0.205 (80/390), 0.231 (90/390), and 0.244 (95/390) for each row, respectively. Returns the quartile value in a set of data rows, given a specified quart (0-4). A quartile can be defined as any three values that divide a set of values into four equal parts, such that each part represents 1/4 of the set of values. MIN, MEDIAN, and MAX return the same value as QUARTILE when quart is equal to 0, 2, and 4 respectively. If a set of data rows contains 50, 75, 80, 90, and 95, and you specify a quart of 2, QUARTILE returns 80. Returns the rank of a value in a set of data rows. The rank of a value ranges from 1 to the number of values in the report column. If two values are identical, they have the same rank. If a set of data rows contains 50, 75, 80, 90, and 95, RANK returns 5, 4, 3, 2, and 1 for each row, respectively. Returns the total, up to a specific point, in the report. If a set of data rows contains 50, 75, 80, 90, and 95, RUNNINGSUM returns 50, 125, 205, 295, and 390 for each row, respectively. Returns the standard deviation of a set of data rows. Standard deviation is a statistic that shows how widely values disperse from the mean value. If a set of data rows contains 50, 75, 80, 90 and 95, STDDEV returns 17.536. Adds all the values in a set of data rows. If a report column contains 50, 75, 80, 90, and 95, SUM returns 390. Returns the variance of a set of data rows. Variance is a statistical measure expressing large the size of the differences between the values. The variance increases as the differences between the numbers increase. If a set of data rows contains 50, 75, 80, 90, and 95, VARIANCE returns 307.5. If a set of data rows contains 5, 2, 5, 7, and 10, VARIANCE returns 8.7. Returns the weighted average value in a set of data rows, given weights specified in another set of values. In a weighted average, each number is assigned a weight or degree of importance. These weights determine the relative importance of each number on the average. Grades are often computed using a weighted average. For example, for a set of scores 50, 75, 80, 90, and 95, with respective weights, 10, 25, 15, 30, and 20, WEIGHTEDAVE returns 81.75.