MicroStrategy ONE

ApplyAgg

You can use the ApplyAgg function to define simple metrics or facts by using database-specific, group-value functions. In most cases, these values are not recognized as MicroStrategy objects. The ApplyAgg function is used with Basic functions such as Sum and Max. This is a group-value function.

Syntax

ApplyAgg()

Accepts facts, attributes, and metrics as input.

All placeholders must begin with #0 and increase in increments of 1.

Example1

ApplyAgg("Regrsxx(#0,#1)", [Argument 1], [Argument 2] {~+})

Example 2 ApplyAgg with CASE

You want to create a metric to sum only those values that have an attribute tag set to a desired value. For instance, there exists an attribute that lists a payment as received, or not received, You want to create a metric counts how much money is owed.

It is necessary to sum all values where the payment is listed as not received, and consider the others as being equal to zero. You can accomplish this by using the following ApplyAgg function:

ApplyAgg ("sum (case when #1 in ('received') then 0 else #0 end)", [monetary_based_fact],