Escolar Documentos
Profissional Documentos
Cultura Documentos
ANALYTICAL FUNCTIONS
REFERENCE
Version: 7.2.3
CONTENTS
Document description .............................................................. xiii
Who Should Use this Guide................................................... xiv
Prerequisites .......................................................................... xiv
Objectives .............................................................................. xiv
About this Book............................................................................xiv
Typographical standards ............................................................ xvii
For online and printed documentation .................................. xvii
For printed documentation only ............................................ xvii
Resources.....................................................................................xx
Product documentation ...........................................................xx
Online documentation .............................................................xx
International support .................................................................. xxiii
User assistance ......................................................................... xxiv
Online help........................................................................... xxiv
Technical Support ................................................................ xxiv
Feedback ................................................................................... xxix
1. Overview
Introduction .................................................................................. 1
Metrics in MicroStrategy 7i ............................................................ 2
Metric formulae .............................................................................. 3
Facts ........................................................................................ 3
Functions ................................................................................. 4
Function Parameters ............................................................. 10
Terminology and notation in metric functions ........................ 11
Metric notation and syntax ..................................................... 12
The MicroStrategy 7i engine........................................................ 16
iii
Contents
Structure ................................................................................ 16
How Intelligence Server uses functions....................................... 17
Business Case Examples ............................................................ 39
Defining custom plug-in functions................................................ 95
2. Banding Functions
Introduction ................................................................................ 97
Banding........................................................................................ 98
BandingC ..................................................................................... 98
BandingP ..................................................................................... 99
Banding qualification in custom groups ....................................... 99
Examples ................................................................................... 100
Case 1 ................................................................................. 101
Case 2 ................................................................................. 102
Case 3 ................................................................................. 103
Case 4 ................................................................................. 104
3. Basic Functions
iv
4. Date Functions
Contents
5. Finance Functions
Contents
6. Internal Functions
vi
Contents
7. Mathematical
Functions
vii
Contents
9. OLAP Functions
viii
Contents
ix
Contents
Contents
xi
Contents
xii
PREFACE
Document description
In the context of MicroStrategy 7i, engine functions are based
on the capabilities the system offers for handling
user-selected calculations. These calculations are
measurements applied to business data and they constitute
the basis of MicroStrategy 7i metrics. The information in this
book includes
xiii
Preface
Prerequisites
Before reading this document, you should be familiar with
Objectives
After reading this manual, you will be able to use any of the
pre-defined analytical functions in metris definitions.
Preface
Function Types
For the purposes of this document, functions have been
broken into the following major categories:
banding
basic
finance
mathematics
OLAP
pass-through
rank
statistics
string
Function descriptions
For every function identified, the description includes:
function name
information returned
function syntax
xv
Preface
Syntax notation
Throughout this document, conventions used for syntax
notation are as follows:
Character
Parameter type
Function Access
To access MicroStrategy 7i functions:
Preface
Typographical standards
For online and printed documentation
MicroStrategy online and hard copy documentation follows
presentation conventions and cues to help you locate,
identify, and understand important concepts and procedures.
The following table lists these conventions.
Type
Indicates
bold
italic
Courier
font
UPPERCASE
calculations
code samples
registry keys
path and file names
URLs
messages displayed in the screen
Typographical standards
xvii
Preface
Actions
References to screen elements and keys that are the focus of
actions are in bold Arial font style. Following is an example:
1 Click Select Warehouse.
Code
References to code, formulas, or calculations within
paragraphs are formatted in regular Courier New font style.
Following is an example:
Sum(sales)/number of months
Data entry
References to literal data you must type in an exercise or
procedure are in bold Arial font style. References to data you
type in that could vary from user to user or system to system
are in bold italic Arial font style. Following is an example:
Type cmdmgr -f scriptfile.scp and press ENTER.
Type copy c:\filename d:\foldername\filename
Keyboard keys
References to a keyboard key or shortcut keys are in
uppercase letters. Following is an example:
To bold the selected text, press CTRL+B.
New terms
New terms to note are in regular italic font style. These terms
are defined when they are first encountered in the course
material. Following is an example:
Preface
Heading icons
The following heading icons are used to indicate specific
practice and review sections:
Typographical standards
xix
Preface
Resources
Product documentation
MicroStrategy 7i includes a full set of product manuals,
designed to help you find the information you need to install,
configure, design, and administer your business intelligence
and narrowcast systems, as well as full SDK documentation
to help you extend and customize MicroStrategy and
integrate it with your existing applications.
A list of documentation links is available to access all
documentation installed from your CD-ROM. Most of these
documents have been provided in Acrobat Portable
Document Format (PDF).
Acrobat Reader is required to view these
* Adobe
documents. If you do not have Acrobat Reader
Online documentation
To access an online manual
xx Resources
Preface
MicroStrategy 7i Overview
Resources
xxi
Preface
xxii Resources
Customer AnalysisReference
Sales AnalysisReference
Preface
International support
MicroStrategy 7i supports several locales. Support for a locale
typically includes native database and operating system
support, support for date formats, decimal formats, currency
symbols etc. and availability of translated interfaces and
documentation. The level of support is defined in terms of the
components of a MicroStrategy 7i Business Intelligence
environment. A MicroStrategy 7i Business Intelligence
environment consists of the following components,
collectively known as a configuration:
Web browser
International support
xxiii
Preface
User assistance
The following paragraphs describe the types of assistance
available to answer questions you may have regarding
MicroStrategy 7i products.
Online help
MicroStrategy 7i provides several modes of access to online
help:
Technical Support
If you have questions about a specific MicroStrategy product,
you should:
1 Consult the product guides, online help, readme files, and
release notes
2 Consult the online knowledge base at
http://www.microstrategy.com/support/
k_base
technical administrator in your organization can
* Aprobably
help you resolve some of your issues
immediately.
Preface
User assistance
xxv
Preface
Americas
(US and
Canada)
Hours of operation:
MondayFriday: 9:00 A.M.7:00 P.M. Eastern Time (14000000
GMT)
Phone: (703) 8488700
Fax: (703) 8488710
Electronic mail: support@microstrategy.com
Web: http://support.microstrategy.com
Europe,
Middle East,
and Africa
Asia and
Pacific
Hours of operation:
Sunday-Thursday 6:00 P.M.-3:00 A.M. Eastern Time
(23000800 GMT)
Phone: (703) 7446469
Fax: (703) 8488710
Electronic mail: apsupport@microstrategy.com
Web: http://support.microstrategy.com
Brazil
Hours of operation:
MondayFriday: 9:00 A.M.6:00 P.M.
Phone: (5511) 3045-1725
Fax: (5511) 30444088
Electronic mail: support@microstrategy.com
Web: http://support.microstrategy.com
Argentina
Hours of operation:
MondayFriday: 9:00 A.M.6:00 P.M.
Phone: (5411) 52229300
Fax: (5411) 52229355
Electronic mail: support@microstrategy.com
Web: http://support.microstrategy.com
Preface
street address
phone number
fax number
e-mail address
User assistance
xxvii
Preface
Problem description:
What causes the condition to occur?
Does the condition occur sporadically or each time a
certain action is performed?
Does the condition occur on all machines or just on
one?
When did the condition first occur?
What events took place immediately prior to the first
occurrence of the condition (for example, a major
database load, a database move, a software upgrade)?
If there was an error message, what was its exact
wording?
What steps have you taken to isolate and resolve the
issue? What were the results?
System configuration (the information needed for this
purpose depends on the nature of the problem; not all
items listed may be necessary):
computer hardware specifications (processor speed,
RAM, disk space, and so on)
network protocol used
ODBC driver manufacturer and version
database gateway software version
(for MicroStrategy Web-related problems) browser
manufacturer and version
(for MicroStrategy Web-related problems) Web server
manufacturer and version
Preface
Feedback
Please send any comments or suggestions about user
documentation for MicroStrategy 7i products to:
documents@microstrategy.com
Send suggestions for product enhancements to:
support@microstrategy.com
When you provide feedback to us, please include the name
and version of the products you are currently using. Your
feedback is important to us as we prepare for future releases.
Feedback
xxix
Preface
xxx Feedback
1
OVERVIEW
Introduction
In the context of MicroStrategy 7i, functions are based on the
capabilities the system offers for handling user-selected
calculations. These calculations are, in fact, measurements
applied to business data, and constitute the basis of
MicroStrategy 7i metrics. This chapter covers the following:
Overview
Metrics in MicroStrategy 7i
Metrics, in a MicroStrategy 7i environment, belong to one of
the following categories:
2 Metrics in MicroStrategy 7i
Overview
Metric formulae
The metric component that determines the way in which a
given input is calculated in MicroStrategy 7i is known as the
metric formula. The descriptions that follow provide working
definitions of formula contents.
Facts
Represented as arrays of data or vectors in the context of
functions, facts are obtained from specific columns in a fact
table, and denoted in syntax statements in bold characters
(X), sometimes within square brackets ([X]).
Metric formulae
Overview
Functions
We can classify all the operators/functions in Intelligence
Server into one of the following categories:
Group-value function
Consider the following examples of group-value functions.
Example 1:
Consider a function defined as:
n
y = f ( x ) = xi = x1 + x 2 + ... + x n
i =1
4 Metric formulae
= sigma
2003 MicroStrategy, Inc.
Overview
y = f (x ) = xi
i =1
Metric formulae
Overview
Example 3:
Consider a function that is defined as:
n
y = f (x) =
x
i =1
-x
= AvgDev ( x )
z = f (x, y ) =
n
n n
n xi y i - xi yi
i =1
i =1 i =1
2
2
n
n
n
n
n x 2 - x n y 2 - y
i =1 i i =1 i i =1 i i =1 i
n
n n
n xi y i - xi y i
i =1
i =1 i =1
2
2
n
n
n
n
n x 2 - x n y 2 - y
i =1 i i =1 i i =1 i i =1 i
6 Metric formulae
Overview
Single-value function
Consider the following examples of single-value functions.
Example 5:
Consider another function defined as:
z = f ( x, y ) =
x
y
7
= 0.875
8
Example 6:
Consider now input vectors xT = [7 5 10] and yT = [8 4 3].
We want the same operation (division) to be applied to inputs
x and y. Now it has to be performed element by element. The
result will be an output vector zT = [0.875 1.250 3.333]
Metric formulae
Overview
8 Metric formulae
Overview
Relative function
Consider the following examples of relative functions.
Example 8:
Consider the following mapping.
A3
a3,1
a
3,1
a3,1
a
3, 2
a3 , 2
a3 , 2
a3 , 2
a3 , 2
A1
a1,1
a1, 2
a1,3
a1, 4
a1, 5
a1, 6
a1, 7
a1,8
y A3
7 a3,1
5 a3,1
8 a3,1
12 a3, 2
8 a3 , 2
14 a3, 2
12 a3, 2
19 a3, 2
A1
a1,1
a1, 2
a1, 3
a1, 4
a1,5
a1,6
a1, 7
a1,8
z = RunningSum(y )
12
20
12
20
34
46
65
z k = yi
i =1
Metric formulae
Overview
Function Parameters
Function parameters are parameters that help functions
determine how to perform the computation. All
operators/functions have one or more function parameters.
And these function parameters have their own individual
settings. Thus, given the same input, two functions with
different function parameters will have different outputs as
the result of the computation. On the other hand, two
functions with different settings will behave differently.
For example, an aggregation operator/function Count has
one function parameter with three settings: Distinct, FactID
and Null in a tab that is called <FP>, where <FP> represents
the only Count Parameter tab. The settings have their default
values (true, false, NULL, and so on) and can be modified as
required. On the other hand, any OLAP functions, such as:
RunningSum, RunningAvg, MovingSum, and so on have
more than one function parameter tabs. They have: <FP>,
<BB>, and <SB> tabs, where <FP>, <BB> and <SB> stand
for Function Parameters, Break-By, and Sort-By respectively.
These tabs are called Function Parameters and they appear
right after the name of the operator/function.
Referring to Example 8 from the Functions section, the
function can be completely represented as:
z = RunningSum < > < A3> <A1> (y)
This indicates that the function is computed as the running
sum of variable y (which should be a metric), but the
computation will start over for every member of attribute A3
(Break-By A3), and it is sorted according to the elements of
attribute A1 in ascending order (Sort-By A1 ascending).
z = RunningSum < Break-By= A3; Sort-By= A1> (y)
For example, if you wanted to calculate the moving average
(MovingAvg) of the Stock Price for three days, you would
compute the value of the Stock Price by performing a
Break-By on Stock ID and Sort-By on Day.
10 Metric formulae
Overview
Metric formulae
11
Overview
The Intelligence Server interprets each discrete character string as a single entity;
square brackets are necessary to identify multiple-word content as one fact.
fa c t
f ilt e r
12 Metric formulae
a g g r e g a t io n
le v e l
t r a n s f o r m a t io n
Overview
An example
In the metric AvgDev < > ([Total Dollar Sales]) {~+,
Region+}, definition details are as follows:
Metric formulae
13
Overview
14 Metric formulae
Overview
Filters
The following applies to the use of filter notation in metric
syntax:
Transformations
Transformations are created through the addition of
relationship tables in the warehouse, and denoted in syntax
as |TR|, where TR is the name of the transformation.
Metric formulae
15
Overview
Functions
Functions supported by the Intelligence Server can be of
three types:
those that can be handled only by the Analytical
Engine (such as finance functions)
those that can be handled only by the database (such
as date-and-time functions)
those that can be handled either by the Analytical
Engine or by the database
Overview
Simple metric
New subtotal
17
Overview
Sum([Revenue]) {~+}
Overview
19
Overview
Overview
21
Overview
The first two passes of SQL are done to compute the metric at
the appropriate level (namely at Country level), while the
third pass is done to join with attribute Region since the
result of aggregation has to be displayed for each region. This
example is built using DB2 UDB version 5.2 as the
warehouse. Moreover, for the above report, the VLDB for
Intermediate Table type is set to Permanent Table.
Report 02.b (MSTR Engine group-value function)
select
a11.ORDER_ID ORDER_ID,
a11.EMP_ID EMP_ID,
a11.ORDER_DATE DATE_ID,
a12.COUNTRY_ID COUNTRY_ID,
a11.ORDER_AMT WJXBFS1
from
ORDER_FACT a11
join LU_EMPLOYEE
a12
on (a11.EMP_ID = a12.EMP_ID)
create table ZZCN0VHT00 (
COUNTRY_ID INTEGER,
WJXBFS1
DOUBLE)
partitioning key (COUNTRY_ID)
[An analytical SQL]
insert into ZZCN0VHT00 values (1, 156.421081413)
[The rest of the INSERT statements have been
omitted from display].
select
Overview
23
Overview
Sum(Ln([Revenue])) {~+}
Sum(Trunc([Revenue])) {~+}
a13.REGION_ID REGION_ID,
max(a14.REGION_NAME) REGION_NAME,
Sum(Ln(a11.ORDER_AMT)) M03ASUMLNDLR
ORDER_FACT a11
LU_EMPLOYEE
a12
(a11.EMP_ID = a12.EMP_ID)
LU_CALL_CTR
a13
(a12.CALL_CTR_ID = a13.CALL_CTR_ID)
LU_REGION a14
(a12.COUNTRY_ID = a14.COUNTRY_ID and
a13.REGION_ID = a14.REGION_ID)
a13.REGION_ID
Overview
from
join
on
join
on
join
on
a11.ORDER_DATE DATE_ID,
a11.EMP_ID EMP_ID,
a11.ORDER_ID ORDER_ID,
a13.REGION_ID REGION_ID,
a14.REGION_NAME REGION_NAME,
a11.ORDER_AMT WJXBFS1
ORDER_FACT a11
LU_EMPLOYEE
a12
(a11.EMP_ID = a12.EMP_ID)
LU_CALL_CTR
a13
(a12.CALL_CTR_ID = a13.CALL_CTR_ID)
LU_REGION a14
(a12.COUNTRY_ID = a14.COUNTRY_ID and
a13.REGION_ID = a14.REGION_ID)
Note that in this case the functions Trunc and Sum are
computed by the Intelligence Server. It computes the new fact
[Trunc([Dollar Sales])] first, and then uses the Sum
function for summing over the new fact for each region.
The second usage of single-value function (as compound
metric) is simple. Subtraction, addition, division, and
multiplication operators (, +, /, *) are common examples of
single-value functions. Here are some examples:
[Sum([Dollar Sales]) {~+}] / [Sum([Dollar Sales]) {~+,
Country+}]
[Sum([Dollar Sales]) {~+}] + [Sum([Freight]) {~+}]
Consider the following metric definitions:
2003 MicroStrategy, Inc.
25
Overview
from
join
on
join
on
join
on
group by
a13.REGION_ID REGION_ID,
Max(a14.REGION_NAME) REGION_NAME,
Sum(Ln(a11.ORDER_AMT)) M03ASUMLNDLR,
Ln(Sum(a11.ORDER_AMT)) WJXBFS1
ORDER_FACT a11
LU_EMPLOYEE
a12
(a11.EMP_ID = a12.EMP_ID)
LU_CALL_CTR
a13
(a12.CALL_CTR_ID = a13.CALL_CTR_ID)
LU_REGION a14
(a12.COUNTRY_ID = a14.COUNTRY_ID and
a13.REGION_ID = a14.REGION_ID)
a13.REGION_ID
Overview
Window size
Break-by tab
27
Overview
Sort-by tab
NULL handling
Tie handling
Overview
29
Overview
Overview
31
Overview
a12.PROMO_TYPE_ID PROMO_TYPE_ID,
a11.ITEM_ID ITEM_ID,
sum((a11.QTY_SOLD *
(a11.UNIT_PRICE - a11.DISCOUNT)))
WJXBFS1
from
ORDER_DETAIL
a11
join LU_PROMOTION
a12
on a11.PROMOTION_ID = a12.PROMO_SALE_ID)
group by
a12.PROMO_TYPE_ID,
a11.ITEM_ID
create table ZZCN04GM01 (
PROMO_TYPE_ID
INTEGER,
ITEM_ID
INTEGER,
WJXBFS1
DOUBLE)
partitioning key (PROMO_TYPE_ID, ITEM_ID)
[An analytical SQL]
insert into
ZZCN04GM01 values (1, 2, 10.3333333333333)
[The rest of the INSERT statements have been
omitted from display].
Pass #03
select
from
join
on
join
on
Overview
from
join
on
join
on
33
Overview
Overview
35
Overview
Overview
37
Overview
Overview
39
Overview
Overview
41
Overview
Overview
Notice that all call centers have average daily sales for 2000
greater than the average daily sales for the next year. With the
exception of Charleston, they also have higher standard
deviations of daily sales for 2000 when compared with 2001.
This means that the volatility of daily sales in 2001 is higher
than that for 2000. Hence, we cannot state that lower average
daily sales in 2001 are a progressive decrease over 2000
because they may have been caused by random fluctuation.
Given the above observation, it is worth finding out which call
centers actually have statistically significant difference on
their average daily sales between these two years. We can get
the result by testing this hypothesis:
H0: 2000 = 2001 or H0: 2000 - 2001 = 0
against
H1: 2000 2001 or H1: 2000 - 2001 0
where: 2000 and 2001 represent the average daily sales in
2000 and 2001 respectively. We will want to test the above
hypothesis for each call center as well.
The above hypothesis testing can be answered by computing
the p-value. In Statistics, p-value is a probability of making a
decision to reject H0, given that the actual fact H0 is correct.
In the context of our example, this is the probability of
making a mistake to conclude that the average daily sales in
2000 is different from 2001, given that actually they are
about the same. In general, a decision maker wants to restrict
this type of error so that it is smaller than a certain tolerance
(commonly refer to as alpha). This alpha is usually set to
somewhere between 2.5 10.0% depending on many factors.
If we assume that the standard deviation of daily sales for
2000 and 2001 are coming from the same population (that is,
we assume that the population daily standard deviations for
both years are the same), then we can use a plug-in
group-value function called HomoscedasticTTest to compute
the p-value. However, if we assume that the population daily
43
Overview
Day
Northwest
Daily Sales in
2000
Daily Sales in
2001
N
Southeast
Etc.
Overview
Note that we put tilde plus notation (that is, ~+} for
inner metrics since tilde will be replaced by any attribute
on the report. In our example, it will be the attribute Call
Center.
45
Overview
Overview
47
Overview
Overview
49
Overview
Overview
s
s
m - za
m
+
z
,
a
n
n
2
2
These two numbers mean that 99% of sales order will fall
within this category (under the assumption of Normality).
m - za
2
m + za
2
s
n
s
n
51
Overview
\ z s
m+ a
n
2
where
a = 1%
s
n
Moreover, 2
can be computed by the Intelligence Server
using the Confidence plug-in function.
Let us proceed with accomplishing these tasks using the
Intelligence Server. Since we want to get a list of valuable
customers, add the Customer attribute on the Row axis.
Moreover, we will also put Customer Region on the Page-by
axis.
All of the component objects (metrics, filters, and so on) that
are used in this example can be found in the MicroStrategy
Tutorial project under the following folder:
MicroStrategy Tutorial/Public Objects/Reports
/Technical Reports/Reports by Feature/
Analytics/Statistics and Forecasting/
Confidence Level/Component Objects
The report that is built for this example is also available in
MicroStrategy Tutorial under the following folder:
MicroStrategy Tutorial/Public Objects/Reports
/Technical Reports/Reports by Feature/
Analytics/Statistics and Forecasting/
Confidence Level
The first metric to compute the average of sales order from
ORDER_FACT table (the mean parameter of the Normal
distribution) can be defined as:
Overview
53
Overview
Overview
55
Overview
Overview
57
Overview
Overview
CUSTOMER_ID
59
Overview
[LU_ORDER] a12
where a11.[ORDER_ID] = a12.[ORDER_ID]
create table ZZT2E010053MD001 (
CUSTOMER_ID
SHORT,
WJXBFS1
FLOAT)
[An Analytical SQL]
insert into ZZT2E010053MD001
values (26, 105.386485104625)
Pass #03
create table ZZT2E010053MQ002 (
CUSTOMER_ID
SHORT)
insert into ZZT2E010053MQ002
select pa1.[CUSTOMER_ID] AS CUSTOMER_ID
from [ZZT2E010053MD000] pa1,
[ZZT2E010053MD001] pa2
where pa1.[CUSTOMER_ID] = pa2.[CUSTOMER_ID]
and (pa1.[WJXBFS1] > pa2.[WJXBFS1])
Pass #04
select a11.[CUSTOMER_ID] AS CUSTOMER_ID,
a12.[CUST_LAST_NAME] AS CUST_LAST_NAME,
a12.[CUST_FIRST_NAME] AS CUST_FIRST_NAME,
a14.[CUST_REGION_ID] AS CUST_REGION_ID,
a15.[CUST_REGION_NAME] AS CUST_REGION_NAME,
a11.[TOT_DOLLAR_SALES] as WJXBFS1
from [CUSTOMER_SLS] a11,
[ZZT2E010053MQ002] pa3,
[LU_CUSTOMER] a12,
[LU_CUST_CITY] a13,
[LU_CUST_STATE] a14,
[LU_CUST_REGION] a15
where a11.[CUSTOMER_ID] = pa3.[CUSTOMER_ID] and
a11.[CUSTOMER_ID] = a12.[CUSTOMER_ID] and
a12.[CUST_CITY_ID] = a13.[CUST_CITY_ID]and
a13.[CUST_STATE_ID] = a14.[CUST_STATE_ID]
and
a14.[CUST_REGION_ID] = a15.[CUST_REGION_ID]
drop table ZZT2E010053MD000
drop table ZZT2E010053MD001
drop table ZZT2E010053MQ002
Overview
Pass #01 brings back the average sales per customer (Average
Sales metric) and puts the result into a temporary table.
Pass #02 brings three ORDER_AMT facts, puts them into the
memory, and uses them to compute M01, M02, and M03.
Note that in order to compute M05, the Intelligence Server
needs to bring facts for M01, M02, and M03, then perform
group-value functions on the top of three ORDER_AMT
facts, and insert the result back into a temporary table.
Note that the group-value function for M02 (the StDevP
function) is not supported by the database (Microsoft
Access). Thus, the Intelligence Server brings all 3
ORDER_AMT facts to perform computations for Avg, StDev,
and Count functions.
Pass #03 uses the earlier two temporary tables to qualify on
valuable customers based on Definition 01.
The next pass (Pass #04) is needed to display the report with
attributes Customer and Customer Region.
Who are my valuable customers? (Definition 2)
The basic notion of valuable customers is to define a cut-off
value which represents a minimum requirement to be
classified as valuable customers. Let us generate a list of
valuable customers based on the following definition.
Let us assume a Normal distribution of sales order is still
valid and we want the cut-off value to be different for each
attribute element of Customer Region. This means
comparing the average spending of each customer against a
number that reflects the average spending of Customer
Region to which the customer belongs. To make it a little bit
interesting, lets take the average value to be computed from
the year with the highest dollar sales (that is, 2000 data).
However, we want to use sample standard deviations for all
available years (both 2000 and 2001) to allow more
variation.
So lets define the cut-off value for each Customer Region to
be: 2000 + 1.96 x s2000+2001
61
Overview
Overview
63
Overview
Overview
M10 = Sum([Revenue]){~+}
65
Overview
We would also like to see the last order sales from all valuable
customers. This number can be computed by the following
metric:
Last Order Sales = Sum([Revenue]){~+, >|Day+}
Overview
67
Overview
[LU_ORDER] a12,
[LU_CUSTOMER] a13,
[LU_CUST_CITY] a14,
[LU_CUST_STATE] a15,
[LU_DAY] a16
where a11.[ORDER_ID] = a12.[ORDER_ID] and
a12.[CUSTOMER_ID] = a13.[CUSTOMER_ID] and
a13.[CUST_CITY_ID] = a14.[CUST_CITY_ID] and
a14.[CUST_STATE_ID] = a15.[CUST_STATE_ID] and
a11.[ORDER_DATE] = a16.[DAY_DATE]
anda16.[YEAR_ID] in (2001)
group by a15.[CUST_REGION_ID]
Pass #03
select a11.[ORDER_ID] AS ORDER_ID,
a11.[EMP_ID] AS EMP_ID,
a11.[ORDER_DATE] AS DAY_DATE,
a15.[CUST_REGION_ID] AS CUST_REGION_ID,
a11.[ORDER_AMT] as WJXBFS1
from [ORDER_FACT] a11,
[LU_ORDER] a12,
[LU_CUSTOMER] a13,
[LU_CUST_CITY] a14,
[LU_CUST_STATE] a15
where a11.[ORDER_ID] = a12.[ORDER_ID] and
a12.[CUSTOMER_ID] = a13.[CUSTOMER_ID] and
a13.[CUST_CITY_ID] = a14.[CUST_CITY_ID] and
a14.[CUST_STATE_ID] = a15.[CUST_STATE_ID]
create table ZZT2E01003GMD002 (
CUST_REGION_IDBYTE,
WJXBFS1DOUBLE)
Overview
[LU_CUST_STATE] a13,
[ZZT2E01003GMD001] pa2,
[ZZT2E01003GMD002] pa3
where pa1.[CUSTOMER_ID] = a11.[CUSTOMER_ID] and
a11.[CUST_CITY_ID] = a12.[CUST_CITY_ID] and
a12.[CUST_STATE_ID] = a13.[CUST_STATE_ID] and
a13.[CUST_REGION_ID] = pa2.[CUST_REGION_ID] and
pa2.[CUST_REGION_ID] = pa3.[CUST_REGION_ID]
and(pa1.[WJXBFS1] > (pa2.[WJXBFS1] +
pa3.[WJXBFS1]))
Pass #05.a
create table ZZT2E01003GNB004 (
DAY_DATETIMESTAMP,
CUSTOMER_IDSHORT,
WJXBFS1DOUBLE)
69
Overview
pa5.[WJXBFS1] as WJXBFS1
from [ZZT2E01003GNB004] pa5,
[ZZT2E01003GMB005] pa6,
[LU_CUSTOMER] a11,
[LU_CUST_CITY] a12,
[LU_CUST_STATE] a13,
[LU_CUST_REGION] a14
where pa5.[CUSTOMER_ID] = pa6.[CUSTOMER_ID] and
pa5.[DAY_DATE] = pa6.[WJXBFS1] and
pa5.[CUSTOMER_ID] = a11.[CUSTOMER_ID] and
a11.[CUST_CITY_ID] = a12.[CUST_CITY_ID] and
a12.[CUST_STATE_ID] = a13.[CUST_STATE_ID] and
a13.[CUST_REGION_ID] = a14.[CUST_REGION_ID]
drop table ZZT2E01003GMD000
drop table ZZT2E01003GMD001
drop table ZZT2E01003GMD002
drop table ZZT2E01003GMQ003
drop table ZZT2E01003GNB004
drop table ZZT2E01003GMB005
Overview
Example 3: Histogram
How are my customers distributed (classified) based
on sales data?
You are interested in finding out how are your customers
distributed (classified) based on their sales (fact Revenue)
data. We will try to segment them into 10 classes:
71
Overview
Custom group.
Overview
73
Overview
Overview
75
Overview
Overview
77
Overview
Pass #01
select a11.[CUSTOMER_ID] AS CUSTOMER_ID,
a11.[TOT_DOLLAR_SALES] as WJXBFS1
from [CUSTOMER_SLS] a11
Pass #02
create table ZZT0100SRBMMQ000 (
CUSTOMER_ID
SHORT,
DA56 LONG)
Pass #03
[An Analytical SQL]
Pass #04
insert into ZZT0100SRBMMQ000 values (1, 2)
Pass #05
select a11.[DA56] AS DA56,
count(1.0) as WJXBFS1
from [ZZT0100SRBMMQ000] a11
group by a11.[DA56]
drop table ZZT0100SRBMMQ000
Pass #01 is used to pull metric [Sample Set Metric], that is,
[Revenue] for each Customer.
Overview
The next three passes (Passes #02, Pass #03, and Pass #04)
are used to prepare the dynamic classification of Customer
into the custom group. In some sense, this series of SQL
passes are used for building a dynamic lookup table for the
classification that is requested (note that column DA that is
created stands for Dynamic Attribute). Note that the function
NTileValue is computed by the Intelligence Server. It is then
inserted back with the new classification into the dynamic
lookup table for the custom group.
Pass #05 calculates the number of customers that belong to
each custom group element.
79
Overview
Overview
81
Overview
Overview
We can place the above metrics on the row axis along with
attribute Customer Region on the column axis, to get the
following Statistical Descriptors - Simple report.
Pass #01
create table ZZTXS00VL3ZMD000 (
CUSTOMER_IDSHORT,
83
Overview
WJXBFS1LONG,
WJXBFS2DOUBLE)
Pass #02
insert into ZZTXS00VL3ZMD000
select a11.[CUSTOMER_ID] AS CUSTOMER_ID,
1 as WJXBFS1,
a11.[TOT_DOLLAR_SALES] as WJXBFS2
from [CUSTOMER_SLS] a11
Pass #03
select pa1.[CUSTOMER_ID] AS CUSTOMER_ID,
a13.[CUST_REGION_ID] AS CUST_REGION_ID,
a14.[CUST_REGION_NAME] AS CUST_REGION_NAME,
pa1.[WJXBFS1] as WJXBFS1,
pa1.[WJXBFS2] as WJXBFS2,
pa1.[WJXBFS2] as WJXBFS3,
pa1.[WJXBFS2] as WJXBFS4,
pa1.[WJXBFS2] as WJXBFS5,
pa1.[WJXBFS2] as WJXBFS6
from [ZZTXS00VL3ZMD000] pa1,
[LU_CUSTOMER] a11,
[LU_CUST_CITY] a12,
[LU_CUST_STATE] a13,
[LU_CUST_REGION] a14
where pa1.[CUSTOMER_ID] = a11.[CUSTOMER_ID] and
a11.[CUST_CITY_ID] = a12.[CUST_CITY_ID] and
a12.[CUST_STATE_ID] = a13.[CUST_STATE_ID] and
a13.[CUST_REGION_ID] = a14.[CUST_REGION_ID]
Pass #04
[An Analytical SQL]
The first two passes of SQLs (Pass #01 and Pass #02) are
used to prepare and pull 2 inner metrics, namely:
Count(1){~+, Customer+}, and
Sum[Revenue]{~+, Customer+}.
Notice the optimization that the Intelligence Server does to
pull only a single column of Sum[Revenue] even though it is
used in several other metrics.
Overview
Pass #03_Equivalent:
insert into IMT as
select pa1.[CUSTOMER_ID] AS CUSTOMER_ID,
a13.[CUST_REGION_ID] AS CUST_REGION_ID,
a14.[CUST_REGION_NAME] AS CUST_REGION_NAME,
pa1.[WJXBFS1] as WJXBFS1,
pa1.[WJXBFS2] as WJXBFS2,
pa1.[WJXBFS2] as WJXBFS3,
pa1.[WJXBFS2] as WJXBFS4,
pa1.[WJXBFS2] as WJXBFS5,
pa1.[WJXBFS2] as WJXBFS6
from [ZZTXS00VL3ZMD000] pa1,
[LU_CUSTOMER] a11,
[LU_CUST_CITY] a12,
[LU_CUST_STATE] a13,
[LU_CUST_REGION] a14
where pa1.[CUSTOMER_ID] = a11.[CUSTOMER_ID] and
a11.[CUST_CITY_ID] = a12.[CUST_CITY_ID] and
a12.[CUST_STATE_ID] = a13.[CUST_STATE_ID] and
a13.[CUST_REGION_ID] = a14.[CUST_REGION_ID]
Pass #04_Equivalent:
select [CUST_REGION_ID] AS CUST_REGION_ID,
Max([CUST_REGION_NAME]) AS CUST_REGION_NAME,
Sum(WJXBFS1),
Avg(WJXBFS2),
Median(WJXBFS3),
Stdev(WJXBFS4),
85
Overview
Percentile(WJXBFS5, 25%),
Percentile(WJXBFS6, 75%)
from IMT
group by [CUST_REGION_ID]
In the last passes, the temporary tables are dropped from the
database.
Example 5: Forecasting
How to forecast future sales based on existing sales
data?
The MicroStrategy Tutorial project has existing sales data for
the years 2000 and 2001. Using this data, you would like to
forecast potential sales for the upcoming years 2002 and
2003. We would like to apply linear extrapolation techniques
to the historical data to plot a sales line for future data.
Linear extrapolation involves the assumption that the trend
of past data will continue in a linear fashion. The slope and
Y-intercept values of this approximation are calculated based
on historical data, and the same slope and Y-intercept are
applied to extend the line into the future.
All of the component objects (metrics) that are used in this
example can be found in the MicroStrategy Tutorial project
under the following folder:
MicroStrategy Tutorial/Public Objects/Reports
/Technical Reports/Reports by Feature/
Analytics/Statistics and Forecasting/
Forecasting/Component Objects
The report that is built for this example is also available in
MicroStrategy Tutorial under the following folder:
MicroStrategy Tutorial/Public Objects/Reports
/Technical Reports/Reports by Feature/
Analytics/Statistics and Forecasting/
Forecasting
Overview
87
Overview
Overview
89
Overview
Overview
91
Overview
The sales for 2000 and 2001 are actual recorded values, and
the sales for 2002 and 2003 are a linear extrapolation of the
existing data into the future.
Note: There is another report in the Forecasting folder:
Forecast (Grid). This report places the Forecast metric
alongside the Revenue metric for comparison. However, this
report requires the use of outer joins to work properly. The
MicroStrategy Tutorial ships with Microsoft Access as its
default database; in order for this report to work, the Tutorial
warehouse must be moved into a database platform that fully
supports outer joins.
The following SQL is generated for the Forecast (Graph)
report.
Forecast (Graph) report:
Pass #01
create table ZZT6K0100HMMD000 (
YEAR_IDSHORT,
CATEGORY_IDBYTE,
WJXBFS1DOUBLE)
Pass #02
Overview
93
Overview
The first two passes above (Pass #01 and Pass #02) calculate
the Revenue {Year} metric. The next pass (Pass #03)
calculates the inner portion of the YearNumber metric,
assigning the integer 1 to each year available in the LU_YEAR
lookup table. Note that this metric was defined by adding
Year dimensionality with filtering None; this forces the
metric into its own pass of SQL (instead of sharing Pass #02
with the Revenue {Year} metric). This way, all years in the
lookup table get numbered, and not just the years with data
in the fact table.
In passes #04 to #10, the YearNumber, SlopeMetric and
InterceptMetric metrics are calculated. All of these use the
Intelligence Server to perform the calculations based on the
data in the temporary table from passes #01 to #03. Values
are calculated and inserted back into the warehouse.
Finally in Pass #11, the Forecast metric is calculated based on
the information from all of the above calculation. The mx+b
calculation can be clearly seen in the SQL.
In the last three passes, the temporary tables are dropped
from the database.
Overview
95
Overview
2
BANDING FUNCTIONS
Introduction
Banding is used to differentiate displayed data on a report. In
MicroStrategy 7i, banding functions include the following
types:
97
Banding Functions
Banding
Groups metric data into equal intervals and assigns values to
the resulting metric (for example, dollar sales shown in bands
0 - 5000, 5001 - 10,000, 10,001 - 15,000, and so on).
Syntax
This function accepts four arguments, as follows:
Banding (M1, StartAt, StopAt, StepSize), where
M1 is a metric
BandingC
Groups metric data into a specified number of bands and
assigns values to the resulting metric (for example, a total of
25,000 in dollar sales shown in five equal bands.).
Syntax
This function accepts four arguments, as follows:
BandingC (M1, StartAt, StopAt, BandCount), where
98 Banding
M1 is a metric
Banding Functions
BandingP
Groups metric data into bands identified by boundary point
values (for example, 0 - 5000, 5000 - 20,000, 20,000 30,000).
Syntax
This function accepts arguments as follows:
BandingP (M1, Boundary1, Boundary2, Boundary3...),
where
M1 is a metric
BandingP
99
Banding Functions
Examples
The following examples given in cases 1 through 4 are based
on a report as shown in the figure, with the following
conditions present:
100 Examples
Banding Functions
Case 1
Banding type: band size (Banding)
start at: 1
Display behavior
Examples
101
Banding Functions
Case 2
Banding type: band size (Banding)
start at: 1
stop at: 50
step size: 10
Display behavior
102 Examples
Banding Functions
Case 3
Banding type: band count (BandingC)
start at: 1
band count: 10
Display behavior
Examples
103
Banding Functions
Case 4
Banding type: banding points (BandingP)
Display behavior
104 Examples
3
BASIC FUNCTIONS
Introduction
These are basic mathematical functions like average, greatest,
least, maximum, minimum, and so on. They are not as
technically sophisticated as many of the other functions you
will see in this reference, but they are among the most
commonly used functions when creating a calculation.
105
Basic Functions
Average
Name
AVG
Information returned
The average (also known as arithmetic mean) of a group of
listed values.
Syntax
AVG <FP> (Fact) {~+} <FL>|TR|, where Fact is an array of
listed values for which the average is sought.
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Count
Name
COUNT
Information returned
The number of entries in a vector or list of values.
106 Average
Basic Functions
Syntax
COUNT <FP> (Fact) {~+} <FL>|TR|, where Fact is an array
of listed values.
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
First
Name
FIRST
Information returned
The first value in a sorted set of values.
Syntax
First <FP> (Fact) {-+}, where Fact is an array of listed values.
The Function Parameter is sort-by, where a user can define
what attributes to sort the data on. If no sort-by is defined,
then they are sorted by the values.
First
107
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Geometric mean
Name
GEOMEAN
Information returned
Geometric mean of a range of positive values. For example,
the average growth rate for a given compound interest with
variable rates.
Syntax
GEOMEAN < > (Fact) {~+} <FL>|TR|, where Fact is an array
of values (y) whose geometric mean is sought.
Expression
Note
This function results in an invalid return if a data point in the
array is negative.
Basic Functions
Greatest
Name
Greatest
Information returned
Greatest returns the largest value in the value list.
Syntax
Greatest(M1, M2, M3,), where M1, M2, and so on are
metrics. You cannot use facts in this function.
Function support
There is currently no database support for this function.
Last
Name
LAST
Information returned
The last value in a sorted set of values.
Greatest
109
Basic Functions
Syntax
Last <FP> (Fact) {-+}, where Fact is an array of listed values.
The Function Parameter is sort-by, where a user can define
what attributes to sort the data on. If no sort-by is defined,
then they are sorted by the values.
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Least
Name
Least
Information returned
Least returns the smallest value in the value list.
Syntax
Least(M1, M2, M3,), where M1, M2, and so on are metrics.
You cannot use facts in this function.
110 Least
Basic Functions
Function support
There is currently no database support for this function.
Maximum
Name
MAX
Information returned
The highest value in a vector or value list.
Syntax
MAX <FP> (Fact) {~+} <FL>|TR|, where Fact is a list of
values for which the maximum is sought.
Function support
See Appendix A: Database Support for MicroStrategy
Functionsfor a list of the databases that support this function.
Median
Name
MEDIAN
Maximum
111
Basic Functions
Information returned
The value in the middle of a set of listed values (half the
entries in the list are greater than the median, half are less).
Syntax
MEDIAN <FP> (Fact) {~+} <FL>|TR|, where Fact is an array
of data for which the median is sought.
Note
This function provides a location measure: the value returned
has a relative position with regard to other values in the array
(see also Mode).
Minimum
Name
MIN
Information returned
The lowest value in a given vector or value list.
Syntax
MIN <FP> (Fact) {~+} <FL>|TR|, where Fact is a list of values
for which the minimum is sought.
112 Minimum
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Mode
Name
MODE
Information returned
The value occurring most frequently in a given vector or list.
Syntax
MODE <FP> (Fact) {~+} <FL>|TR|, where Fact is a list of
values for which the mode is sought.
Note
This function provides a location measure: the value returned
has a relative position with regard to other values in the list
(see also Mean).
Mode
113
Basic Functions
Product
Name
PRODUCT
Information returned
The product of all values in a vector or list.
Syntax
PRODUCT <FP> (Fact) {~+} <FL>|TR| where Fact is a list of
values for which the product is sought.
114 Product
Basic Functions
Information returned
The standard deviation of a set of values when an entire
population is provided as a set of arguments.1
1 The standard deviation shows how widely values in the population differ from the
mean.
Syntax
STDEVP < > (Fact) {~+} <FL>|TR|, where Fact is a set of
values (x) whose standard deviation is sought.
Expression
Notes
115
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Information returned
Standard deviation of a group within a population, based on a
sample.1
1 The standard deviation of a group is an indicator of how widely values in the group
Syntax
STDEV < > (Fact) {~+} <FL>|TR|, where Fact is a set of
values (x) whose standard deviation is sought.
Expression
Basic Functions
Notes
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Sum
Name
SUM
Information returned
The sum of all values in a given vector or array of data.
Syntax
SUM <FP> (Fact) {~+} <FL>|TR|, where Fact is a value list
for which the total value or sum is sought.
Sum
117
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Variance of a population
Name
VARP
Information returned
Variance based on an entire population.
Syntax
VARP < > (Fact) {~+} <FL>|TR|, where Fact is the set of
values (x) whose variance is sought.
Expression
Note
For this function, arguments relate to an entire population
(as opposed to a population sample; see Variance of a
sample.
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
Variance of a sample
Name
VAR
Information returned
Variance based on a population sample.
Syntax
VAR < > (Fact) {~+} <FL>|TR|, where Fact is the set of values
(x) whose variance is sought.
Expression
Note
Assume, when using this function, that arguments constitute
a population sample (as opposed to a entire population; see
Variance of a population).
Variance of a sample
119
Basic Functions
Function support
See Appendix A: Database Support for MicroStrategy
Functions for a list of the databases that support this
function.
4
DATE FUNCTIONS
Introduction
This chapter describes the Date functions. For syntax
purposes, all date- and time-related functions are based on
only one parameter (date).
MicroStrategy 7i Analytical Engine does not
+ The
calculate date/time functions. Date/time functions for
which your database does not include SQL syntax
support cannot be calculated in your environment.
121
Date Functions
Current Date
Name
CurrentDate
Information returned
The current date as provided by the database timer.
Database
Syntax
DB2 UDB
CURRENT DATE
DataJoiner
CURRENT DATE
Informix
TODAY
Oracle 8i
SYSDATE
Oracle 9i
CURRENT DATE
Redbrick
CURRENT DATE
SQL Server
GETDATE(D)
Sybase
GETDATE(D)
Tandem
{fn CURDATE]
Teradata
CURRENT DATE
Access
NOW(D)
Date Functions
Information returned
The number corresponding tothe day of the month for a date
used as input. The return value is an integer between 1 and
31.
Syntax
The table shows the format for Day of the month in each
certified database.
Database
Syntax
DB2 UDB
DAY(D)
DataJoiner
DAY(D)
Informix
DAY(D)
Oracle
TO_CHAR, (D DD)
Redbrick
SQL Server
DATEPART(DAY, D)
Sybase
DATEPART(DAY, D)
Teradata
Access
DAY(D)
123
Date Functions
Information returned
The number corresponding to the day of the week for a date
used as input. The return value is an integer between 1 and 7.
Syntax
The table shows the format for Day of the week in each
certified database.
Database
Syntax
DB2 UDB
DAYOFWEEK(D)
DataJoiner
DAYOFWEEK(D)
Informix
TO_CHAR(D, %W)
Oracle
TO_CHAR, (D, D)
Redbrick
SQL Server
DATEPART(WEEKDAY, D)
Sybase
DATEPART(WEEKDAY, D)
Tandem
{fn DAYOFWEEK(D)}
Access
DATEPART(w, D)
Date Functions
Information returned
The number corresponding to the day of the year for a date
used as input. The return value is an integer between 1 and
365.
Syntax
The table shows the format for Day of the year in each
certified database.
Database
Syntax
DB2 UDB
DAYOFYEAR(D)
DataJoiner
DAYOFYEAR(D)
Informix
Oracle
Redbrick
EXTRACT(DAYOFYEAR FROM D)
SQL Server
DATEPART(DAYOFYEAR, D)
Sybase
DATEPART(DAYOFYEAR, D)
Teradata
Access
DATEPART(y, D)
125
Date Functions
Week
Name
Week
Information returned
The number corresponding to the week of the year for a date
used as input. The return value is an integer between 1 and
54.
Syntax
The table shows the format for Week in each certified
database.
126 Week
Database
Syntax
DB2 UDB
WEEK(D)
DataJoiner
WEEK(D)
Oracle
TO_CHAR(D WW)
Redbrick
EXTRACT(WEEK FROM D)
SQL Server
DATEPART(WEEK, D)
Sybase
DATEPART(WEEK, D)
Date Functions
Month
Name
Month
Information returned
The number corresponding to the month of the year for a
date used as input. The return value is an integer between 1
and 12.
Syntax
The table shows the format for Month in each certified
database.
Database
Syntax
DB2 UDB
MONTH(D)
DataJoiner
MONTH(D)
Informix
MONTH(D)
Oracle
TO_CHAR(D, MM)
Redbrick
EXTRACT(MONTH FROM D)
SQL Server
DATEPART(MONTH, D)
Sybase
DATEPART(MONTH, D)
Tandem,
{fn MONTH(D)}
Teradata
Access
MONTH(D)
Month
127
Date Functions
Quarter
Name
Quarter
Information returned
The number corresponding to the quarter of the year for a
date used as input. The return value is an integer between 1
and 4.
Syntax
The table shows the format for Quarter in each certified
database.
128 Quarter
Database
Syntax
DB2 UDB
QUARTER(D)
DataJoiner
QUARTER(D)
Informix
trunc((month(D)- 1)/3) + 1
Oracle
TO_CHAR(D, Q)
Redbrick
EXTRACT(QUARTER FROM D)
SQL Server
DATEPART(QUARTER, D)
Sybase
DATEPART(QUARTER, D)
Tandem,
{fn QUARTER(D)}
Teradata
Access
DATEPART(q, D)
Date Functions
Year
Name
Year
Information returned
The year of the input date.
Syntax
The table shows the format for Year in each certified
database.
Database
Syntax
DB2 UDB
YEAR(D)
DataJoiner
YEAR(D)
Informix
YEAR(D)
Oracle
Redbrick
EXTRACT(YEAR FROM D)
SQL Server
DATEPART(YEAR, D)
Sybase
DATEPART(YEAR, D)
Tandem,
{fn YEAR(D)}
Teradata
EXTRACT(YEAR FROM D)
Access
YEAR(D)
Year
129
Date Functions
Information returned
Current date and time as provided by the database timer.
Syntax
The table shows the format for Current date and time in
each certified database.
Database
Syntax
CURRENT TIMESTAMP
DataJoiner
CURRENT TIMESTAMP
Informix
Oracle 8i
SYSDATE
Oracle 9i
CURRENT_TIMESTAMP
Redbrick
CURRENT_TIMESTAMP
SQL Server
GETDATE(D)
Sybase
GETDATE(D)
Tandem
{fn CURDATE}
Teradata
CURRENT_TIMESTAMP
Access
NOW(D)
Date Functions
Current Time
Name
CurrentTime
Information returned
The current time as provided by the database timer. This
function does not take input parameters.
Syntax
The table shows the format for Current time in each
certified database.
Database
Syntax
DB2 UDB
CURRENT TIME
DataJoiner
CURRENT TIME
Informix
Oracle 8i
SYSDATE
Oracle 9i
CURRENT_TIMESTAMP
Redbrick
CURRENT_TIME
SQL Server
GETDATE(T)
Sybase
GETDATE(T)
Tandem
{fn CURTIME}
Teradata
CURRENT_TIME
Access
NOW(T)
Current Time
131
Date Functions
Hour
Name
Hour
Information returned
The integer portion of the value for the hour of the input
time.
Syntax
The table shows the format for Hour in each certified
database.
132 Hour
Database
Syntax
DB2 UDB
Hour(T)
DataJoiner
Hour(T)
Informix
to_char(T, %H)
Oracle
TO_CHAR(T, HH)
Redbrick
EXCTRACT(HOUR FROM T)
SQL Server
DATEPART(Hour, T)
Sybase
DATEPART(HOUR, T)
Teradata
EXTRACT(HOUR FROM T)
Access
DATEPART(h, T)
Date Functions
Minute
Name
Minute
Information returned
The integer portion of the value for the minute of the input
time.
Syntax
The table shows the format for Minute in each certified
database.
Database
Syntax
DB2 UDB
Minute(T)
DataJoiner
Minute(T)
IInformix
to_char(T, %M)
Oracle
TO_CHAR(T, MI)
Redbrick
EXCTRACT(MINUTE FROM T)
SQL Server
DATEPART(Minute, T)
Sybase
DATEPART(MINUTE, T)
Teradata
EXTRACT(MINUTE FROM T)
Access
DATEPART(m, T)
Minute
133
Date Functions
Second
Name
Second
Information returned
The integer portion of the value for the second of the input
time.
Syntax
The table shows the format for Second in each certified
database.
134 Second
Database
Syntax
DB2 UDB
Second(T)
DataJoiner
Second(T)
Informix
to_char(T, %S)
Oracle
TO_CHAR(T, SSI)
Redbrick
EXCTRACT(SECOND FROM D)
SQL Server
DATEPART(Second, T)
Sybase
DATEPART(SECOND, T)
Teradata
substring(cast(extract(second from T) as
char(10)) from 1 for 2)
Access
DATEPART(s, T)
Date Functions
Millisecond
Name
MilliSecond
Information returned
The integer portion of the value for the millisecond of the
input time.
Syntax
The table shows the format for Millisecond in each certified
database.
Database
Syntax
DB2 UDB
MicroSecond(T)/1000
DataJoiner
MicroSecond(T)/1000
Informix
to_char(T, %F3)
Redbrick
EXCTRACT(MILLISECOND FROM T)
SQL Server
DATEPART(Millisecond, T)
Sybase
DATEPART(MILLISECOND, T)
Teradata
substring(cast(extract(second from T) as
char(10)) from 4 for 3)
Millisecond
135
Date Functions
136 Millisecond
5
FINANCE FUNCTIONS
Introduction
In MicroStrategy 7i, all finance-related calculations are
performed by the engine, regardless of database
environment.
137
Finance Functions
Accrued interest
Name
ACCRINT
Information returned
Accrued amount on a security that pays periodic interest.
Syntax
ACCRINT <Par = 1000, Basis = 0> (Issue, FirstInterest,
Settlement, Rate, Frequency), where
1 The
date, after issue date, on which the security is traded to the buyer
are as follows: annual payments = 1, semiannual payments = 2, quarterly
payments = 4
3 The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
2 Values
Basis value
Application
Finance Functions
Basis value
Application
3 (actual/365)
4 (30/60)
Expression
where
Notes
Accrued interest
139
Finance Functions
Information returned
Accrued amount on a security that pays periodic interest at
maturity.
Syntax
ACCRINTM <Par = 1000, Basis =0 > (Issue, Maturity,
Rate), where
1 The date
2 The
Basis value
Application
2 (actual/360)
3 (actual/365)
4 (30/60)
Finance Functions
Expression
where
A = accrued time (for interest-at-maturity items, the value
used is the number of days from issue to maturity)
D = annual-yield basis
Notes
Information returned
The amount received at maturity on a fully invested security.
141
Finance Functions
Syntax
RECEIVED <Basis = 0> (Settlement, Maturity, Investment,
Discount), where
given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
3 (actual/365)
4 (30/60)
Expression
Where
B = number of days in a year (see Basis)
DIM = number of days between settlement to maturity
Finance Functions
Notes
Basis 0
Maturity Settlement
Information returned
The number of coupons payable between the settlement date
and maturity date, rounded up to the nearest whole coupon.
Syntax
COUPNUM <Basis = 0> (Settlement, Maturity,
Frequency), where
Finance Functions
Notes
Information returned
A number that represents the next coupon day after
settlement.
Syntax
COUPNCD <Basis = 0> (Settlement, Maturity, Frequency),
where
1 Date,
Finance Functions
quarterly payments = 4
4
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
3 (actual/365)
4 (30/60)
Notes
145
Finance Functions
Information returned
A number that represents the coupon date before settlement
date.
Syntax
COUPPCD <Basis = 0> (Settlement, Maturity, Frequency),
where
1 Date, after
annual payments = 1
semiannual payments = 2
quarterly payments = 4
4
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
Finance Functions
Basis value
Application
3 (actual/365)
4 (30/60)
Notes
Information returned
The number of days from the beginning of a coupon period to
settlement date.
Syntax
COUPDAYBS <Basis = 0> (Settlement, Maturity,
Frequency), where
147
Finance Functions
The date, after issue, on which the security is traded to the buyer.
The date on which the security expires.
3
Values are as follows:
annual payments = 1
semiannual payments = 2
quarterly payments = 4
2
4 The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
3 (actual/365)
4 (30/60)
Notes
Finance Functions
Information returned
The number of days in the coupon period that contain the
settlement date.
Syntax
COUPDAYS <Basis = 0> (Settlement, Maturity,
Frequency), where
Notes
149
Finance Functions
Information returned
The number of days from settlement to the next coupon date.
Syntax
COUPDAYSNC <Basis = 0> (Settlement, Maturity,
Frequency), where
1 The date,
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
Finance Functions
Basis value
Application
3 (actual/365)
4 (30/60)
Notes
Information returned
The cumulative interest paid on a loan.
Syntax
CUMIPMT <Type = 0> (Rate, Nper, Pv, Start, End), where
151
Finance Functions
Notes
0, Nper
0, or Pv 0
Finance Functions
Information returned
The cumulative principal paid on a loan.
Syntax
CUMPRINC <Type = 0> (Rate, Nper, Pv, Start, End), where
with 1.
Notes
153
Finance Functions
0, Nper
0, or Pv 0
Information returned
Converts a dollar price expressed as a fraction into a dollar
price expressed as a decimal number.
Syntax
DOLLARDE < > (FractionalDollar, Fraction)
Expression
100
= INT(price ) + price - INT( price ) *
fraction
Where
Finance Functions
Information returned
Converts a dollar price expressed as a decimal into a dollar
price expressed as a fraction.
Syntax
DOLLARFR < > (DecimalDollar, Fraction)
Expression
= INT( price ) +
[ price - INT(price )]
100 / fraction
Where
155
Finance Functions
Information returned
The depreciation of an asset for a specified period, using the
double-declining-balance method.
Syntax
DDB <Factor = 2> (Cost, Salvage, Life, Period), where
Expression
(Cost - Salvage) * Factor / Life
Notes
Finance Functions
Information returned
The discount rate on a security.
Syntax
DISC <Basis = 0> (Settlement, Maturity, Price,
Redemption), where
1 The date,
Basis value
Application
3 (actual/365)
4 (30/60)
Expression
Where
157
Finance Functions
Notes
Duration
Name
DURATION
Information returned
The Macauley duration for an assumed par value of $100.
Duration is defined as the weighted average of the present
value of the cash flows and is used as a measure of a bond
prices response to changes in yield.
Syntax
DURATION <Basis = 0> (Settlement, Maturity,
CouponRate, YieldRate, Frequency), where
158 Duration
Finance Functions
Expression
DSC
100
100 coupon
k - 1 + DSC
E
+
DSC
DSC
E
N -1+
k -1+
k =1
E
E
yld
yld
1 +
frequency 1 + frequency
frequency
1
=
frequency
100
100 coupon
DSC
DSC
N -1+
k -1+
k =1
E
E
yld
yld
1+
frequency 1 +
frequency
frequency
Where
Information returned
The effective annual interest rate on a given amount.
159
Finance Functions
Syntax
EFFECT < > (NominalRate, Npery), where
Expression
Notes
Finance Functions
Information returned
The depreciation finance functions:accrued interest of an
asset for a specified period, using the fixed-declining-balance
method.
Syntax
DB <Month = 12> (Cost, Salvage, Life, Period), where
1Life
Expression
161
Finance Functions
Future value
Name
FV
Information returned
The future value of an investment based on periodic, constant
payments and a constant interest rate.
Syntax
FV <Type = 0> (Rate, Nper, Pmt, Pv), where
Note
Finance Functions
Information returned
The future value of an initial principal after a series of
compound-interest rates are applied.
Usage
To calculate the future value of an investment that has a
variable or adjustable rate.
Syntax
FVSCHEDULE <Basis = 0 > (Values, PV), where
1 The
given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
163
Finance Functions
Basis value
Application
3 (actual/365)
4 (30/60)
Note
If Values is nonnumeric, the engine returns an empty cell.
Interest payment
Name
IPMT
Information returned
The interest payment for a given period1.
1 Based on
Syntax
IPMT < FV = 0, Type = 0 > (Rate, Period, Nperiod, PV),
where
Finance Functions
2
3
Notes
Interest rate
Name
INTRATE
Information returned
The interest rate for a fully invested security.
Syntax
INTRATE <Basis = 0> (Settlement, Maturity, Investment,
Redemption), where
Interest rate
165
Finance Functions
Expression
redemption - investment B
=
DIM
investment
Where
Information returned
The interest rate per period on a given annuity.
Finance Functions
Syntax
RATE <FV = 0, Type = 0, Guess = 0 > (Nperiod, Payment,
PV), where
1 Cannot change over the life of the annuity. Typically, includes principal and interest, but no other fees or taxes.
2 The total amount that a series of future payments is worth today.
Notes
167
Finance Functions
Information returned
The internal rate of return on a set of payments1.
1 The internal rate of return is the interest rate received
for an investment consisting of payments that occur periodically. These payments need not be even in value,
but they must occur at regular intervals (such as monthly, quarterly, or annually).
Syntax
IRR <Guess = 0.1> (Value) {~+} <FL>|TR|, where
Notes
Finance Functions
Modified duration
Name
MDURATION
Information returned
Returns the modified Macauley duration1 for a security with
an assumed par value of $100.
1 the weighted average of present payments
Usage
This function is used as a measure of bond-price response to
variations in yield.
Syntax
MDURATION <Basis = 0> (Settlement, Maturity,
CouponRate, YieldRate, Frequency), where
1 Date,
Modified duration
169
Finance Functions
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Expression
=
DURATION
yld
1+
frequency
Where
Notes
Finance Functions
Information returned
The modified internal rate of return on a set of periodic
payments.1
1 This function takes into consideration both the cost of investment and the interest
received on investment.
Syntax
MIRR < > (Values, FinancialRate, ReinvestRate), where
2 Entries in this array can represent payments (negative values) or income (pos-
Expression
Notes
171
Finance Functions
Information returned
The net present value of an investment.1
1
Based on a discount rate and a set of future payments (negative values) and income (positive values).
Syntax
NPV < > (Values, Rate) {~+} <FL>|TR|, where
Expression
Finance Functions
Notes
Information returned
The nominal annual interest rate on an investment.1
1 Based on
the effective rate and the number of compounding periods per year.
173
Finance Functions
Syntax
NOMINAL < > (EffectiveRate, Npery), where
Expression
Notes
Information returned
The number of periods for an investment.1
1 Based on
Finance Functions
Syntax
NPER <Type = 0> (Rate, Pmt, PV, FV), where
2
3
Odd-first-period price
Name
ODDFPRICE
Information returned
The price per $100 face value of a security having an odd
(short or long) first period.
Syntax
ODDFPRICE <Basis = 0> (Settlement, Maturity, Issue,
FirstCoupon, CouponRate, YieldRate, Redemption,
Frequency), where
Odd-first-period price
175
Finance Functions
Expression
Odd Short First Coupon
redemption
=
DSC
N -1+
E
yld
1 +
frequency
rate
DFC
100
frequency
E
+
DSC
E
yld
1+
frequency
rate
100
N
frequency
+
DSC
k -1+
k =2
E
yld
1 +
frequency
rate
A
- 100
frequency E
Where
redemption
=
DSC
N +N q +
E
yld
1+
frequency
NC DC
rate
i
100
rate
100
frequency
NL N
frequency
i =1 i +
+
DSC
DSC
N +
k -N q +
q E k = 2
E
yld
yld
1+
1+
frequency
frequency
NC
rate
Ai
- 100
frequency
NLi
i =1
Finance Functions
Where
Odd-first-period yield
Name
ODDFYIELD
Information returned
The yield of a security that has an odd (either long or short)
first period.
Odd-first-period yield
177
Finance Functions
Syntax
ODDFYIELD <Basis = 0> (Settlement, Maturity, Issue,
FirstCoupon, CouponRate, Price, Redemption,
Frequency), where
Pr is the price
1 Date, after
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Finance Functions
Notes
Odd-last-period price
Name
ODDLPRICE
Information returned
The price per $100 face value of a security having an odd
(short or long) last period.
Syntax
ODDLPRICE <Basis = 0> (Settlement, Maturity,
LastInterest, CouponRate, YieldRate, Redemption,
Frequency), where
179
Finance Functions
Expression
Odd Last Coupon with One Redemption or Less from
Settlement Date
NC DC 100 rate
i
redemption +
frequency NC
NL
i
i =1
Ai
-
=
NC
NLi
DSC i
yld
i =1
1+
i =1 NLi frequency
100 rate
frequency
Where
Finance Functions
Odd-last-period yield
Name
ODDLYIELD
Information returned
The yield of a security that has an odd (short or long) last
period.
Syntax
ODDLYIELD <Basis = 0> (Settlement, Maturity,
LastInterest, CouponRate, Price, Redemption,
Frequency), where
Odd-last-period yield
181
Finance Functions
Expression
Where
Payment
Name
PMT
Information returned
The payment cost on a loan.1
1 Based on
182 Payment
Finance Functions
Syntax
PMT <FV = 0, Type = 0> (Rate, Nper, PV), where
2
3
Also referred to as principal, this the current value of a set of future payments.
The balance to be attained once all payments are made.
Notes
Present value
Name
PV
Present value
183
Finance Functions
Information returned
Returns the present value of an investment
Syntax
PV <Type = 0> (Rate, Nper, Pmt, FV), where
Expression
If rate == 0
Else
Price at maturity
Name
PRICEMAT
Finance Functions
Information returned
The price, per $100 of face value, on a security that pays
interest at maturity.
Syntax
PRICEMAT <Basis = 0> (Settlement, Maturity, Issue,
CouponRate, YieldRate), where
1 Date, after
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Price at maturity
185
Finance Functions
Expression
Where
Notes
Price, discounted
Name
PRICEDISC
Information returned
The price per $100 face value on a discounted security.
186 Price, discounted
Finance Functions
Syntax
PRICEDISC <Basis = 0> (Settlement, Maturity, DiscRate,
Redemption), where
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Expression
Where
Price, discounted
187
Finance Functions
Notes
Information returned
The price, per $100 face value, on a security that pays
periodic interest.
Syntax
PRICE <Basis = 0> (Settlement, Maturity, CouponRate,
YieldRate, Redemption, Frequency), where
Finance Functions
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Expression
Where
189
Finance Functions
Notes
Principle payment
Name
PPMT
Information returned
The payment on the principle for an investment for one given
period.
Syntax
PPMT <Type = 0> (Rate, Per, Nper, PV, FV), where
Finance Functions
Expression
PPMT i=PMT - IPMT i
Where
i = period desired
Straight-line depreciation
Name
SLN
Information returned
The straight-line depreciation of an asset over a given period.
Syntax
SLN < > (Cost, Salvage, Life), where
Straight-line depreciation
191
Finance Functions
Information returned
The sum of years digits depreciation of an asset over a
specified period.
Syntax
SYD < > (Cost, Salvage, Life, Period), where
Expression
Finance Functions
T-bill equity
Name
TBILLEQ
Information returned
The bond-equivalent yield of a Treasury bill.
Syntax
TBILLEQ < > (Settlement, Materity, Discount), where
Expression
=
(365 rate )
360
- rate (DSM )
Where
T-bill equity
193
Finance Functions
T-bill price
Name
TBILLPRICE
Information returned
The price of a treasury bill per $100 of face value.
Syntax
TBILLPRICE < > (Settlement, Maturity, Discount), where
Expression
Notes
Finance Functions
T-bill yield
Name
TBILLYIELD
Information returned
The yield of a treasury bill.
Syntax
TBILLYIELD < > (Settlement, Maturity, Price), where
1 The date
Expression
T-bill yield
195
Finance Functions
3 Excludes any maturity date that is more than one calendar year past Settlement.
Notes
Information returned
The depreciation of an asset over a specified period.1
1Includes partial periods.
Syntax
VDB <Factor = 2> (Cost, Salvage, Life, Period), where
Finance Functions
Note
All values must be positive.
Yield
Name
YIELD
Information returned
The yield on a security that pays periodic interest.
Syntax
YIELD <Basis = 0> (Settlement, Maturity, CouponRate,
Price, Redemption, Frequency), where
Yield
197
Finance Functions
4 The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Expression
Where
A = number of days from the beginning of the period
to Settlement
DSR = number of days from Settlement to
Redemption
E = number of days in a period
198 Yield
Finance Functions
Notes
0 or Redemption 0
Yield at maturity
Name
YIELDMAT
Information returned
Annual yield on a security that pays interest at maturity.
Syntax
YIELDMAT < Basis = 0 > (Settlement, Maturity, Issue,
Rate, Price), where
Yield at maturity
199
Finance Functions
2
The date on which the coupon expires.
3
The given value for Basis in the syntax for this function is 0 [used by American
agencies, assumes 30-day months and 360-day years (30/360)]. Other applicable
values for this parameters are as follows:
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
Notes
Finance Functions
Information returned
The annual yield on a discounted security.
Syntax
YIELDDISC <Basis = 0> (Settlement, Maturity, Price,
Redemption), where
1 The date
Basis value
Application
1 (actual/actual)
2 (actual/360)
3 (actual/365)
4 (30/60)
201
Finance Functions
Notes
0 or Redemption 0
Basis 0
Maturity Settlement
6
INTERNAL FUNCTIONS
Introduction
Internal functions include Pass-through functions that are
MicroStrategy specific, Case functions, and some others that
are for MicroStrategy internal use only. Pass-through and
Case functions are detailed in the following sections. The
Intersect, Intersectln, and Tuple functions cannot be used;
validation fails if any of these is selected.
Pass-through functions
In MicroStrategy 7i, Pass-through functions are used to:
Pass-through functions
203
Internal Functions
Expression replaced
ApplySimple
ApplyAgg
ApplyOLAP
ApplyComparison
ApplyLogic
Usage
Application example
To insert database-specific
functions and simple operators
directly into the SQL. Accepts facts,
attributes, and metrics as input.
Attribute:
ApplySimple(Datediff(YY,#0,getdate(
)), [BIRTH_DATE]), in which
[BIRTH_DATE] is an attribute
ApplySimple(Months_between(sysd
ate,#0),[CURRENT_DT]) in which
[CURRENT_DT] is an attribute
Fact:
ApplySimple(Count(#0),[UNIT_CO
ST]), in which [UNIT_COST] is a fact
Filter:
ApplySimple(Stdev(#0),[CUR TRN
DT])>0
Apply
statement
Usage
Internal Functions
Application example
Compound metric:
ApplySimple(Greatest(#0,#1,#2),
Metric_1, Metric_2,Metric_3)
ApplyAgg()
Simple metric:
ApplyLogic()
ApplyComparis
on()
ApplyOLAP(RunningSlope(#0,#1),
[Metric 1], [Metric 2]
Pass-through functions
205
Internal Functions
1 In most cases,
Case
Name
CASE
Information returned
Values depending on the evaluation of multiple conditions.
Syntax
CASE (condition1, results1, condition2, results2,
...conditionN, resultsN, resultsX), where
Example
CASE (A=2, T, B>5, U, V)
206 Case
Internal Functions
Note
You must drag and drop all arguments onto the editor. If you
type any arguments the function will not validate.
Case Value
Name
CASEV
Information returned
Values depending on whether the given condition is true.
Syntax
CASEV (V, V1, E1, V2, E2, ..., Vn, En, En+1), where
Case Value
207
Internal Functions
Note
The metric or agreement in the CASEV expresssion is always
held as a float. This means that even if the value is 2 it is held
as 2.00000 and therefore 2 and 2.00000 are never
considered equal. Therefore it is best if you wrap the metric
or agreement in the integer function; for example,
CASEV(int(M1), 2, A,...).
Expression
CASEV (M1, 2, a, 3, b, 4, c, d)
When M1=2, return a; when M1=3 return b; when M1=4
return c; otherwise return d. All values are compared to the
initial agreement or metric.
7
MATHEMATICAL FUNCTIONS
Introduction
The way in which the system flags invalid entries for a given
function depends on the database being used. Error
conditions are flagged as described below.
209
Mathematical Functions
Absolute value
Name
ABS
Information returned
The absolute value of a given numeric expression.1
1 The absolute value of a number is
Syntax
ABS < > (Number), where Number is a real number whose
absolute value is sought.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Arc Cosine
Name
ACOS
Information returned
The arc cosine of a given angle1 (the angle is in radians2, the
range is 0-to-p).
1
2
Mathematical Functions
Syntax
ACOS < > (Number), where Number is the value of the
cosine of the angle sought (this value must be between -1 and
1)
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Arc Sine
Name
ASIN
Information returned
The arcsine of a given number1 (the angle is in radians2, the
range is -p/2 to p/2).
1 Arcsine
Syntax
ASIN < > (Number), where Number is the value of the sine of
the angle sought (this value must be between -1 and 1)
Arc Sine
211
Mathematical Functions
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Arc Tangent
Name
ATAN
Information returned
The arctangent of a given number1 (the angle is in radians2,
the range is p/2 to -p/2).
1 Arctangent is the angle whose tangent is the number.
Syntax
ATAN < > (Number), where Number is the tangent of the
angle sought.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Mathematical Functions
Arc Tangent 2
Name
ATAN2
Information returned
The approximate value of the arctangent of a given number
expresssed as the ratio of two input values (the angle is in
radians1, the range is p/2 to -p/2).
1 To convert the result from radians
Syntax
ATAN 2< > (x_num, y_num), where x_num and y_num are
two values whose ratio is the tangent of the angle sought.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Arc Tangent 2
213
Mathematical Functions
Ceiling value
Name
CEILING
Information returned
The smallest integer greater than or equal to a given numeric
expression. (see also Floor value).
Usage
Ceiling calculations are called for in situations in which
results are expressed as specified units of measurement (for
example, to avoid price returns at the penny level, CEILING
could be used on a product priced at $4.42 to round up the
figures to the nearest nickel).
Syntax
CEILING < > (Number), where Number is the value to be
rounded up
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Mathematical Functions
Combination
Name
COMBINE
Information returned
The number of possible combinations for a given number of
items selected as a group from a set.1
1 In
combination calculations, the internal order of the items selected does not affect the return (as opposed to the case in a permutation, in which the order of the
items selected does affect the return; see also Permutation).
Syntax
COMBINE < > (Number, Number_Chosen), where
Expression
the expression that follows, Number = n;
* InNumber_Chosen
= k,
Where
Combination
215
Mathematical Functions
Notes
Cosine
Name
COS
Information returned
The cosine of a given angle.
Syntax
COS < > (Number), where Number is the angle, in radians1,
for which the value of the cosine is sought.
1 To convert the
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
216 Cosine
Mathematical Functions
Cosine, hyperbolic
Name
COSH
Information returned
The hyperbolic cosine of a number.
Syntax
COSH < > (Number), where Number is the angle, in
radians1, for which the value of the hyperbolic cosine is
sought.
1 To convert radians
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Cosine, hyperbolic
217
Mathematical Functions
Information returned
The value of an angle converted from radians to degrees.
Syntax
DEGREES < > (Angle), where Angle is the angle, in radians,
to be converted.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Exponent
Name
EXP
Information returned
e to the power of the number given.1
1
Mathematical Functions
Syntax
EXP < > (Number), where Number is the power to which e is
raised.
Note
e is the inverse of ln, the natural logarithm of a number.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Factorial
Name
FACTORIAL
Information returned
The factorial of an integer n. This is written as n!, and is n *
n-1 * ... *2 * 1. In particular, 0! = 1.
Example
FACTORIAL(5)
returns 120, which is 5*4*3*2*1=120.
Factorial
219
Mathematical Functions
Syntax
FACTORIAL(Number), where Number is an integer.
Floor value
Name
FLOOR
Information returned
The largest integer less than or equal to a given numeric
expression. (see also Ceiling value).
Syntax
FLOOR < > (Number), where Number is the value to be
rounded down
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Integer
Name
INT
Mathematical Functions
Information returned
A given non integer value rounded off to the nearest integer.
Syntax
INT < > (Number), where Number is a real number to be
rounded off.1
1 The expression [Number - INT(Number)] can be used to obtain the decimal
part of a non integer as a return.
Logarithm
Name
LOG
Information returned
The logarithm of a given number in a specified base.
Syntax
LOG < > (Number, Base), where
Logarithm
221
Mathematical Functions
Logarithm, base 10
Name
LOG10
Information returned
The base-10 logarithm of a given number.
Syntax
LOG10 < > (Number), where Number is a positive real
number for which the base-10 logarithm is sought
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Logarithm, natural
Name
LN
Information returned
The natural logarithm of a given number.1
1
Mathematical Functions
Syntax
LN < > (Number), where Number is a positive real number
for which the natural logarithm is sought.2
2
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Logarithm, natural
223
Mathematical Functions
Power
Name
POWER
Information returned
The value of an input numeric expression raised to a given
power.
Syntax
POWER < > (Number, Power), where
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
224 Power
Mathematical Functions
Quotient
Name
QUOTIENT
Information returned
The integral portion of a division.
Usage
This function is used to discard the remainder portion of a
division.
Syntax
QUOTIENT < > (numerator, denominator), where
Information returned
The value of an angle converted from degrees to radians.
Quotient
225
Mathematical Functions
Syntax
RADIANS < > (Number), where Number is the value to be
converted from degrees to radians.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Information returned
A random number that falls between two given values. A
different number is returned each time the function is run.
Syntax
RANDBETWEEN < > (bottom, top), where:
Mathematical Functions
Sine
Name
SIN
Information returned
The sine of a given angle.
Syntax
SIN < > (Number), where Number is the value, in radians,
whose sine is sought.1
1 Multiplying the argument by p/180 converts an angle from degrees to
radians.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Sine, hyperbolic
Name
SINH
Information returned
The hyperbolic sine of a given angle.
Sine
227
Mathematical Functions
Usage
The value of the hyperbolic sine is used to approximate a
cumulative probability distribution.
Syntax
SINH < > (Number), where Number is the value, in radians,
whose hyperbolic sine is sought1.
1
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Square root
Name
SQRT
Information returned
The square root of a given positive numerical expression.
Mathematical Functions
Syntax
SQRT < > (Number), where Number is the number for which
the square root is sought.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Notes
Tangent
Name
TAN
Information returned
The value of the tangent of a given angle.
Syntax
TAN < > (Number), where Number is any real number.1
1
This is the angle, in radians, for which the value of the tangent is sought. If the
argument is in degrees, it should be multiplied by p/180 for conversion to radians.
Tangent
229
Mathematical Functions
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Tangent, hyperbolic
Name
TANH
Information returned
The value of the hyperbolic tangent of a given number.
Syntax
TANH < > (Number), where Number can be any real number.
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Mathematical Functions
Truncate
Name
TRUNC
Information returned
The integral component of a given number.1
1 See Integer.
Syntax
TRUNC < > (Number), where Number is the number to be
truncated
Note
Results from Truncate and Integer differ only when Number
< 0.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Truncate
231
Mathematical Functions
232 Truncate
8
NULL AND ZERO FUNCTIONS
Introduction
The functions described in this section are used to determine
how nulls and zeros are to be displayed on a report.
233
Is Not Null
Name
ISNOTNULL
Information returned
A true or false depending on whether the argument is not
null. If a value is not null, convert it to 1, otherwise keep the
value.
Syntax
ISNOTNULL(Argument)
Note
The ISNULL and ISNOTNULL functions work only with the
data returned from the database. For example, if the database
data is null, the ISNOTNULL function returns a false.
However, you may also see null data when you manipulate a
report after its original generation and that process does not
regenerate the data from the database. This can happen when
you page by, for example, and the result includes a null.
ISNULL and ISNOTNULL do not apply to the data that is not
returned directly from the database.
Is Null
Name
ISNULL
Information returned
A true or false depending on whether the argument is null. If
a value is null, convert it to 0, otherwise keep the value.
Syntax
ISNULL(Argument)
Note
The ISNULL and ISNOTNULL functions work only with the
data returned from the database. For example, if the database
data is null, the ISNOTNULL function returns a false.
However, you may also see null data when you manipulate a
report after its original generation and that process does not
regenerate the data from the database. This can happen when
you page by, for example, and the result includes a null.
ISNULL and ISNOTNULL do not apply to the data that is not
returned directly from the database.
Is Null
235
Null to Zero
Name
NULLTOZERO
Information returned
If a value is null, convert it to zero (0), otherwise keep the
value.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Zero to Null
Name
ZEROTONULL
Information returned
If a value is zero (0), convert it to null, otherwise keep the
value.
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
9
OLAP FUNCTIONS
Introduction
237
OLAP Functions
Information returned
Exponential weighted moving average
Syntax
ExpWghMovingAvg <Breakby> <Sortby> (ValueList,
WindowSize, Rate)
Expression
Information returned
Exponential weighted running average
OLAP Functions
Syntax
ExpWghRunningAvg <Breakby> <Sortby> (ValueList,
Rate)
Expression
Information returned
First value in a range of values
Syntax
FirstInRange <Breakby> <Sortby> (ValueList)
Expression
Where
2003 MicroStrategy, Inc.
239
OLAP Functions
k = row number
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Information returned
Last value in a range of values
Syntax
LastInRange <Breakby> <Sortby> (ValueList)
Expression
Where
k = row number
OLAP Functions
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Moving average
Name
MovingAvg
Information returned
The cumulative, group, or moving average of a value
expression. Return content is a function of how AVG data is
aggregated.
Syntax
MovingAvg <Breakby> <Sortby> (ValueList, WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Moving average
241
OLAP Functions
Moving count
Name
MovingCount
Information returned
The cumulative, group, or moving count of a value
expression. Return content is a function of how COUNT data
is aggregated.
Syntax
MovingCount <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Moving difference
Name
MovingDifference
Information returned
The moving difference between current-row and
preceding-row column values.
Syntax
MovingDifference <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Moving difference
243
OLAP Functions
Moving maximum
Name
MovingMax
Information returned
The cumulative, group, or moving maximum of a value
expression. Return content is a function of how MAX data is
aggregated.
Syntax
MovingMax <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Moving minimum
Name
MovingMin
Information returned
The cumulative, group, or moving minimum of a value
expression. Return content is a function of how MIN data is
aggregated.
Syntax
MovingMin <Breakby> <Sortby> (ValueList, WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Moving minimum
245
OLAP Functions
Information returned
The cumulative, group, or moving standard deviation of a
population for a value expression. Return content is a
function of how STDEVP data is aggregated.
Syntax
MovingStDevp <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Information returned
The cumulative, group, or moving standard deviation of a
sample for a value expression. Return content is a function of
how STDEV data is aggregated.
Syntax
MovingStdev <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
247
OLAP Functions
Moving sum
Name
MovingSum
Information returned
The cumulative, group, or moving sum of a value expression.
Return content is a function of how SUM data is aggregated.
Syntax
MovingSum <Breakby> <Sortby> (ValueList,
WindowSize)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Running average
Name
RunningAvg
Information returned
The cumulative, group, or moving average of a value
expression. Return content is a function of how AVG data is
aggregated.
Syntax
RunningAvg <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Running average
249
OLAP Functions
Running count
Name
RunningCount
Information returned
The cumulative, group, or moving count of a value
expression. Return content is a function of how COUNT data
is aggregated.
Syntax
RunningCount <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Running maximum
Name
RunningMax
Information returned
The cumulative, group, or moving maximum of a value
expression. Return content is a function of how MAX data is
aggregated.
Syntax
RunningMax <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Running maximum
251
OLAP Functions
Running minimum
Name
RunningMin
Information returned
The cumulative, group, or moving minimum of a value
expression. Return content is a function of how MIN data is
aggregated.
Syntax
RunningMin <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Information returned
The cumulative, group, or moving standard deviation of a
population for a value expression. Return content is a
function of how STDEVP data is aggregated.
Syntax
RunningStDevp <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
253
OLAP Functions
Information returned
The cumulative, group, or moving standard deviation of a
sample for a value expression. Return content is a function of
how STDEV data is aggregated.
Syntax
RunningStDev <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
OLAP Functions
Running sum
Name
RunningSum
Information returned
The cumulative, group, or moving sum of a value expression.
Return content is a function of how SUM data is aggregated.
Syntax
RunningSum <Breakby> <Sortby> (ValueList)
Expression
Function support
See Appendix A: Engine Functions: Database Support for a
list of the databases that support this function.
Running sum
255
OLAP Functions
10
RANK AND TILE FUNCTIONS
Introduction
Rank functions are very similar to OLAP functions in
behavior; the primary difference is that in the Rank family
<Sortby> uses only metrics; attributes are not used for this
parameter.
When selecting a ranking option within the VLDB Properties
dialog, available values are as follows:
257
10
N-Tile
Name
NTILE
Information returned
Number of values in the metric, sorted in either ascending or
descending order, and distributed over N buckets.
Syntax
NTILE <Tiles = 4>
Example
Given N = 4 for a metric that contains 20 values, this function
would distribute the numbers as follows:
258 N-Tile
10
Information returned
Number of values in the metric, sorted in either ascending or
descending order, and distributed by stepsize over N buckets.
Syntax
NTILESIZE <Ascending = TRUE> (Value, StepSize)
Example
NTILESIZE (M1,2)
This example returns only two buckets. The number of values
is found and then an equal number of values goes in each
bucket. The actual value does not matter, except for sorting.
If there are four values, the first two go in bucket 1 and the
second two go in bucket 2.
259
10
N-Tile Value
Name
NTILEVALUE
Information returned
Number of values in the metric, sorted in either ascending or
descending order, and distributed by range over N buckets.
Syntax
NTILEVALUE <Segments = N, Ascending = TRUE>
(Value)
Example
Given x as a value in a metric with N = 4, if the minimum
value of x is 5 and the maximum 105, the bucket distribution
is as follows:
5 x < 30 in bucket 1
30 x < 55 in bucket 2
55 x < 80 in bucket 3
10
Information returned
Number of values in the metric, sorted in either ascending or
descending order, and distributed by range over N buckets,
and by stepsize over N buckets.
Syntax
NTILEVALUESIZE <Ascending/Decending> <Breakby>
([V], StepSize)
Example
NTILEVALUESIZE (M1, 1000)
This starts with the minimum value of M1, for example, 1200,
and puts it in bucket 1. Bucket 2 would be 2200-3200, and
any values in that range would be in bucket 2 and so on until
every value is in a bucket. It does not matter how many values
are in each bucket; it only matters that their value is within
the bucket range.
Percentile
Name
PERCENTILE
261
10
Information returned
The percent-th percentile of values in a given range.
Syntax
PERCENTILE <Ascending = TRUE> (Value, Percent)
Example
Given a fact column containing the values 1, 2, 3, and 4:
PERCENTILE ({1, 2, 3, 4}, 0.3) = 1.9
Rank by Value
Name
RANK
Information returned
The order ranking of rows for the expression as specified in
the Order By clause of the SQL statement. .
Syntax
RANK <Asc = TRUE, ByValue= TRUE> (Value)
10
Rank by Percent
Name
RANK
Information returned
The order ranking of percent values for the expression as
specified in the Order By clause of the SQL statement.
Syntax
RANK <Asc = TRUE, ByPercent= TRUE> (Percent)
Rank by Percent
263
10
11
STATISTICAL FUNCTIONS
Introduction
The way in which the system flags invalid entries for a given
function depends on the database being used. Error
conditions are indicated as described below.
265
11
Statistical Functions
Average deviation
Name
AVGDEV
Information returned
Average of the absolute deviations of a set of data in a fact
table.1
1 Average deviation
Syntax
AVGDEV < > ([Fact]) {~+} <FL>|TR|
Expression
Statistical Functions
11
Beta distribution
Name
BETADISTRIBUTION
Information returned
The cumulative beta distribution of a random variable.1
1 This function is used
Syntax
BETADISTRIBUTION < Lower Bound = 0, Upper Bound =
1 > (x, alpha, beta), where
Note
The following are invalid conditions:
alpha 0 or beta 0
Beta distribution
267
11
Statistical Functions
Information returned
Inverse of the Beta distribution.
Syntax
INVERSEBETADISTRIBUTION < Lower Bound = 0, Upper
Bound = 1 > (probability, x, alpha, beta), where
Note
The following are invalid conditions:
alpha 0 or beta 0
Statistical Functions
11
Binomial distribution
Name
BINOMIALDISTRIBUTION
Information returned
Either the binomial probability or the cumulative binomial
probability of a random variable.1
1
Syntax
BINOMIALDISTRIBUTION <Cumulative = 0> (x, n, p),
where
Binomial distribution
269
11
Statistical Functions
Expression
For the binomial probability:
Where
Notes
Chi-square distribution
Name
CHISQUAREDISTRIBUTION
Statistical Functions
11
Information returned
The one-tailed probability of the chi-squared distribution.1
1
Syntax
CHISQUAREDISTRIBUTION < > (x, df), where
Notes
271
11
Statistical Functions
Information returned
The inverse, or critical value, of a given chi-squared
distribution greater than or equal to a pre-specified value [if
probability = ChiDistribution (x...), then
InverseChiDistribution (probability...) = x.]
Usage
This function is used to compare observed results against
expected ones to assess the validity of a hypothesis.
Syntax
INVERSECHIDISTRIBUTION < > (x, df), where
Notes
11
Statistical Functions
Information returned
The result of a test for independence.1
1 This function returns the chi-squared ( 2) distribution for a statistic value and
its
associated degrees of freedom (to determine, for example, to what extent an experiment verifies hypothesized results).
Syntax
CHISQUARETEST < > (Fact1, Fact2) {~+} <FL>|TR|, where
Notes
273
11
Statistical Functions
Confidence interval
Name
CONFIDENCE
Information returned
Confidence interval for a population mean.1
1 The confidence interval is a range
Syntax
CONFIDENCE < > (alpha, stdev, size), where
Expression
If alpha = 0.05, then:
CONFIDENCE = 95%
Statistical Functions
11
Notes
Confidence interval
275
11
Statistical Functions
Correlation
Name
CORRELATION
Information returned
The correlation coefficient between two data sets. Correlation
denotes association between two quantitative variables, and
how related or associated these values are.
Syntax
CORRELATION < > (Fact1, Fact2) {~+} where
Notes
276 Correlation
Statistical Functions
11
Correlation
277
11
Statistical Functions
Covariance
Name
COVARIANCE
Information returned
Product average of the deviations for each data point pair in
two given sets of values.1
1
Covariance determines the relationship between data points in two data arrays
(for example, how -- or if -- greater income is related to higher education levels).
Syntax
COVARIANCE < > (Fact1, Fact2) {~+} <FL>|TR|, where
Fact1 and Fact2 are data sets whose covariance is sought.
Expression
Note
The following are invalid conditions:
278 Covariance
Statistical Functions
11
Criterion binomial
Name
CRITBINOMIAL
Information returned
The smallest value for which the cumulative binomial
distribution is less than or equal to a criterion value.
Syntax
CRITBINOMIAL(trials, probability_s, apha), where
Note
The following are invalid conditions:
trials < 0
Criterion binomial
279
11
Statistical Functions
Exponential distribution
Name
EXPONENTIALDISTRIBUTION
Information returned
Either the probability density or the cumulative distribution
of a random variable.1
1
This function is used to model the time elapsed between events (for example, to
estimate the probability that an automatic-teller machine will take no more than
one minute to deliver requested cash).
Syntax
EXPONENTIALDISTRIBUTION <Cumulative = 0> (x,
lambda), where
Expression
Statistical Functions
11
Note
The following are invalid conditions:
x<0
lambda 0
Fisher transformation
Name
FISHER
Information returned
The Fisher transformation at x.1
1
Syntax
FISHER (x), where x is the numeric value for which the
transformation is sought.
Expression
Fisher transformation
281
11
Statistical Functions
Note
The following are invalid conditions:
x is nonnumeric
x -1 or x 1
Information returned
Inverse of the Fisher transformation.1
1 This function is used to analyze correlations between data arrays (see also Fisher
transformation).
Syntax
INVERSEFISHER(x), where x is the value for which the
inverse of the Fisher transformation is performed.
Expression
Note
This function results in an invalid value if x is nonnumeric.
Statistical Functions
11
F-probability distribution
Name
FDISTRIBUTION
Information returned
The cumulative distribution (F-probability) of a random
variable.1
1 This function is used to determine the difference, in degrees of diversity, between
two data sets (for example, test scores administered to males and females entering
high school can be examined using this function to determine whether the variability in females is different from that found in males).
Syntax
FDISTRIBUTION < > (x, df1, df2), where
Expression
P = (F<X),
Where F is a random variable that has an F distribution.
Notes
F-probability distribution
283
11
Statistical Functions
Information returned
Inverse of the F probability distribution.1
1 This function is used to return critical values from the F distribution (for example,
the output of an analysis-of-variation (anova) calculation may include data for
F-statistic, F-probability, and F-critical values at the 0.05 level of significance. In
such cases, the significance level can be used as the probability argument for FINV
to return the critical value of F).
See also F-probability distribution.
Syntax
INVERSEFDISTRIBUTION < > (x, df1, df2) where
11
Statistical Functions
Notes
F-test
Name
FTEST
Information returned
The one-tailed probability that variances in two vectors or
value arrays Fact1 and Fact2 are not significantly different
(for example, given the test scores from public and private
schools, this functions allows you to determine whether
diversity levels between the two school types are significantly
different).
Syntax
FTEST <Hypothesis type = 0, Ratio = 1> (Fact1, Fact2),
where
F-test
285
11
Statistical Functions
Note
The following are invalid conditions:
Gamma distribution
Name
GAMMADISTRIBUTION
Information returned
Either the cumulative distribution or the probability density
of a random variable.1
1
This function is used in queueing analysis to study variables that may have a
skewed distribution.
Syntax
GAMMADISTRIBUTION <Cumulative = 0> (x, alpha, beta),
where
Statistical Functions
11
Expression
Notes
Gamma distribution
287
11
Statistical Functions
Information returned
Inverse of the Gamma distribution.
Syntax
INVERSEGAMMADISTRIBUTION (x, alpha, beta), where
Note
The following are invalid conditions:
x < 0 or x > 1
Statistical Functions
11
Information returned
The natural logarithm of the gamma distribution.
Syntax
GAMMADISTRIBUTIONLN (x), where x is the value whose
logarithm is to be calculated.
Expression
Where
Note
The following are invalid conditions:
x is nonnumeric
x0
289
11
Statistical Functions
Hypergeometric distribution
Name
HYPERGEOMETRICDISTRIBUTION
Information returned
For the hypergeometric distribution, the probability of a
given number of sample successes, given the sample size,
population successes, and population size. Use
HYPERGEOMETRICDISTRIBUTION for problems with a
finite population, where each observation is either a success
or a failure, and where each subset of a given size is chosen
with equal likelihood.
Syntax
HYPERGEOMETRICDISTRIBUTION < > (x, n, M, N), where
Expression
Statistical Functions
11
Notes
Intercept
Name
INTERCEPT
Information returned
Point at which a line intersects the y-axis in a graph.1
1 This function is used
Syntax
INTERCEPT < > (Fact1, Fact2) {~+} <FL>|TR| where
Intercept
291
11
Statistical Functions
Expression
Note
This function results in an invalid value if the number of data
points (y) in Fact2 is different from the number of data
points (x) in Fact1.
Kurtosis
Name
KURTOSIS
Information returned
Kurtosis (relative flatness) of the values in a given set of fact
table.1
1
292 Kurtosis
Statistical Functions
11
Syntax
KURTOSIS < > (Fact) {~+} <FL>|TR|, where Fact is a set of
values (x) whose relative flatness is sought.
Expression
the expression that follows, s is the sample
* Instandard
deviation.
Lognormal distribution
Name
LOGNORMALDISTRIBUTION
Information returned
Lognormal cumulative distribution of a random variable x
[ln(x) that is normally distributed, with mean and standard
deviation as parameters].1
1 This function is used
Syntax
LOGNORMALDISTRIBUTION < > (x, mean, stdev), where
Lognormal distribution
293
11
Statistical Functions
Expression
x0
stdev 0
Information returned
Inverse of the lognormal cumulative distribution function.1
1 ln(x)
11
Statistical Functions
Syntax
INVERSELOGNORMALDISTRIBUTION < > (x, mean,
stdev) where
x is the probability associated with the lognormal
distribution
mean is the mean of ln(x)
stdev is the standard deviation of ln(x)
Expression
x<0
x>1
stdev < 0
295
11
Statistical Functions
Information returned
Negative binomial distribution (the probability that there will
be n failures before the nth success when the constant
probability of a success is p).1
1 The negative binomial distribution is similar to the binomial distribution, but the
number of successes is fixed and the number of trials is variable. As in the binomial
distribution, trials are assumed to be independent (for example, to find ten individuals with excellent reflexes, knowing that the probability that a candidate has these
qualifications is 0.3, this function calculates the probability that a certain number
of unqualified candidates will be interviewed before the ten people sought are selected).
Syntax
NEGATIVEBINOMIALDISTRIBUTION < > (f, s, p), where
Expression
Statistical Functions
11
Information returned
Either the cumulative distribution or the probability density
of a random variable.1
1
This function has wide application in statistics, including the area of hypothesis
testing.
Syntax
NORMALDISTRIBUTION <Cumulative = 0> (x, mean,
stdev), where
Expression
297
11
Statistical Functions
Note
The following are invalid conditions:
stdev 0
Information returned
Inverse, or critical value, of the normal cumulative
distribution for a given mean and standard deviation (see
Normal cumulative distribution).
Syntax
INVERSENORMDISTRIBUTION < > (x, mean, stdev),
where
Statistical Functions
11
Notes
Information returned
The Pearson product moment correlation coefficient of a set
of values.1
1
This coefficient (r), is a dimensionless index that ranges from -1.0 to 1.0 (inclusive).
Usage
The Pearson product moment correlation coefficient is used
to determine the extent of a relationship between two data
sets.
Syntax
PEARSON < > (Fact1, Fact2), where
299
11
Statistical Functions
Expression
Note
The following are invalid conditions:
Information returned
Square of the Pearson product moment correlation
coefficient for a set of values.1
1 The value of the square of
r is the proportion of the variance in y that is attributable to the variance in x (see Pearson product moment correlation coefficient).
Statistical Functions
11
Syntax
RSQUARE < > (Fact1, Fact2) {~+} <FL> |TR|, where
Note
The following are invalid conditions:
Permutation
Name
PERMUT
Information returned
The number of possible permutations for a given number of
items selected as a group from a set.1
1 In permutation calculations, the internal order of the items selected affects the re-
turn (as opposed to the case of a combination, in which the order of the items selected does not affect the return; see also Combination).
Syntax
PERMUT < > (Number, Number_Chosen), where
301
11
Statistical Functions
Expression
the expression that follows, Number = n;
* InNumber_Chosen
= k.
Notes
Poisson distribution
Name
POISSONDISTRIBUTION
Information returned
The Poisson distribution of a random variable.
Usage
Predicting the number of identified events to take place over
a specified period (for example, the number of cars to arrive
at a toll plaza in a one-minute interval).
11
Statistical Functions
Syntax
POISSONDISTRIBUTION <Type> (x, mean), where
Expression
For type = 1:
For type = 0:
Notes
Poisson distribution
303
11
Statistical Functions
Skew
Name
SKEW
Information returned
Skewness of a data set in a given vector or data array.1
1
Syntax
SKEW < > (Fact) {~+} <FL>|TR|, where Fact is a set of
values (x) whose skewness is sought.
Expression
Note
Teradata V2R4 supports calculation of this function; in all
other environments, the MicroStrategy 7i engine handles the
calculation.
304 Skew
Statistical Functions
11
Information returned
The slope of a linear regression line.1
1
In a regression line passing through a set of data points in data sets Fact1 and
Fact2, the slope is the vertical distance divided by the horizontal distanced between
any two points on the line. This ratio is also known as the rate of change along the
line.
Syntax
SLOPE < > (Fact1, Fact2), where
Expression
Note
The following are invalid conditions:
305
11
Statistical Functions
Information returned
The standard error of estimates in linear regression with two
variables, for example, X = Slope + Intercept * Y
Syntax
STEYX <> ([Y], [X]) {~+}, where
Expression
Notes
Statistical Functions
11
Standardize
Name
STANDARDIZE
Information returned
A normalized value from a distribution characterized by
mean and standard_dev.
Syntax
STANDARDIZE(x,mean,standard_dev), where
Expression
Standardize
307
11
Statistical Functions
Note
The following is an invalid condition:
standard_dev 0
Information returned
Standard normal cumulative distribution of a random
number (the mean is 0; the standard deviation is 1).
Usage
This function can be used in lieu of a table of standard normal
curve areas.
Syntax
STANDARDNORMALDISTRIBUTION < > (x), where x is a
value for which the distribution is sought.
Expression
Statistical Functions
11
Note
This function results in an invalid value if x is nonnumeric.
Information returned
Inverse, or critical value, of the standard normal cumulative
distribution.1
1
This function computes the critical value so that the cumulative distribution is
greater than or equal to a pre-specified value.
Syntax
INVERSENORMSDISTRIBUTION < > (x), where x is the
probability corresponding to the normal distribution.
Note
The following are invalid conditions:
x is nonnumeric
x < 0 or x > 1
309
11
Statistical Functions
T-distribution
Name
TDISTRIBUTION
Information returned
The cumulative distribution of a random variable.1
1 This function can be used
Hypothesis functions
For both variance types, hypothesis functions are as follows:
Decision
Logic Status
HO correct
H1 correct
Accept HO
Yes
Type 1 error
Reject HO
Type 2 error
Yes
Syntax
TDISTRIBUTION < > (x, df) where
Expression
p ( x < X ), where X is a random value that follows the
t-distribution.
310 T-distribution
Statistical Functions
11
Notes
either x or df is nonnumeric
df < 1
T-distribution, inverse of
Name
INVERSETDISTRIBUTION
Information returned
Inverse of T-distribution.
Hypothesis functions
For both variance types, hypothesis functions are as follows:
Decision
Logic Status
HO correct
H1 correct
Accept HO
Yes
Type 1 error
Reject HO
Type 2 error
Yes
T-distribution, inverse of
311
11
Statistical Functions
Syntax
INVERSETDISTRIBUTION < > (probability, df) where
Expression
p ( t < X ), where X is a random value that follows the
t-distribution.
Notes
T-test, mean
Name
MEANTTEST
11
Statistical Functions
Information returned
Probability values for a t-test.1
1
This function is used to determine the closeness in the value of the means of two
samples coming from the same population V.
Hypothesis functions
For both variance types, hypothesis functions are as follows:
Decision
Logic Status
HO correct
H1 correct
Accept HO
Yes
Type 1 error
Reject HO
Type 2 error
Yes
Syntax
MEANTTEST <Hypothesis type = 0> (Fact, Hypothesis
mean) {~+} <FL> |TR|, where
Notes
T-test, mean
313
11
Statistical Functions
Information Returned
The P value for a hypothesis test.1
1 Possible Mean/Offset/Type
Usage
Two-sample analyses are used to determine the level of
variance between the means of paired samples.
See also T-test.
Syntax
PAIREDTTEST <Type, Offset> (Fact1, Fact2) {~+}
<FL>|TR|, where
Statistical Functions
11
Note
One of the results of this sample is pooled variance, an
accumulated measure of spread data about the mean. Pooled
variance is calculated as:
315
11
Statistical Functions
T-test, two-sample
Test names
Heteroscedastic t-test
Homoscedastic t-test
Usage
To determine the level of variance between the means of
paired samples (for example, when a given group is to be
tested before and after an experiment).
Test assumptions
Heteroscedastic t-tests are based on the assumption that
variances between two sample data ranges are unequal
[var(Fact1) var(Fact2)].
Homoscedastic t-tests are based on the assumption that
variances between two sample data ranges are equal
[var(Fact1) = var(Fact2)].
See also MeanT-test.
Hypothesis functions
For both variance types, hypothesis functions are as follows:
Decision
Logic Status
HO correct
H1 correct
Accept HO
Yes
Type 1 error
Reject HO
Type 2 error
Yes
Statistical Functions
11
Syntax
HETEROSCEDASTICTTEST or HOMOSCEDASTICTTEST
HETEROSCEDASTICTTEST or HOMOSCEDASTICTTEST
<Hypothesis type, offset> (Fact1, Fact2) {~+} <FL>|TR|,
with the following conditions:
For H0:
Mu(Fact1) - Mu(Fact2) = offset
For H1:
Mu(Fact1) - Mu(Fact2) < offset (type = -1)
Mu(Fact1) - Mu(Fact2) offset (type = 0: two-sided
test)
Mu(Fact1) - Mu(Fact2) > offset (type = 1)
Mu(Fact1) - Mu(Fact2) offset (type = 2: one-sided
test)
Note
The following are invalid conditions:
T-test, two-sample
317
11
Statistical Functions
Variance test
Name
VARTEST
Information returned
Returns the P-value for the hypothesis test in the following
form:
H0: Var(V) = Sigma_0
vs.
H1: Var(V) < Sigma_0 [Type = -1]
H1: Var(V) Sigma_0 [Type = 0: Two-sided test]
H1: Var(V) >Sigma_0 [Type = 1]
H1: Var(V) Sigma_0 [Type = 2: One-sided test]
Syntax
VARTEST <Type> ([V], Sigma_0) {~+} where TBD
Example
VarTest(M1, 1000) Sigma_O = 1000
For a set of values (M1), what is the probability that the
variance of the value will be equal to 1000? Note that M1
needs to have a defined dimensionality.
Statistical Functions
11
Note
For each variance test function, two tests are performed. The
first tests the probability of the value being equal (0), and the
second tests the probability of the value being less than (-1),
greater than (1), or not equal to (2) the sigma or variance. A
parameter must be specified for the second test.
Weibull distribution
Name
WEIBULLDISTRIBUTION
Information returned
Either the cumulative distribution or the probability density
of a random variable.
Usage
In reliability analysis (for example, the calculation of the
mean time to failure for a given device).
Syntax
WEIBULLDISTRIBUTION <Cumulative = 0> (x, alpha,
beta), where
Weibull distribution
319
11
Statistical Functions
Expression
Note
The following are invalid conditions:
x<0
alpha < 0
beta < 0
12
STRING FUNCTIONS
Introduction
The MicroStrategy 7i Analytical Engine does not calculate
string functions. String functions for which your database
does not include SQL syntax support cannot be
calculated in your environment.
321
12
String Functions
Concatenate
Name
Concat
Information returned
A string resulting from the concatenation of two input
strings.
Syntax
Concat (S1, S2), where
322 Concatenate
Database
Format
DB2 UDB
CONCAT(S1, S2)
DataJoiner
CONCAT(S1, S2)
Informix
(S1|| S2)
Oracle
CONCAT(S1, S2)
Redbrick
CONCAT(S1, S2)
SQL Server
(S1 + S2)
Tandem
Sybase
(S1 + S2)
Teradata
S1|| S2
Access
S1&S2
String Functions
12
Information returned
A string that is the concatenation of two input strings, with a
blank character in between.
Syntax
Concat (S1, S2), where
Database
Format
DB2 UDB
CONCAT(CONCAT(S1, ), S2)
DataJoiner
CONCAT(CONCAT(S1, ), S2)
Informix
(S1|| ||S2)
Oracle
CONCAT(CONCAT(S1, ), S2)
Redbrick
CONCAT(CONCAT(S1, ), S2)
SQL Server
S1 + + S2
Tandem
Sybase
S1 + + S2
Teradata
S1 + + S2
Access
S1 & & S2
323
12
String Functions
Initial Cap
Name
InitCap
Information returned
A string in which the first letter of the input string is
capitalized; all other letters appear in lower case.
Syntax
InitCap(S)
The table shows the format for Initial cap in each certified
database.
Database
Format
DB2 UDB
CONCAT(UCASE(SUBSTR(S, 1, 1)),
LCASE(SUBSTR(S, 2)))
Informix
INITCAP(S)
Oracle
INITCAP(S)
Redbrick
CONCAT(UPPER(SUBSTR(S, 1, 1)),
LOWER(SUBSTR(S, 2)))
SQL Server
UPPER(SUBSTRING(S 1, 1) +
LOWER(SUBSTRING(S, 2, 100)
Sybase
UPPER(SUBSTRING(S1, 1) +
LOWER(SUBSTRING(S, 2, 100)
Teradata
Access
String Functions
12
Length
Name
Length
Information returned
The number of characters in an input string.
Syntax
Length(S)
The table shows the format for Length in each certified
database.
Database
Format
DB2 UDB
LENGTH(S)
DataJoiner
LENGTH(S)
Informix
LENGTH(S)
Oracle
LENGTH(S)
Redbrick
LENGTH(S)
SQL Server
LEN(S)
Tandem
{fn LENGTH(S)}
Sybase
CHAR_LENGTH(S
Teradata
CHAR_LENGTH(S)
Access
LEN(S)
Length
325
12
String Functions
Lower Case
Name
Lower
Information returned
A string in which all upper-case alphabetic characters in an
input string have been converted to lower case.
Syntax
Lower(S).
The table shows the format for Lower case in each certified
database.
Database
Format
DB2 UDB
LCASE(S)
DataJoiner
LCASE(S)
Informix
LOWER(S)
Oracle
LOWER(S)
Redbrick
LOWER(S)
SQL Server
LOWER(S)
Sybase
LOWER(S)
Teradata
LOWER(S)
String Functions
12
Information returned
The starting position of the first occurrence in the input
string.
Syntax
Position (S1, S2), where
S1 is the string
Database
Format
DB2 UDB
LOCATE(S1, S2)
DataJoiner
LOCATE(S1, S2)
Oracle 8i
INSTR(S1, S2)
SQL Server
CHARINDEX(S1, S2)
Sybase
CHARINDEX(S1, S2)
Teradata
INDEX(S1, S2)
327
12
String Functions
Information returned
A substring having a specified number of characters from the
left of the input string.
Syntax
LeftStr (S, n), where
S is the string
The table shows the format for Right string in each certified
database.
Database
Format
DB2 UDB
LEFT(S, n)
DataJoiner
LEFT(S, n)
Informix
SUBSTR(S, 1, n)
Oracle
SUBSTR(S, 1, n)
Redbrick
SUBSTR(S, 1, n)
SQL Server
LEFT(S, n)
Tandem
Sybase
SUBSTRING(lS, 3, 100)
Teradata
SUBSTR(S, 1)
Access
MID(S, 1)
12
String Functions
Information returned
A substring having a specified number of characters from the
right of the input string.
Syntax
RightStr (S, n), where
S is the string
The table shows the format for Right string in each certified
database.
Database
Format
DB2 UDB
RIGHT(S, n)
DataJoiner
RIGHT(S, n)
Informix
SUBSTR(S, (LENGTH(S)-n+1))
Oracle
SUBSTR(S, (LENGTH(S)-n+1))
Redbrick
SUBSTR(S, (LENGTH(S)-n+1))
SQL Server
RIGHT(S, n)
Sybase
Teradata
SUBSTR(S, (LENGTH(S)-n+1))
Access
MID(S, (LEN(S)-n+1))
329
12
String Functions
Substring
Name
SubStr
Information returned
A substring as a sequence of characters taken from the input
string.
Syntax
SubStr(S, n1, n2), where
S is the string
330 Substring
Database
Format
DB2 UDB
DataJoiner
Informix
Oracle
Redbrick
SQL Server
Tandem
Sybase
Teradata 2.4
Access
String Functions
12
Trim
Name
Trim
Information returned
A string in which blanks on either side of the input string
have been removed.
Syntax
Trim(S)
The table shows the format for Trim in each certified
database.
Database
Format
DB2 UDB
LTRIM(RTRIM(S))
DataJoiner
LTRIM(RTRIM(S))
Informix
TRIM(BOTH 1 FROM S)
Oracle
TRIM(S)
Redbrick
LTRIM(RTRIM(S))
SQL Server
LTRIM(RTRIM(S))
Tandem
Sybase
LTRIM(RTRIM(S))
Teradata
TRIM(BOTH FROM S)
Access
TRIM(S)
Trim
331
12
String Functions
Trim Left
Name
LTrim
Information returned
A string in which blanks on the left edge of the input string
have been removed.
Syntax
LTrim(S)
The table shows the format for Left trim in each certified
database.
Database
Format
DB2 UDB
LTRIM(S)
DataJoiner
LTRIM(S)
Informix
TRIM(LEADING FROM S)
Oracle
LTRIM(S1)
Redbrick
LTRIM(S)
SQL Server
LTRIM(S)
Tandem
{fn LTRIM(S)}
Sybase
LTRIM(S)
Teradata
TRIM(LEADING FROM S)
String Functions
12
Trim Right
Name
RTrim
Information returned
A string in which blanks on the right edge of the input string
have been removed.
Syntax
RTrim(S)
The table shows the format for Right trim in each certified
database.
Database
Format
DB2 UDB
RTRIM(S)
DataJoiner
RTRIM(S)
Informix
TRIM(TRAILING FROM S)
Oracle
RTRIM(S)
Redbrick
RTRIM(S)
SQL Server
RTRIM(S)
Tandem
{fn RTRIM(S)}
Sybase
RTRIM(S)
Teradata
TRIM(TRAILING FROM S)
Trim Right
333
12
String Functions
Upper Case
Name
Upper
Information returned
A string in which all lower-case alphabetic characters have
been converted to upper case.
Syntax
Ucase(S)
The table shows the format for Upper case in each certified
database.
Database
Format
DB2 UDB
UCASE(S)
DataJoiner
UCASE(S)
Informix
UPPER(S)
Oracle
UPPER(S)
Redbrick
UPPER(S)
SQL Server
UPPER(S
Tandem
{fn UCASE(S)}
Sybase
UPPER(S)
Teradata
UPPER(S)
Access
UCASE(S)
A
DATABASE SUPPORT FOR
MICROSTRATEGY FUNCTIONS
Introduction
The tables in this appendix show the MicroStrategy 7i engine
functions supported by the various certified databases. The
information is presented by database, and, within each
database, by function type.
on database support of string and date/time
* Specifics
functions is not included in the information that
follows; please see the corresponding chapters in this
document for details.
335
Access
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
Sum
SUM(n)
Notation
Null to zero)
||F( ISNULL(n), x, y )
Zero to null
DB2
Basic functions
336 Access
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
STDDEV(n)
Basic functions
Sum
SUM(n)
VAR(n)
Mathematical functions
Name
Notation
Absolute value
ABS
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2( n1, n2 )
Ceiling
CEIL
Cosine
COS
Cosine, hyperbolic
COSH
Exponent
EXP
Floor
FLOOR
Logarithm, natural
LN
Logarithm, base 10
LOG10
Mod
MOD( n1, n2 )
Power
POWER( n1, n2 )
RADIANS
Round
ROUND
Sine
SIN
Sine, hyperbolic
SINH
Square root
SQRT
Tangent
TAN
Tangent, hyperbolic
TANH
Truncate
TRUNCATE(n)
DB2
337
Notation
Null to zero
Value(n)
Zero to null
CASE
OLAP functions
Name
Notation
Average, moving
Avg(n1) Over(n2)
Average, running
Avg(n1) Over(n2)
Count, moving
Count(n1) Over(n2)
Count, running
Count(n1) Over(n2)
Max, moving
Max(n1) Over(n2)
Max, running
Max(n1) Over(n2)
Min, moving
Min(n1) Over(n2)
Min, running
Min(n1) Over(n2)
Stddev(n1) Over(n2)
Stddev(n1) Over(n2)
Sum, moving
Sum(n1) Over(n2)
Sum, running
Sum(n1) Over(n2)
Statistical functions
338 DB2
Name
Notation
REGR_R2
Correlation
CORRELATION( x, y )
Covariance
COVARIANCE( x, y )
Statistical functions
Linear regression intercept
REGR_INTERCEPT
REGR_SLOPE
Datajoiner
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
STDDEV(n)
Sum
SUM(n)
VAR(n)
Mathematical functions
Name
Notation
Absolute value
ABS
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2( n1, n2 )
Ceiling
CEIL
Cosine
COS
EXP
Datajoiner
339
Mathematical functions
Floor
FLOOR
Logarithm, natural
LN
Logarithm, base 10
LOG10
Mod
MOD( n1, n2 )
Power
POWER( n1, n2 )
RADIANS
Round
ROUND
Sine
SIN
Square root
SQRT
Tangent
TAN
Truncate
TRUNCATE(n)
Notation
Null to zero
Value(n)
Zero to null
CASE
Informix
Basic functions
340 Informix
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
STDEV
Basic functions
Sum
SUM(n)
VARIANCE
Mathematical functions
Name
Notation
Absolute value
ABS
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2
Cosine
COS
Exponent
EXP
Logarithm, natural
LOGN
Logarithm, base 10
LOG10
Mod
MOD
Power
POW
Round
ROUND
Sine
SIN
Square root
SQRT
Tangent
TAN
Truncate
TRUNC(n)
Name
Notation
Null to zero
NLV(n)
Zero to null
CASE
Informix
341
Oracle
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
First
FIRST
Last
LAST
Maximum
MAX(n)
Minimum
MIN(n)
STDDEV_POP
STDDEV
Sum
SUM(n)
VAR_POP
VARIANCE
Mathematical functions
342 Oracle
Name
Notation
Absolute value
ABS(n)
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2
Ceiling
CEIL(n)
Cosine
COS(n)
Cosine, hyperbolic
COSH(n)
Exponent
EXP(n)
Floor
FLOOR(n)
Mathematical functions
Logarithm, natural
LN(n)
Logarithm, base 10
LOG(n)
Mod
MOD( n1, n2 )
Power
POWER( n1, n2 )
Round
ROUND( n1, n2 )
Sine
SIN(n)
Sine, hyperbolic
SINH(n)
Square root
SQRT(n)
Tangent
TAN(n)
Tangent, hyperbolic
TANH(n)
Truncate
TRUNC(n)
Notation
Null to zero
NLV(n)
OLAP functions
Name
Notation
Average, moving
Avg(n1) Over(n2)
Average, running
Avg(n1) Over(n2)
Count, moving
Count(n1) Over(n2)
Count, running
Count(n1) Over(n2)
Max, moving
Max(n1) Over(n2)
Max, running
Max(n1) Over(n2)
Min, moving
Min(n1) Over(n2)
Min, running
Min(n1) Over(n2)
Oracle
343
OLAP functions
Standard deviation, moving
(sample)
Stddev(n1) Over(n2)
Stddev(n1) Over(n2)
Sum, moving
Sum(n1) Over(n2)
Sum, running
Sum(n1) Over(n2)
Statistical functions
Name
Notation
REGR_R2
Correlation
CORR
Covariance
COVAR_POP
REGR_INTERCEPT
REGR_SLOPE
Redbrick
Basic functions
344 Redbrick
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
Sum
SUM(n)
Mathematical functions
Name
Notation
Absolute value
ABS
Ceiling
CEIL
Exponent
EXP
Floor
FLOOR
Logarithm, natural
LN
Logarithm, base 10
LOG10
Power
POWER( n1, n2 )
Square root
SQRT
Notation
Null to zero
IFNULL(n)
Zero to null
NULLIF(n)
OLAP functions
Name
Notation
Average, moving
MOVINGAVG
Redbrick
345
SQL Server
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
First
FIRST
Last
LAST
Maximum
MAX(n)
Minimum
MIN(n)
STDEVP
STDEV
Sum
SUM(n)
VARP
VAR
Mathematical functions
Name
Notation
Absolute value
ABS
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2( n1, n2 )
Ceiling
CEIL
Cosine
COS
Exponent
EXP
Floor
FLOOR
Mathematical functions
Logarithm, natural
LOG
Logarithm, base 10
LOG10
Power
POWER
RADIANS
Round
ROUND
Sine
SIN
Square root
SQRT
Tangent
TAN
Notation
Null to zero
ISNULL(n)
Zero to null
NULLIF(n)
Sybase
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
Sum
SUM(n)
Sybase
347
Mathematical functions
Name
Notation
Absolute value
ABS
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2( n1, n2 )
Ceiling
CEILING
Cosine
COS
EXP
Floor
FLOOR
Logarithm, natural
LOG
Logarithm, base 10
LOG10
Power
POWER
RADIANS
Round
ROUND
Sine
SIN
Square root
SQRT
Tangent
TAN
348 Sybase
Name
Notation
Null to zero
ISNULL(n)
Tandem
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
STDEV
Sum
SUM(n)
VARIANCE
Mathematical functions
Name
Notation
Absolute value
ABS
Name
Notation
Null to zero
CASE
zero to null
CASE
Tandem
349
Teradata
Basic functions
Name
Notation
Average
AVG(n)
Count
COUNT(n)
Maximum
MAX(n)
Minimum
MIN(n)
STDDEV_POP(n)
STDDEV_SAMP(n)
Sum
SUM(n)
VAR_POP
VAR_SAMP(n)
Mathematical functions
350 Teradata
Name
Notation
Absolute value
ABS(n)
Arc cosine
ACOS
Arc sine
ASIN
Arc tangent
ATAN
Arc tangent 2
ATAN2
Cosine
COS
Cosine, hyperbolic
COSH
Exponent
EXP(n)
Logarithm, natural
LN(n)
Logarithm, base 10
LOG(n)
Mod
MOD(n)
Power
n1** n2
Mathematical functions
Sine
SIN
Sine, hyperbolic
SINH
Square root
SQRT(n)
Tangent
TAN
Tangent, hyperbolic
TANH
Notation
Null to zero
ZEROIFNULL
zero to null
NULLIFZERO
OLAP functions
Name
Notation
Average, moving
Avg(n1) Over(n2)
Difference, moving
Mdiff(n)
Count, running
Count(n1) Over(n2)
Sum, moving
Sum(n1) Over(n2)
Sum, running
Sum(n1) Over(n2)
Statistical functions
Name
Notation
REGR_R2
Correlation
CORR( n1, n2 )
Covariance
COVARI_POP( n1, n2 )
Teradata
351
Statistical functions
352 Teradata
Kurtosis
KURTOSIS(n)
REGR_INTERCEPT<independent
expression>, <dependent
expression>
REGR_SLOPE<independent
expression>, <dependent
expression>
Skew
SKEW(n)
INDEX
A
Abs 210
Access function support
basic 336
null and zero 336
Accrint 138
Accrintm 140
Acos 210
amount at maturity 141
analytical engine, the 16
ApplyAgg 204
ApplyComparison 204
ApplyLogic 204
ApplyOLAP 204
ApplySimple 204
arc cosine 210
arc sine 211
arc tangent 212, 213
Asin 211
Atan 212
Atan2 213
average 106
moving 241
running 249
Avg 106
2003 MicroStrategy, Inc.
AvgDev 266
B
balance
double-declining 156
fixed declining 161
variable declining 196
Banding 98
banding functions
band count 98
band size 98
banding in custom groups 99
banding points 99
examples 100
BandingC 98
BandingP 99
basic functions
Avg 106
Count 106
First 107
GeoMean 108
Greatest 109
Last 109
Least 110
Max 111
353
Index
Median 112
Min 112
Mode 113
Product 114
Stdev 116
Stdevp 115
Sum 117
Var 119
Varp 118
Beta distribution, inverse of 268
BetaDistribution 267
BinomialDistribution 269
C
cap
initial 324
Case 206
case
upper 334
Case Value 207
CaseV 207
Ceiling 214
ChiSquareDistribution 271
ChiSquareTest 273
combination 215
Combine 215
compound metric 2
Concat 322
ConcatBlank 323
concatenate 322
concatenate (with blank) 323
condition 2
Confidence 274
confidence interval 274
Correlation 276
Cos 216
Cosh 217
354
cosine 216
cosine, hyperbolic 217
Count 106
count
moving 242
running 250
Coupdaybs 147
Coupdays 149
Coupdaysnc 150
Coupncd 144
Coupnum 143
coupon date
next 144
previous 146
coupon period
beginning to settlement 147
number of days with settlement 149
settlement to next 150
coupon, number payable between settlement and maturity 143
Couppcd 146
Covariance 278
CritBinomial 279
criterion binomial 279
Cumipmt 151
Cumprinc 153
current date 122
current date and time 130
current time 131
CurrentDate 122
CurrentDateTime 130
CurrentTime 131
D
Datajoiner function support
basic 339
mathematical 339
null and zero 340
2003 MicroStrategy, Inc.
date functions
CurrentDate 122
CurrentDateTime 130
CurrentTime 131
DayOfMonth 123
DayOfWeek 124
DayOfYear 125
Hour 132
MilliSecond 135
Minute 133
Month 127
Quarter 128
Second 134
Week 126
Year 129
day
of the month 123
of the week 124
of the year 125
DayOfMonth 123
DayOfWeek 124
DayOfYear 125
Db 161
DB2 function support
basic 336
mathematical 337
null and zero 338
OLAP 338
statistical 338
DDB 156
Degrees 218
degrees, conversion to 218
depreciation
straight line 191
sum of years digits 192
deviation
average 266
standard (population) 115, 305
Index
355
Index
Macauley 158
modified Macauley 169
E
Effect 159
engine
analytical, the 16
query, the 16
SQL, the 16
equity
t-bill 193
error of estimates
standard 306
estimates
standard error 306
Exp 218
exponent 218
ExponentialDistribution 280
ExpWghMovingAvg 238
ExpWghRunningAvg 238
F
Factorial 219
FDistribution 283
finance functions
Accrint 138
Coupdaybs 147
Coupdays 149
Coupdaysnc 150
Coupncd 144
Coupnum 143
Couppcd 146
Cumipmt 151
Cumprinc 153
Db 161
DDB 156
Disc 157
356
Dollarde 154
Dollarfr 155
Duration 158
Effect 159
Fv 162
Fvschedule 163
Intrate 165
Ipmt 164
IRR 168
Mduration 169
MIRR 171
Nominal 173
Nper 174
NPV 172
Oddfprice 175
Oddfyield 177
Oddlprice 179
Oddlyield 181
Pmt 182
Ppmt 190
Price 188
Pricedisc 186
Pricemat 185
Pv 183
Rate 166
Received 141
Sln 191
Syd 192
Tbilleq 193
Tbillprice 194
Tbillyield 195
VDB 196
Yield 197
Yielddisc 201
Yieldmat 199
First 107
first occurrence
position 327
FirstInRange 239
Fisher 281
Fisher transformation 281
Fisher transformation, inverse of 282
fixed declining balance 161
Floor 220
FTest 285
f-test 285
function support
Access 336
Datajoiner 339
DB2 336
Informix 340
Oracle 342
Redbrick 344
SQL Server 346
Sybase 347
Tandem 349
Teradata 350
future value 162
Fv 162
Fvschedule 163
G
Gamma distribution, inverse of 288
GammaDistribution 286
GammaDistributionLn 289
GeoMean 108
geometric mean 108
Greatest 109
H
Heteroscedastic t-test 316
HeteroscedasticTTest 316
Homoscedastic t-test 316
HomoscedasticTTest 316
Hour 132
2003 MicroStrategy, Inc.
Index
HypergeometricDistribution 290
I
independence
chi-square test 273
Informix function support
basic 340
mathematical 341
null and zero 341
InitCap 324
initial cap 324
Int 221
integer 221
Intercept 291
interception, point of 291
interest
accrued 138
at maturity finance functions
Accrintm 140
cumulative paid 151
effective annual rate 159
nominal annual rate 173
payment 164
rate (per period) 166
interest rate 165
Internal functions
ApplyAgg 204
ApplyComparison 204
ApplyLogic 204
ApplyOLAP 204
ApplySimple 204
Case 206
CaseV 207
pass-through 203
international support xxiii
Intrate 165
InverseBetaDistribution 268
357
Index
InverseChiDistribution 272
InverseFDistribution 284
InverseFisher 282
InverseGammaDistribution 288
InverseLogNormalDistribution 294
InverseNormDistribution 298
InverseNormSDistribution 309
InverseTDistribution 311
investment periods, number of 174
Ipmt 164
IRR 168
IsNotNull 234
IsNull 235
K
Kurtosis 292
L
Last 109
LastInRange 240
Least 110
left string 328
left trim 332
LeftStr 328
Length 325
level 2
Ln 222
Log 221
Log10 222
logarithm
(all bases) 221
base 10 222
natural 222
LognormalDistribution 293
Lower 326
lower case 326
LTrim 332
358
M
Macauley duration 158
mathematical functions
Abs 210
Acos 210
Asin 211
Atan 212
Atan2 213
Ceiling 214
Combine 215
Cos 216
Cosh 217
Degrees 218
Exp 218
Factorial 219
Floor 220
Int 221
Ln 222
Log 221
Log10 222
Power 224
Quotient 225
Radians 225
Randbetween 226
Sin 227
Sinh 227
Sqrt 228
Tan 229
Tanh 230
Trunc 231
Max 111
Maximum 111
maximum
moving 244
running 251
Mduration 169
MeanTTest 313
Median 112
metrics
aggregation levels 14
attributes and elements 14
compound 2
condition 2
dimensionality. See level.
facts in definitions 3
filters 15
level (dimensionality) 2
notation and syntax 12
simple 2
terminology 11
transformation 2
transformations 15
using filters 15
MicroStrategy 7i engine
function access xvi
function types xv
functions 16
handling calculations 17
structure 16
syntax notation xvi
MilliSecond 135
Min 112
minimum 112
moving 245
running 252
Minute 133
MIRR 171
Mode 113
modified Macauley duration 169
Month 127
month of the year 127
moving
average 241
average, exponential weight 238
count 242
Index
difference 243
maximum 244
minimum 245
standard deviation (population) 246
standard deviation (sample) 247
sum 248
MovingAvg 241
MovingCount 242
MovingDifference 243
MovingMax 244
MovingMin 245
MovingStdev 247
MovingStDevp 246
MovingSum 248
N
NegativeBinomialDistribution 296
net value, present 172
Nominal 173
NormalDistribution 297
Nper 174
NPV 172
NTile 258
n-tile 258
NTile_S 259
n-tile_s 259
n-tile_VNTile_V 260
N-Tile_VS 261
NTile_VS 261
Null
is 235
is not 234
null and zero functions
IsNotNull 234
IsNull 235
NullToZero 236
ZeroToNull 236
359
Index
O
occurrence
position of first 327
Oddfprice 175
Oddfyield 177
Oddlprice 179
Oddlyield 181
OLAP functions
ExpWghMovingAvg 238
ExpWghRunningAvg 238
FirstInRange 239
LastInRange 240
MovingAvg 241
MovingCount 242
MovingDifference 243
MovingMax 244
MovingMin 245
MovingStdev 247
MovingStDevp 246
MovingSum 248
RunningAvg 249
RunningCount 250
RunningMax 251
RunningMin 252
RunningStDev 254
RunningStDevp 253
RunningSum 255
Oracle function support
basic 342
mathematical 342
null and zero 343
OLAP 343
statistical 344
360
P
PairedTTest 314
pass-through functions
Apply statements 204
introduction 203
syntax 204
use 204
payment 182
Pearson 299
Pearson product moment correlation
coefficient 299
Pearson product moment correlation coefficient, square of 300
Percentile 262
Permut 301
permutation 301
Pmt 182
PoissonDistribution 302
Position 327
Power 224
Ppmt 190
Price 188
price
at maturity 185
discounted 186
odd first period 175
odd last period 179
per $100 face value 188
t-bill 194
Pricedisc 186
Pricemat 185
principal, cumulative paid 153
principle payment 190
Product 114
Pv 183
Q
Quarter 128
quarter of the year 128
query engine, the 16
Quotient 225
R
Radians 225
radians, conversion to 225
Randbetween 226
random number 226
Rank 262, 263
rank
by percent 263
by value 262
rank and tile functions
NTile 258
NTile_S 259
NTile_V 260
NTile_VS 261
Percentile 262
Rank 262, 263
Rate 166
rate of return (internal) 168
rate of return (internal, modified) 171
Received 141
Redbrick function support
basic 344
mathematical 345
null and zero 345
OLAP 345
right string 329
right trim 333
RightStr 329
RSquare 300
RTrim 333
running
Index
average 249
average, exponential weight 238
count 250
maximum 251
minimum 252
standard deviation (population) 253
standard deviation (sample) 254
sum 255
RunningAvg 249
RunningCount 250
RunningMax 251
RunningMin 252
RunningStDev 254
RunningStDevp 253
RunningSum 255
S
Second 134
simple metric
condition 2
dimensionality. See level.
level 2
transformation 2
Sin 227
sine 227
sine, hyperbolic 227
Sinh 227
Skew 304
Sln 191
Slope 305
slope of a linear regression 305
Sortby parameter 237
SQL engine, the 16
SQL Server function support
basic 346
mathematical 346
null and zero 347
361
Index
Sqrt 228
square root 228
standard deviation
moving 246, 247
running 253, 254
Standardize 307
StandardNormalDistribution 308
statistical functions
AvgDev 266
BetaDistribution 267
BinomialDistribution 269
ChiSquareDistribution 271
ChiSquareTest 273
Confidence 274
Correlation 276
Covariance 278
CritBinomial 279
ExponentialDistribution 280
FDistribution 283
Fisher 281
FTest 285
GammaDistribution 286
GammaDistributionLn 289
HeteroscedasticTTest 316
HomoscedasticTTest 316
HypergeometricDistribution 290
Intercept 291
InverseBetaDistribution 268
InverseChiDistribution 272
InverseFDistribution 284
InverseFisher 282
InverseGammaDistribution 288
InverseLogNormalDistribution 294
InverseNormDistribution 298
InverseNormSDistribution 309
InverseTDistribution 311
Kurtosis 292
LognormalDistribution 293
362
MeanTTest 313
NegativeBinomialDistribution 296
NormalDistribution 297
PairedTTest 314
Pearson 299
Permut 301
PoissonDistribution 302
RSquare 300
Skew 304
Slope 305
Standardize 307
StandardNormalDistribution 308
SteYX 306
TDistribution 310
VarTest 318
WeibullDistribution 319
Stdev 116
Stdevp 115
SteYX 306
string
from left 328
from right 329
string functions
Concat 322
ConcatBlank 323
InitCap 324
LeftStr 328
Length 325
Lower 326
LTrim 332
Position 327
RightStr 329
RTrim 333
SubStr 330
Trim 331
Upper 334
SubStr 330
substring 330
Sum 117
sum
moving 248
running 255
support
international xxiii
Sybase function support
basic 347
mathematical 348
null and zero 348
Syd 192
T
Tan 229
Tandem function support
basic 349
mathematical 349
null and zero 349
tangent 229
tangent, hyperbolic 230
Tanh 230
Tbilleq 193
Tbillprice 194
Tbillyield 195
TDistribution 310
technical support xxiv
Teradata function support
basic 350
mathematical 350
null and zero 351
OLAP 351
statistical 351
test for independence
chi-square 273
transformation 2
Trim 331
trim
Index
left 332
right 333
Trunc 231
truncate 231
t-test
heteroscedastic 316
homoscedastic 316
mean 313
paired two-sample 314
two-sample 316
U
Upper 334
upper case 334
V
value
absolute 210
ceiling 214
first in range 239
floor 220
future (schedule) 163
last in range 240
present 183
value, future 162
Var 119
variance
of a population 118
of a sample 119
variance test 318
Varp 118
VarTest 318
VDB 196
W
Week 126
363
Index
Y
Year 129
Yield 197
yield
at maturity 199
odd first period 177
odd last period 181
on a discounted security 201
on a security 197
t-bill 195
Yielddisc 201
Yieldmat 199
Z
zero to null 236
ZeroToNull 236
364