MicroStrategy ONE
RunningCount
Returns the running count for each value in a list of values, returning the current count after each value. The count can be restarted based upon attributes identified in the parameter settings. This is an OLAP function.
Syntax
RunningCount<BreakBy,SortBy>(Argument)
Where:
BreakByis the attribute indicating where the calculation restarts.SortByis the attribute or metric by which the data is sorted.Argumentis a metric representing the list of values.
Expression
Where:
1i= 0 if the ith row of argument is NULL1i= 1 otherwise
n= number of rows/metric values
Example
This simple example demonstrates how the RunningCount function counts rows of data. This report uses the attributes Region and Employee, and the metrics Revenue and Running count. A filter is applied so the only Regions displayed are South, Northwest, and Southwest. The Running count metric is defined as follows:
RunningCount<BreakBy={Region}, SortBy= (Value) >(Revenue)
- The count restarts for every Region.
- The entries are counted based on the value of the metric Revenue in ascending order (the lowest value is counted as 1, next lowest is 2, and so on).
