MicroStrategy ONE
Arguments
Arguments are the input data used in the calculation of a function. Arguments can be numbers, text, or logical values (such as TRUE or FALSE) as well as constants (such as 1, 2, 3, or NULL). They can be lists of values or variables referencing lists of values.
Arguments in MicroStrategy are most often references to lists of values. In function syntax, the arguments are enclosed in parentheses (). If the argument is a reference to a MicroStrategy object, and the object name is alphanumeric or contains multiple words, it is also contained in brackets [ ]. Depending on the function selected and the object being created, in a MicroStrategy environment the input could comprise one or more of the following objects:
- Attributes: Attributes are most often used to group fact data. They are included in reports to define the level of detail. Typically non-numeric, some common examples of attributes are Year, Category, and Region.
- Facts: Facts are the most commonly used input for metrics. They are numerical lists obtained from specific columns in a fact table. Examples of facts include Units Sold, Units Received, and Discount.
- Metrics: Metrics represent calculations performed on data and can themselves be used as input for further calculation by a function. Examples of metrics include Percent Growth, Profit Margin, and Sell-through Percentage.
- Columns: Column data is used when creating attribute form expressions and fact expressions. The expressions for these objects define how column data is retrieved from the warehouse. Examples of columns include
TOT_DOLLAR_SALES
,TOT_COST
, andCUST_CITY_ID
.
In this guide, lists of attributes, metrics, values, parameters, etc. within a function are separated by commas. Your separator may vary depending on your number and date format locale. For example, the separator is a comma (,) in English and a semicolon (;) in German.
For an in-depth discussion of attributes, facts, and metrics, see the Advanced Reporting Help.
Using Prompts for Arguments
Prompts can be used to provide the value for an argument in a function, which allows a user to determine part of the function definition when a report is executed. Arguments that expect a single value are the most common arguments to use prompts on. For example, the function NTileSize (see NTileSize) has the following syntax:
NTileSize <Ascending, BreakBy> (
Argument
,
Size
)
The two arguments for this syntax are:
Argument
is a metric representing a list of values to be distributed in buckets.Size
is a positive integer that designates the number of elements per bucket.
The argument Size
is a good candidate to use a prompt for, since it expects a single value. Using a prompt to provide the value for Size
allows a user to determine how many elements should be included in each NTile bucket. This is a more flexible reporting solution than defining a static value for the argument that is always used for the calculation.
To include a prompt in a function expression, you can use the following syntax:
?[
Prompt Name
]
The Prompt Name
is the name of the prompt object. For example, you can have the following definition:
NTileSize([Total Revenue], ?[NTileValue Prompt])
In the syntax shown above, NTileValue Prompt
is the name of a value prompt that supplies the size for the NTileSize function.
When prompts are created, you can choose whether answering the prompt is optional or required. Since arguments are required for a function to work properly, it is a good practice to define prompt answers as required if the prompt is going to be used in a function expression.
Many of the financial functions (see Financial Functions) use arguments that expect a single value, and thus are good candidates for using functions to provide their values. For example, the function Coupdays
(see Coupdays (Coupon Period, Number of Days with Settlement)) includes a Frequency
argument which can accept the value of 1, 2, or 4 to determine the number of coupon payments per year. You could use a value prompt for the Frequency
argument to prompt the user to enter the frequency of the coupon payments.