You are on page 1of 574

MicroStrategy Functions Reference

Version: 9.2.1
Document Number: 09410921

Twenty-third Edition, June 2011, version 9.2.1
To ensure that you are using the documentation that corresponds to the software you are licensed to use, compare this version number with the software version shown in “About MicroStrategy...” in the Help menu of your software. Document number: 09410921 Copyright © 2011 by MicroStrategy Incorporated. All rights reserved. If you have not executed a written or electronic agreement with MicroStrategy or any authorized MicroStrategy distributor, the following terms apply: This software and documentation are the proprietary and confidential information of MicroStrategy Incorporated and may not be provided to any other person. Copyright © 2001-2011 by MicroStrategy Incorporated. All rights reserved. THIS SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” AND WITHOUT EXPRESS OR LIMITED WARRANTY OF ANY KIND BY EITHER MICROSTRATEGY INCORPORATED OR ANYONE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE AND NONINFRINGMENT, QUALITY OR ACCURACY. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION IS WITH YOU. SHOULD THE SOFTWARE OR DOCUMENTATION PROVE DEFECTIVE, YOU (AND NOT MICROSTRATEGY, INC. OR ANYONE ELSE WHO HAS BEEN INVOLVED WITH THE CREATION, PRODUCTION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. In no event will MicroStrategy, Inc. or any other person involved with the creation, production, or distribution of the Software be liable to you on account of any claim for damage, including any lost profits, lost savings, or other special, incidental, consequential, or exemplary damages, including but not limited to any damages assessed against or paid by you to any third party, arising from the use, inability to use, quality, or performance of such Software and Documentation, even if MicroStrategy, Inc. or any such other person or entity has been advised of the possibility of such damages, or for the claim by any other party. In addition, MicroStrategy, Inc. or any other person involved in the creation, production, or distribution of the Software shall not be liable for any claim by you or any other party for damages arising from the use, inability to use, quality, or performance of such Software and Documentation, based upon principles of contract warranty, negligence, strict liability for the negligence of indemnity or contribution, the failure of any remedy to achieve its essential purpose, or otherwise. The entire liability of MicroStrategy, Inc. and your exclusive remedy shall not exceed, at the option of MicroStrategy, Inc., either a full refund of the price paid, or replacement of the Software. No oral or written information given out expands the liability of MicroStrategy, Inc. beyond that specified in the above limitation of liability. Some states do not allow the limitation or exclusion of liability for incidental or consequential damages, so the above limitation may not apply to you. The information contained in this manual (the Documentation) and the Software are copyrighted and all rights are reserved by MicroStrategy, Inc. MicroStrategy, Inc. reserves the right to make periodic modifications to the Software or the Documentation without obligation to notify any person or entity of such revision. Copying, duplicating, selling, or otherwise distributing any part of the Software or Documentation without prior written consent of an authorized representative of MicroStrategy, Inc. are prohibited. U.S. Government Restricted Rights. It is acknowledged that the Software and Documentation were developed at private expense, that no part is public domain, and that the Software and Documentation are Commercial Computer Software provided with RESTRICTED RIGHTS under Federal Acquisition Regulations and agency supplements to them. Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFAR 252.227-7013 et. seq. or subparagraphs (c)(1) and (2) of the Commercial Computer Software—Restricted Rights at FAR 52.227-19, as applicable. Contractor is MicroStrategy, Inc., 1850 Towers Crescent Plaza, Vienna, VA 22182. Rights are reserved under copyright laws of the United States with respect to unpublished portions of the Software. The following are either trademarks or registered trademarks of MicroStrategy Incorporated in the United States and certain other countries: MicroStrategy, MicroStrategy 6, MicroStrategy 7, MicroStrategy 7i, MicroStrategy 7i Evaluation Edition, MicroStrategy 7i Olap Services, MicroStrategy 8, MicroStrategy 9, MicroStrategy Distribution Services, MicroStrategy MultiSource Option, MicroStrategy Command Manager, MicroStrategy Enterprise Manager, MicroStrategy Object Manager, MicroStrategy Reporting Suite, MicroStrategy Power User, MicroStrategy Analyst, MicroStrategy Consumer, MicroStrategy Email Delivery, MicroStrategy BI Author, MicroStrategy BI Modeler, MicroStrategy Evaluation Edition, MicroStrategy Administrator, MicroStrategy Agent, MicroStrategy Architect, MicroStrategy BI Developer Kit, MicroStrategy Broadcast Server, MicroStrategy Broadcaster, MicroStrategy Broadcaster Server, MicroStrategy Business Intelligence Platform, MicroStrategy Consulting, MicroStrategy CRM Applications, MicroStrategy Customer Analyzer, MicroStrategy Desktop, MicroStrategy Desktop Analyst, MicroStrategy Desktop Designer, MicroStrategy eCRM 7, MicroStrategy Education, MicroStrategy eTrainer, MicroStrategy Executive, MicroStrategy Infocenter, MicroStrategy Intelligence Server, MicroStrategy Intelligence Server Universal Edition, MicroStrategy MDX Adapter, MicroStrategy Narrowcast Server, MicroStrategy Objects, MicroStrategy OLAP Provider, MicroStrategy SDK, MicroStrategy Support, MicroStrategy Telecaster, MicroStrategy Transactor, MicroStrategy Web, MicroStrategy Web Business Analyzer, MicroStrategy World, Application Development and Sophisticated Analysis, Best In Business Intelligence, Centralized Application Management, Information Like Water, Intelligence Through Every Phone, Intelligence To Every Decision Maker, Intelligent E-Business, Personalized Intelligence Portal, Query Tone, Rapid Application Development, MicroStrategy Intelligent Cubes, The Foundation For Intelligent E-Business, The Integrated Business Intelligence Platform Built For The Enterprise, The Platform For Intelligent E-Business, The Scalable Business Intelligence Platform Built For The Internet, Industrial-Strength Business Intelligence, Office Intelligence, MicroStrategy Office, MicroStrategy Report Services, MicroStrategy Web MMT, MicroStrategy Web Services, Pixel Perfect, Pixel-Perfect, MicroStrategy Mobile, MicroStrategy Integrity Manager and MicroStrategy Data Mining Services are all registered trademarks or trademarks of MicroStrategy Incorporated. All other company and product names may be trademarks of the respective companies with which they are associated. Specifications subject to change without notice. MicroStrategy is not responsible for errors or omissions. MicroStrategy makes no warranties or commitments concerning the availability of future products or versions that may be planned or under development. Patent Information This product is patented. One or more of the following patents may apply to the product sold herein: U.S. Patent Nos. 6,154,766, 6,173,310, 6,260,050, 6,263,051, 6,269,393, 6,279,033, 6,567,796, 6,587,547, 6,606,596, 6,658,093, 6,658,432, 6,662,195, 6,671,715, 6,691,100, 6,694,316, 6,697,808, 6,704,723, 6,741,980, 6,765,997, 6,768,788, 6,772,137, 6,788,768, 6,798,867, 6,801,910, 6,820,073, 6,829,334, 6,836,537, 6,850,603, 6,859,798, 6,873,693, 6,885,734, 6,940,953, 6,964,012, 6,977,992, 6,996,568, 6,996,569, 7,003,512, 7,010,518, 7,016,480, 7,020,251, 7,039,165, 7,082,422, 7,113,993, 7,127,403, 7,174,349, 7,181,417, 7,194,457, 7,197,461, 7,228,303, 7,260,577, 7,266,181, 7,272,212, 7,302,639, 7,324,942, 7,330,847, 7,340,040, 7,356,758, 7,356,840, 7,415,438, 7,428,302, 7,430,562, 7,440,898, 7,486,780, 7,509,671, 7,516,181, 7,559,048, 7,574,376, 7,617,201, 7,725,811, 7,801,967, 7,836,178, 7,861,161, 7,861,253, 7,881,443, 7,925,616, and 7,945,584. Other patent applications are pending. Various MicroStrategy products contain the copyrighted technology of third parties. This product may contain one or more of the following copyrighted technologies: Graph Generation Engine Copyright © 1998-2011. Three D Graphics, Inc. All rights reserved. Actuate® Formula One. Copyright © 1993-2011 Actuate Corporation. All rights reserved. XML parser Copyright © 2003-2011 Microsoft Corporation. All rights reserved. Xalan XSLT processor. Copyright © 1999-2011. The Apache Software Foundation. All rights reserved. Xerces XML parser. Copyright © 1999-2011. The Apache Software Foundation. All rights reserved. FOP XSL formatting objects. Copyright © 2004-2011. The Apache Software Foundation. All rights reserved. Portions of Intelligence Server memory management Copyright © 1991-2011 Compuware Corporation. All rights reserved. ASIHTTPRequest library. Copyright © 2007-2011, All-Seeing Interactive. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)

International Components for Unicode Copyright © 1999-2011 Compaq Computer Corporation Copyright © 1999-2011 Hewlett-Packard Company Copyright © 1999-2011 IBM Corporation Copyright © 1999-2011 Hummingbird Communications Ltd. Copyright © 1999-2011 Silicon Graphics, Inc. Copyright © 1999-2011 Sun Microsystems, Inc. Copyright © 1999-2011 The Open Group All rights reserved. Real Player and RealJukebox are included under license from Real Networks, Inc. Copyright © 1999-2011. All rights reserved.

CONTENTS
Description of guide .................................................................. xv About this book .............................................................................xv Additional formats .................................................................. xvi How to find business scenarios and examples ..................... xvii What’s new in this guide ...................................................... xviii Prerequisites ........................................................................ xviii Who should use this guide..................................................... xix Resources.................................................................................... xix Documentation....................................................................... xix Education ............................................................................ xxvii Consulting ...........................................................................xxviii International support ...........................................................xxviii Technical Support ...............................................................xxviii Feedback ..................................................................................xxxiii 1. Understanding Functions in MicroStrategy Introduction.................................................................................. 1 The basics of MicroStrategy objects, object definitions, and functions ........................................................................................ 2 Function syntax and formula components ..................................... 4 Function types ......................................................................... 5 About function parameters..................................................... 17 About arguments ................................................................... 24 Using functions in expressions .................................................... 24 Metric expressions ................................................................. 25 Attribute form expressions ..................................................... 32 Consolidation element expressions ....................................... 35 Custom Group expressions ................................................... 36
© 2011 MicroStrategy, Inc.

v

Contents

MicroStrategy Functions Reference

Fact expressions.................................................................... 38 Filter expressions................................................................... 40 Subtotal expressions ............................................................. 41 Transformation expressions................................................... 42 Adding functions to expressions with the Insert Function Wizard.................................................................................... 43 How MicroStrategy processes functions...................................... 46 Types of function processing ................................................. 46 How Intelligence Server uses functions ................................. 47 Using group-value functions .................................................. 47 Using single-value functions .................................................. 50 Using OLAP functions............................................................ 54 Using custom plug-in functions .............................................. 62 Additional examples of functions in expressions ......................... 66 Hypothesis Testing example.................................................. 66 Confidence Level example .................................................... 72 Statistical Descriptors - Simple example................................ 83 Forecasting example ............................................................. 86 2. Standard Functions Introduction................................................................................ 91 Basic functions............................................................................. 92 Add ........................................................................................ 92 Average ................................................................................. 93 Avg (average) ........................................................................ 94 Count ..................................................................................... 95 First ........................................................................................ 98 GeoMean (geometric mean) .................................................. 99 Greatest ............................................................................... 100 Last ...................................................................................... 101 Least .................................................................................... 102 Max (maximum) ................................................................... 103 Median ................................................................................. 105 Min (minimum) ..................................................................... 106 Mode .................................................................................... 108 Multiply................................................................................. 109 Product ................................................................................ 110 StDevP (standard deviation of a population) ....................... 111 StDev (standard deviation of a sample)............................... 112 Sum ..................................................................................... 114 VarP (variance of a population) ........................................... 115 Var (variance of a sample)................................................... 117

vi

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Contents

Date and time functions ............................................................. 118 AddDays .............................................................................. 118 AddMonths........................................................................... 119 CurrentDate ......................................................................... 120 CurrentDateTime ................................................................. 120 CurrentTime ......................................................................... 121 Date ..................................................................................... 121 DayofMonth ......................................................................... 121 DayofWeek .......................................................................... 122 DayofYear ............................................................................ 123 DaysBetween....................................................................... 123 Hour ..................................................................................... 124 Millisecond ........................................................................... 124 Minute .................................................................................. 125 Month ................................................................................... 125 MonthEndDate ..................................................................... 126 MonthStartDate.................................................................... 126 MonthsBetween ................................................................... 127 Quarter................................................................................. 128 Second................................................................................. 128 Week.................................................................................... 129 Year ..................................................................................... 129 YearEndDate ....................................................................... 130 YearStartDate ...................................................................... 130 Internal functions ....................................................................... 131 Apply (Pass-Through) functions........................................... 132 Banding functions ................................................................ 137 Case functions ..................................................................... 143 NULL/Zero functions.................................................................. 148 IsNotNull .............................................................................. 148 IsNull .................................................................................... 149 NullToZero ........................................................................... 149 ZeroToNull ........................................................................... 150 OLAP functions.......................................................................... 150 ExpWghMovingAvg (exponential weighted moving average)............................................................................... 151 ExpWghRunningAvg (exponential weighted running average)............................................................................... 152 FirstInRange ........................................................................ 153 Lag ....................................................................................... 155 LastInRange ........................................................................ 160 Lead ..................................................................................... 161

© 2011 MicroStrategy, Inc.

vii

Contents

MicroStrategy Functions Reference

MovingAvg (moving average) .............................................. 163 MovingCount........................................................................ 164 MovingDifference ................................................................. 166 MovingMax (moving maximum) ........................................... 167 MovingMin (moving minimum) ............................................. 169 MovingStDevP (moving standard deviation of a population) ........................................................................... 170 MovingStDev (moving standard deviation) .......................... 172 MovingSum .......................................................................... 173 OLAPAvg (OLAP average) .................................................. 175 OLAPCount.......................................................................... 178 OLAPMax (OLAP maximum) ............................................... 181 OLAPMin (OLAP minimum) ................................................. 184 OLAPRank ........................................................................... 187 OLAPSum ............................................................................ 189 RunningAvg (running average) ............................................ 192 RunningCount ...................................................................... 193 RunningMax (running maximum)......................................... 194 RunningMin (running minimum)........................................... 195 RunningStDevP (running standard deviation of a population) ........................................................................... 196 RunningStDev (running standard deviation) ........................ 198 RunningSum ........................................................................ 200 Rank and NTile functions........................................................... 201 NTile .................................................................................... 202 NTileSize ............................................................................. 204 NTileValue ........................................................................... 206 NTileValueSize .................................................................... 214 Percentile ............................................................................. 216 Rank .................................................................................... 217 String functions .......................................................................... 221 Concat (concatenate) .......................................................... 222 ConcatBlank (concatenate plus blank space)...................... 223 InitCap (initial capitalization) ................................................ 224 LeftStr (left string selection) ................................................. 225 Length (length of string) ....................................................... 226 Lower (lower case)............................................................... 227 LTrim (left trim)..................................................................... 228 Position (position of substring)............................................. 229 RightStr (right string selection)............................................. 230 RTrim (right trim).................................................................. 231 SubStr (substring selection)................................................. 232 Trim...................................................................................... 233 viii
© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Contents

Upper (upper case) .............................................................. 234 3. Operators Introduction.............................................................................. 235 Arithmetic operators................................................................... 236 Minus (-)............................................................................... 236 Times (*) .............................................................................. 236 Divide (/) .............................................................................. 237 Plus (+) ................................................................................ 237 Unary minus (U-).................................................................. 238 Comparison operators ............................................................... 239 Less than (<)........................................................................ 239 Less than or equal (<=)........................................................ 239 Not equal (<>) ...................................................................... 240 Equal (=) .............................................................................. 241 Greater (>) ........................................................................... 241 Greater than or equal (>=) ................................................... 242 Begins with .......................................................................... 242 Between ............................................................................... 243 Contains............................................................................... 243 Ends with ............................................................................. 244 In .......................................................................................... 244 Like ...................................................................................... 245 Not begins with .................................................................... 246 Not between......................................................................... 246 Not contains ......................................................................... 247 Not ends with ....................................................................... 247 Not in ................................................................................... 248 Not like ................................................................................. 248 Comparison for rank operators .................................................. 249 Less than or equal enhanced (*<=) ..................................... 249 Not equal enhanced (*<>).................................................... 250 Equal enhanced (*=) ............................................................ 251 Greater than or equal enhanced (*>=) ................................. 251 Between enhanced (*Between) ........................................... 252 Not between enhanced (Not *Between)............................... 253 Logical operators ....................................................................... 254 And ...................................................................................... 254 IF.......................................................................................... 254 Not ....................................................................................... 255 Or ......................................................................................... 256

© 2011 MicroStrategy, Inc.

ix

Contents

MicroStrategy Functions Reference

4. Plug-In Package Functions

Introduction.............................................................................. 257 Data mining functions ................................................................ 258 Financial functions ..................................................................... 259 Accrint (accrued interest) ..................................................... 259 Accrintm (accrued interest at maturity) ................................ 261 Coupdaybs (coupon period, beginning to settlement) ......... 263 Coupdays (coupon period, number of days with settlement) ........................................................................... 264 Coupdaysnc (coupon period, settlement to next coupon).... 265 Coupncd (next date after settlement)................................... 266 Coupnum (coupon, number payable between settlement and maturity) ........................................................................ 268 Couppcd (coupon date, previous)........................................ 269 Cumipmt (cumulative interest paid) ..................................... 270 Cumprinc (cumulative principal paid)................................... 271 Db (fixed-declining balance (asset depreciation))................ 273 Ddb (double-declining balance (asset depreciation))........... 273 Disc (discount rate for a security) ........................................ 274 Dollarde (dollar price, converted from fraction to decimal) ............................................................................... 275 Dollarfr (dollar price, converted from decimal to fraction) .... 276 Duration ............................................................................... 276 Effect (effective annual interest rate) ................................... 278 Fv (future value)................................................................... 279 Fvschedule (future value schedule) ..................................... 279 Intrate (interest rate) ............................................................ 280 Ipmt (interest payment) ........................................................ 281 IRR (internal rate of return) .................................................. 282 Mduration (modified duration) .............................................. 283 MIRR (modified internal rate of return) ................................ 285 Nominal (nominal annual interest rate) ................................ 286 Nper (number of investment periods) .................................. 287 NPV (net present value of an investment) ........................... 287 Oddfprice (odd-first-period price) ......................................... 288 Oddfyield (odd-first-period yield).......................................... 291 Oddlprice (odd-last-period price) ......................................... 292 Oddlyield (odd-last-period yield) .......................................... 294 Pmt (payment) ..................................................................... 296 Ppmt (principal payment) ..................................................... 296 Price (price per $100 face value) ......................................... 297 Pricedisc (price, discounted)................................................ 299 Pricemat (price at maturity).................................................. 300 Pv (present value)................................................................ 302

x

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Contents

Rate (interest rate per period).............................................. 303 Received (amount received at maturity) .............................. 303 Sln (straight-line depreciation) ............................................. 305 Syd (sum of year’s digits depreciation) ................................ 305 Tbilleq (T-bill equity)............................................................. 306 Tbillprice (T-bill price)........................................................... 307 Tbillyield (T-bill yield) ........................................................... 308 Vdb (variable declining balance).......................................... 309 Yield ..................................................................................... 309 Yielddisc (yield on a discounted security) ............................ 311 Yieldmat (yield at maturity) .................................................. 312 Mathematical functions .............................................................. 313 Abs (absolute value) ............................................................ 314 Acos (arc cosine) ................................................................. 314 Acosh (arc cosine, hyperbolic)............................................. 315 Asin (arc sine) ...................................................................... 315 Asinh (arc sine, hyperbolic).................................................. 315 Atan (arc tangent) ................................................................ 316 Atan2 (arc tangent 2) ........................................................... 316 Atanh (arc tangent, hyperbolic)............................................ 317 Ceiling (ceiling value)........................................................... 317 Combine (combination)........................................................ 318 Cos (cosine)......................................................................... 319 Cosh (cosine, hyperbolic) .................................................... 319 Degrees (conversion to)....................................................... 320 Exp (exponent) .................................................................... 321 Factorial (factorial) ............................................................... 321 Floor (floor value)................................................................. 322 Int (integer) .......................................................................... 323 Ln (logarithm, natural).......................................................... 324 Log (logarithm)..................................................................... 324 Log10 (logarithm, base 10) .................................................. 325 Mod (modulus) ..................................................................... 325 Power................................................................................... 326 Quotient ............................................................................... 327 Radians (conversion to) ....................................................... 328 Randbetween (random number between two values) ......... 328 Round (round to nearest integer)......................................... 329 Round2 (round to specified precision) ................................. 329 Sin (sine).............................................................................. 330 Sinh (sine, hyperbolic) ......................................................... 331 Sqrt (square root)................................................................. 331 Tan (tangent) ....................................................................... 332
© 2011 MicroStrategy, Inc.

xi

...... 364 Kurtosis ......... .............................................................. 364 InverseTDistribution (inverse of T-distribution) ........... 334 AvgDev (average deviation)............................................................................................... 345 Forecast ..................................... 342 CritBinomial (criterion binomial) ......................................... 353 HeteroscedasticTTest and HomoscedasticTTest ................................................................. 365 LognormalDistribution ............ 344 Fisher (fisher transformation)..... 339 Confidence (confidence interval) ....................... 359 InverseChiDistribution (inverse of chi-squared distribution) ........................................................................................................................................................................................................................................................... 350 GammaDistribution ..................................................... 359 InverseFisher (inverse of the Fisher transformation) ....... 334 BetaDistribution ............... vector input) ........... hyperbolic) .............. 369 xii © 2011 MicroStrategy..... 345 FDistribution (f-probability distribution) .................. 343 ExponentialDistribution ....................................................... 358 InverseBetaDistribution (inverse of the beta distribution) ...................................... 355 HypergeometricDistribution.................................................................. 352 GrowthV (growth.................................... 341 Covariance.......... 351 Growth ........................................... 338 ChiSquareTest (chi-square test for goodness of fit) ................................................................................................................................................................... 362 InverseNormDistribution (inverse of normal cumulative distribution) ............................................ 363 InverseNormSDistribution (inverse of standard normal cumulative distribution) ..................................... 333 Trunc (truncate) ............................... 367 NegativeBinomialDistribution ................................................................. 336 ChiSquareDistribution ................................................................... 366 MeanTTest (mean T-test) ................ Inc........................................................................................................................................................ 361 InverseGammaDistribution (inverse of gamma distribution) ............................................................................................................... 362 InverseLognormalDistribution (inverse of lognormal distribution) .......................................................... 357 Intercept ..................................................................Contents MicroStrategy Functions Reference Tanh (tangent............................... 360 InverseFDistribution (inverse of F-probability distribution).................. 368 NormalDistribution (normal cumulative distribution) ........................... 348 FTest........................................ vector input)............................... 340 Correlation .. 346 ForecastV (forecast........ 335 BinomialDistribution ......... 333 Statistical functions ..................

....................................................................... xiii ............................................ 378 Trend .................................................................................................................. 428 Microsoft Access.......................................... 455 Oracle .............. two-sample for means) ................................... 379 TrendV (trend................ 380 VarTest (variance test)... 443 MySQL ............................................. vector input) .................................................................................................................................................................................................. 374 Skew ............................................... 396 Greenplum ............. 422 Informix ............................................................. 377 SteYX (standard error of estimates) ........................................................................... Inc................................ 385 Databases that a function can be evaluated on........................ 372 PoissonDistribution .................................................... 437 Microsoft SQL Server..................................... 375 Standardize.................................... 371 Permut (permutation) .......................................................... 481 Red Brick ..................................... 385 Analytical Engine support for functions..............................................................MicroStrategy Functions Reference Contents PairedTTest (paired T-test............................................. 464 PostgreSQL ............................................................................ 416 Infobright ......................... 525 © 2011 MicroStrategy........................................................................................................... 377 TDistribution............ 508 Vertica.............................................. 388 Aster nCluster ......... 376 StandardNormalDistribution (standard normal cumulative distribution) .................................................................................................................................................................................................. 383 A.......................................................................... MicroStrategy and Database Support for Functions Introduction.......................................................................................................................................................................... 374 Slope (of a linear regression)............ 452 Netezza............................................... 491 Teradata ................................................................ 382 WeibullDistribution ........................... 389 IBM DB2 ..... 373 RSquare (square of pearson product moment correlation coefficient)............................................................................................ 410 HP Neoview ................................ 516 Glossary .......... 370 Pearson (Pearson product moment correlation coefficient) ....................................................................................................... 487 Sybase .......................................................................................

...................... Inc... ................................................Contents MicroStrategy Functions Reference Index ........... 529 xiv © 2011 MicroStrategy........

Although functions are most commonly used in metric expressions. About this book xv . you have the ability to create custom expressions using a large library of functions supported by MicroStrategy. and so on. Inc.PREFACE Description of guide Functions in MicroStrategy are powerful tools used in expressions to define MicroStrategy objects and initiate complex user-selected calculations. they are also used to create filters. Wherever you can define an expression. define attribute forms. From creating basic objects to building complex reports and analyzing data. you can use a function. About this book This guide provides the following information: • • • • Details of function syntax and the components of a function formula Explanation of where functions can be used in expressions Steps to access functions from MicroStrategy Desktop Overview of the MicroStrategy engine and how Intelligence Server uses functions © 2011 MicroStrategy.

and can be read on an iPhone or iPad with the iBooks app installed. Operators Arithmetic operators. Standard Functions Basic functions. page 201 String functions. page 92 Date and time functions. page 236 xvi About this book © 2011 MicroStrategy. page 148 OLAP functions. Function categories For the purposes of this guide. page 150 Rank and NTile functions. Inc. . To download this book. or scan the QR code below using your device's camera. Additional formats This book is also available as an electronic publication in the Apple iBookstore. This information can be found in the Data Mining Services chapter of the MicroStrategy Advanced Reporting Guide. search for the book’s title in the iBookstore search bar. functions have been organized into the following categories: • Chapter 2.Preface MicroStrategy Functions Reference • • Examples of functions used in complex business scenarios Details of function support in certified databases This guide does not include information on Data Mining functions. page 118 Internal functions. page 221 • Chapter 3. page 131 NULL/Zero functions.

About this book xvii . Replace them with the first year of data in your Tutorial project. page 254 • Chapter 4. Inc. page 239 Comparison for rank operators.MicroStrategy Functions Reference Preface Comparison operators. page 313 Statistical functions. © 2011 MicroStrategy. and describe the user roles the information in this book was designed for. page 334 Function descriptions For every function identified. as well as the procedures. list prerequisites for using this book. Dates in the MicroStrategy Tutorial project are updated to reflect the current year. were created with dates that may no longer be available in the Tutorial project. each function is accompanied by an example. page 259 Mathematical functions. Plug-In Package Functions Data mining functions. as well as some usage guidelines. The sample documents and images in this guide. the description includes: • • • • • Information returned Function syntax Expression representative of the function (as applicable) Notes regarding restrictions or conditions on execution and use (as applicable) Examples of the function in reports or through simple descriptions The following sections provide the location of additional examples. The first chapter includes additional examples that involve several functions in business use cases. How to find business scenarios and examples Within this guide. page 258 Financial functions. page 249 Logical operators.

. Other examples in this book use the Analytics Modules. What’s new in this guide MicroStrategy 9. This information is found in the Basic Reporting Guide. human resources. facts. page 95).1.Preface MicroStrategy Functions Reference For examples of reporting functionality. Detailed examples of advanced reporting functionality can be found in the MicroStrategy Advanced Reporting Guide.1 Any updates to this guide were minor and not directly related to MicroStrategy 9. metadata. MicroStrategy 9.2.2. and so on. which is MicroStrategy’s sample warehouse. see the MicroStrategy Readme for that release. which include a set of precreated sample reports.2. For a list of new features in MicroStrategy 9. see the MicroStrategy Tutorial. page 217). which lets you determine how NULL values are represented in the Rank calculation.0 • Aggregation functions such as Count include an UseLookupForAttributes parameter. The Rank function includes a new NullInclude parameter. This information is found in the Advanced Reporting Guide. each from a different business area. attributes. This parameter is described with the Rank function (see Rank. Sample reports present data for analysis in such business areas as financial reporting. and customer analysis. Information about the MicroStrategy Tutorial can be found in the MicroStrategy Basic Reporting Guide.1. Inc. Additional MicroStrategy object knowledge such as custom groups. This parameter is described along with the Count function (see Count.2. and project. you should be familiar with: • • Basic MicroStrategy terminology like metrics. xviii About this book © 2011 MicroStrategy. • Prerequisites Before reading this document.

• Help: In general. page xxv. To purchase printed manuals. refer to the MicroStrategy Knowledge Base. soft cover format. Most of these manuals are also available printed in a bound.com. Who should use this guide This document is designed for any user who needs to create an expression using any of the predefined functions MicroStrategy offers.MicroStrategy Functions Reference Preface • Standard mathematical function notation. contact your MicroStrategy account executive or email documentationfeedback@microstrategy. manuals in languages other than English may contain information that is one or more releases behind. MicroStrategy manuals provide: Introductory information and concepts Examples and images Checklists and high-level procedures to get started The steps to access the manuals are described in Accessing manuals and other documentation sources. Inc. You can see the version number on the title page of each manual. © 2011 MicroStrategy. MicroStrategy help provides: Detailed steps to perform procedures Descriptions of each option on every software screen Due to translation time. Resources Documentation MicroStrategy provides both manuals and online help. For the most up-to-date translations. as described below: • Manuals: In general. Resources xix . these two information sources provide different types of information.

as well as basic maintenance guidelines. reporting. and use the MicroStrategy Mobile Suite. in a Microsoft Windows or Linux environment. and use the MicroStrategy Reporting Suite. where you perform reporting with the MicroStrategy Tutorial project and its sample business data. Provides detailed information to download. and using the MicroStrategy Evaluation Edition of the software. and HP platforms. activate. xx Resources © 2011 MicroStrategy. configure.Preface MicroStrategy Functions Reference MicroStrategy overview and evaluation • Introduction to MicroStrategy: Evaluation Guide Instructions for installing. UNIX. with the MicroStrategy Evaluation Edition Virtual Appliance. . install. configuring. Provides detailed information to download. • MicroStrategy Upgrade Guide Instructions to upgrade existing MicroStrategy products. and additional resources. • MicroStrategy Mobile Suite: Quick Start Guide Evaluate MicroStrategy Mobile as a departmental solution. This guide provides all details to download. Linux. Manuals for query. • MicroStrategy Reporting Suite: Quick Start Guide Evaluate MicroStrategy as a departmental solution. and analysis • MicroStrategy Installation and Configuration Guide Information to install and configure MicroStrategy products on Windows. step-by-step evaluation process of MicroStrategy features. This guide also includes a detailed. • Evaluate MicroStrategy for Linux Guide: In a Windows or Linux Environment with the MicroStrategy Evaluation Edition Virtual Appliance Evaluate MicroStrategy for Linux. Inc. and evaluate MicroStrategy software running in a Linux environment. • MicroStrategy Evaluation Edition Quick Start Guide Overview of the installation and evaluation process. configure. install.

• MicroStrategy OLAP Services Guide Information on MicroStrategy OLAP Services. format. advanced schemas. • MicroStrategy Report Services Document Analysis Guide: Analyzing Data with Report Services Documents Instructions for a business analyst to execute and analyze a document in MicroStrategy Desktop and MicroStrategy Web. and distribute business data. Word. and how to analyze data in a report. building on basic concepts about projects and reports presented in the MicroStrategy Basic Reporting Guide. consolidations. • MicroStrategy Basic Reporting Guide Instructions to get started with MicroStrategy Desktop and MicroStrategy Web. PowerPoint. Includes the basics for creating reports. view filters. and prompts. OLAP Services features include Intelligent Cubes. and prompts. metrics. Resources xxi . • MicroStrategy Advanced Reporting Guide: Enhancing Your Business Intelligence Application Instructions for advanced topics in the MicroStrategy system. metrics. and project optimization. dynamic aggregation. transformations. Topics include reports. filters. derived elements. and understand facts. Data Mining Services. filters. derived metrics. • MicroStrategy Report Services Document Creation Guide: Creating Boardroom Quality Documents Instructions to design and create Report Services documents. and dynamic sourcing. attributes. and Outlook. Query Builder reports. Inc. building on information in the MicroStrategy Report Services Document Analysis Guide. to analyze. • MicroStrategy Office User Guide Instructions for using MicroStrategy Office to work with MicroStrategy reports and documents in Microsoft® Excel. which is an extension of MicroStrategy Intelligence Server. © 2011 MicroStrategy. custom groups. hierarchies. Freeform SQL reports. building on information in the Basic Reporting Guide.MicroStrategy Functions Reference Preface • MicroStrategy Project Design Guide Information to create and modify MicroStrategy projects.

Inc. deploy. User Privileges. examples of functions in business scenarios. attribute forms. • MicroStrategy System Administration Guide: Tuning. filters. • MicroStrategy Functions Reference Function syntax and formula components.Preface MicroStrategy Functions Reference • MicroStrategy Mobile Analysis Guide: Analyzing Data with MicroStrategy Mobile Information and instructions for using MicroStrategy Mobile to view and analyze data. Manuals for Analytics Modules • • • xxii Resources Analytics Modules Installation and Porting Guide Customer Analysis Module Reference Sales Force Analysis Module Reference © 2011 MicroStrategy. . instructions to use functions in metrics. You can integrate data from MDX cube sources into your MicroStrategy projects and applications. as well as instructions for a designer working in MicroStrategy Desktop or MicroStrategy Web to create effective reports and documents for use with MicroStrategy Mobile. maintain. • MicroStrategy Supplemental Reference for System Administration: VLDB Properties. Monitoring. • MicroStrategy Mobile Design and Administration Guide: A Platform for Mobile Intelligence Information and instructions to install and configure MicroStrategy Mobile. and perform other business tasks with MicroStrategy reports and documents on a mobile device. Internationalization. and Troubleshooting your MicroStrategy Business Intelligence System Concepts and high-level steps to implement. • MicroStrategy MDX Cube Reporting Guide Information to integrate MicroStrategy with MDX cube sources. tune. and troubleshoot a MicroStrategy business intelligence system. and other Supplemental Information for Administrators Information and instructions for MicroStrategy administrative tasks such as configuring VLDB properties and defining data and metadata internationalization. and reference material for other administrative tasks.

Inc. which is sold as part of the MicroStrategy SDK. and embed Narrowcast Server functionality within other applications. • Narrowcast Server SDK Guide Instructions to customize Narrowcast Server functionality. Documents the Narrowcast © 2011 MicroStrategy. and troubleshoot Narrowcast Server. including details about architecture. and so on. • MicroStrategy Web SDK The Web SDK is available in the MicroStrategy Developer Library. code samples. Software Development Kits • MicroStrategy Developer Library (MSDL) Information to understand the MicroStrategy SDK. maintain. customization scenarios. • MicroStrategy Narrowcast Server System Administrator Guide Concepts and high-level steps to implement. Resources xxiii . integrate Narrowcast Server with other systems. • MicroStrategy Narrowcast Server Installation and Configuration Guide Information to install and configure Narrowcast Server. • MicroStrategy Narrowcast Server Application Designer Guide Fundamentals of designing Narrowcast Server applications. • MicroStrategy Narrowcast Server Upgrade Guide Instructions to upgrade an existing Narrowcast Server. tune. object models.MicroStrategy Functions Reference Preface • • • Financial Reporting Analysis Module Reference Sales and Distribution Analysis Module Reference Human Resources Analysis Module Reference Manuals for Narrowcast Services products • MicroStrategy Narrowcast Server Getting Started Guide Instructions to work with the tutorial to learn Narrowcast Server interfaces and features.

see the MicroStrategy Readme. and the Narrowcast Server SPI.Preface MicroStrategy Functions Reference Server Delivery Engine and Subscription Portal APIs. page xxv. Documentation for MicroStrategy Portlets • Enterprise Portal Integration Help Information to help you implement and deploy MicroStrategy BI within your enterprise portal. including specific examples for integrating with ESRI mapping services. MicroStrategy provides several ways to access help: • Help button: Use the Help button or ? (question mark) icon on most software windows to see help for that window. Inc. For supported web browsers. This resource can be accessed using the MicroStrategy Product Manuals page. as described in Accessing manuals and other documentation sources. xxiv Resources © 2011 MicroStrategy. Documentation for MicroStrategy GIS Connectors • GIS Integration Help Information to help you integrate MicroStrategy with Geospatial Information Systems (GIS). Some of the MicroStrategy help systems require a web browser to be viewed. Help Each MicroStrategy product includes an integrated help system to complement the various interfaces of the product as well as the tasks that can be accomplished using the product. as described in Accessing manuals and other documentation sources. page xxv. including instructions for installing and configuring out-of-the-box MicroStrategy Portlets for several major enterprise portal servers. . This resource can be accessed using the MicroStrategy Product Manuals page.

the Search field. If you do not have Acrobat Reader installed on your computer. A page opens in your browser showing a list of available manuals in PDF format and other documentation sources. • Accessing manuals and other documentation sources The manuals are available from your MicroStrategy disk or the machine where MicroStrategy was installed. and MicroStrategy Mobile Server. select MicroStrategy Help to see the table of contents. Inc. F1 key: Press F1 to see context-sensitive help that describes each option in the software window you are currently viewing. To access the installed manuals and other documentation sources. see the following procedures: • • To access installed manuals and other documentation sources on Windows. MicroStrategy Web Administrator. page xxvi To access installed manuals and other documentation sources on Windows 1 From the Windows Start menu. pressing the F1 key opens the context-sensitive help for the web browser you are using to access these MicroStrategy interfaces.com/reader/. page xxv To access installed manuals and other documentation sources on UNIX and Linux. MicroStrategy.MicroStrategy Functions Reference Preface • Help menu: From the Help menu or link at the top of any screen. Adobe Acrobat Reader is required to view these manuals. Use the Help menu or ? (question mark) icon to access help for these MicroStrategy interfaces. Resources xxv .adobe. choose Programs (or All Programs). The best place for all users to begin is with the MicroStrategy Basic Reporting Guide. then Product Manuals. you can download it from http://get. © 2011 MicroStrategy. For MicroStrategy Web. 2 Click the link for the desired manual or other documentation source. and the index for the help system.

This step varies slightly depending on your version of Adobe Acrobat Reader. A page opens in your browser showing a list of available manuals in PDF format and other documentation sources. To access installed manuals and other documentation sources on UNIX and Linux 1 Within your UNIX or Linux machine. Select Open this file from its current location.htm file in a web browser. navigate to the directory where you installed MicroStrategy. or $HOME/MicroStrategy/install if you do not have write access to /opt/MicroStrategy. Inc. from the View menu click Bookmarks and Page. If bookmarks are not visible on the left side of an Acrobat (PDF) manual. 5 If you click the link for the Narrowcast Services SDK Guide. The default location is /opt/MicroStrategy. This documentation resource must be downloaded. xxvi Resources © 2011 MicroStrategy. a File Download dialog box opens. 3 Open the Product_Manuals. open the Documentation folder.Preface MicroStrategy Functions Reference 3 If you click the link for the Narrowcast Services SDK Guide. This step varies slightly depending on your version of Adobe Acrobat Reader. and click OK. . Select Open this file from its current location. 2 From the MicroStrategy installation directory. 4 Click the link for the desired manual or other documentation source. and click OK. from the View menu click Bookmarks and Page. This documentation resource must be downloaded. If bookmarks are not visible on the left side of an Acrobat (PDF) manual. a File Download dialog box opens.

Example: Type cmdmgr -f scriptfile. + A keyboard command that calls for the use of more than one key (for example. Inc. indicates variable information to be replaced by the user Example: The aggregation level is the level of calculation for the metric. Education MicroStrategy Education Services provides a comprehensive curriculum and highly skilled education consultants.MicroStrategy Functions Reference Preface Documentation standards MicroStrategy online help and PDF manuals (available both online and in printed format) use standards to help you identify certain types of content. SHIFT+F1) A note icon indicates helpful information for specific situations. The following table lists these standards. For a detailed description of education offerings and course curriculums. Type bold Indicates • Button names. A warning icon alerts you to important information such as potential security risks. Resources xxvii . lists. © 2011 MicroStrategy. Many customers and partners from over 800 different organizations have benefited from MicroStrategy instruction. visit http://www. These standards may differ depending on the language of this manual. Example: Type copy c:\filename d:\foldername\filename Courier font • • • • • • Calculations Code samples Registry keys Path and file names URLs Messages displayed in the screen Example: Sum(revenue)/number of months. italic • New terms defined within the text and in the glossary • Names of other product manuals • When part of a command syntax.scp and press Enter.com/Education. some languages have rules that supersede the table below.microstrategy. these should be read before continuing. check boxes. and menus that are the focus of actions or part of a list of such GUI elements and their definitions • Text to be entered by the user Example: Click Select Warehouse. options.

Technical Support If you have questions about a specific MicroStrategy product. and Swedish. xxviii Resources © 2011 MicroStrategy. and readme files. see the MicroStrategy readme. strategic planning. performance and tuning. and more. Chinese (Simplified). French. and availability of translated interfaces and certain documentation. Offerings include complex security architecture designs. A translated user interface is available in each of the above languages. 2 Consult the MicroStrategy Knowledge Base online at https://resource. International support MicroStrategy supports several locales. Please contact MicroStrategy Technical Support for more details. Portuguese (Brazilian). Support for a locale typically includes native database and operating system support.com/support. A technical administrator in your organization may be able to help you resolve your issues immediately. Help. Spanish. visit http://www. support for date formats.com/Consulting. Korean.microstrategy. Italian. MicroStrategy is certified in homogeneous configurations (where all the components lie in the same locale) in the following languages—English (US).Preface MicroStrategy Functions Reference Consulting MicroStrategy Consulting Services provides proven methods for delivering leading-edge technology solutions.microstrategy. numeric formats. currency symbols. For information on specific languages supported by individual MicroStrategy system components. Locations to access each are described above. A translated user interface is available in each of the above languages. Inc. Danish. For a detailed description of consulting offerings. Japanese. German. Chinese (Traditional). . project and testing strategies and recommendations. you should: 1 Consult the product guides. MicroStrategy also provides limited support for heterogeneous configurations (where some of the components may lie in different locales).

Inc. and can request to change their Support Liaisons two times per year with prior written notice to MicroStrategy Technical Support. or that assume that the designated Support Liaison has a security level that permits them to fully manipulate the MicroStrategy projects and has access to potentially sensitive project data such as security filter definitions. When troubleshooting and researching issues.com/Support/Expiration. the Support Liaison may follow the steps below to ensure that issues are resolved quickly: 1 Verify that the issue is with MicroStrategy software and not a third party software.microstrategy.MicroStrategy Functions Reference Preface 3 If the resources listed in the steps above do not provide a solution. review the Policies and Procedures document in your language.asp. To ensure the most productive relationship with MicroStrategy Technical Support. Ensure issues are resolved quickly Before logging a case with MicroStrategy Technical Support. MicroStrategy Technical Support can be contacted by your company’s Support Liaison.microstrategy. Refer to the terms of your purchase agreement to determine the type of support available to you. 4 Minimize the complexity of the system or project object definition to isolate the cause. Your company may designate two employees to serve as their Support Liaisons. posted at http://www. MicroStrategy Technical Support personnel may make recommendations that require administrative privileges within MicroStrategy. © 2011 MicroStrategy. All customer inquiries and case communications must come through these named individuals. 2 Verify that the system is using a currently supported version of MicroStrategy software by checking the Product Support Expiration Schedule at http://www. A Support Liaison is a person whom your company has designated as a point-of-contact with MicroStrategy’s support personnel. contact MicroStrategy Technical Support directly. 3 Attempt to reproduce the issue and determine whether it occurs consistently. It is recommended that you designate Support Liaisons who have MicroStrategy Administrator privileges.com/Support/Policies. Resources xxix . This can eliminate security conflicts and improve case resolution time.

com Web: https://resource. and how to contact MicroStrategy Technical Support. or log a case using the Online Support Interface.Preface MicroStrategy Functions Reference 5 Determine whether the issue occurs on a local machine or on multiple machines in the customer environment.–7:00 P. Monday–Friday except holidays Email: eurosupp@microstrategy.–6:00 P.M. The individual Technical Support Centers are closed on certain public holidays.com/support Fax: +44 (0) 208 711 2525 The European Technical Support Centre is closed on national public holidays in each country. North America Email: support@microstrategy. Monday-Friday except holidays • EMEA (except UK): 9:00 A.microstrategy. Phone: • Belgium: + 32 2792 0436 • France: +33 17 099 4737 • Germany: +49 22 16501 0609 • Ireland: +353 1436 0916 • Italy: +39 023626 9668 • Poland: +48 22 321 8680 • Scandinavia & Finland: +46 8505 20421 • Spain: +34 91788 9852 • The Netherlands: +31 20 794 8425 • UK: +44 (0) 208 080 2182 • International distributors: +44 (0) 208 080 2183 Hours: • United Kingdom: 9:00 A.com Web: https://resource. Eastern Time.M.com/forum/. GMT.M. when. CET. If your Support Liaison is unable to reach MicroStrategy Technical Support by phone during the hours of operation. send email or fax.–6:00 P. they can leave a voicemail message.M. .microstrategy.M.com/support Fax: (703) 842–8709 Phone: (703) 848–8700 Hours: 9:00 A.M. Monday-Friday except holidays EMEA: Europe The Middle East Africa xxx Resources © 2011 MicroStrategy. Inc. 6 Discuss the issue with other users by posting a question about the issue on the MicroStrategy Customer Forum at https://resource. The following table shows where.microstrategy.

M.M.com Web: https://resource.microstrategy. (Buenos Aires). Korea.microstrategy. e-mail addresses) • Case details: Configuration information.–7:00 P. (São Paulo).com Web: https://resource. Resources xxxi .-6 P. (Singapore) Monday-Friday except holidays Email: latamsupport@microstrategy. .6 P.M.M. Inc. Monday-Friday except holidays • Asia Pacific (except Japan and Korea): 7 A.com/support Phone: • LATAM (except Brazil and Argentina): +54 11 5222 9360 Fax: +54 11 5222 9355 • Argentina: 0 800 444 MSTR Fax: +54 11 5222 9355 • Brazil: +55 11 3054 1010 Fax: +55 11 3044 4088 Hours: • Latin America (except Brazil): 9:00 A. Japan. JST (Tokyo).M. Required information when calling When contacting MicroStrategy Technical Support.com/support Phone: • Australia: +61 2 9333 6499 • Korea: +82 2 560 6565 Fax: +82 2 560 6555 • Japan: +81 3 3511 6720 Fax: +81 3 3511 6740 • Singapore: +65 6303 8969 Fax: +65 6303 8999 • Asia Pacific (except Australia.M. including MicroStrategy software product(s) and versions © 2011 MicroStrategy. and Singapore): +86 571 8526 8067 Fax: +86 571 8848 0977 Hours: • Japan and Korea: 9:00 A. please provide the following information: • Personal information: Name (first and last) Company and customer site (if different from company) Contact information (phone and fax numbers.M.–6:00 P.M. Monday-Friday except holidays • Brazil: 9 A. Monday–Friday except holidays Latin America Support Liaisons should contact the Technical Support Center from which they obtained their MicroStrategy software licenses or the Technical Support Center to which they have been designated.MicroStrategy Functions Reference Preface Asia Pacific Email: apsupport@microstrategy.

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 depends on the nature of the problem. not all items listed below may be necessary): Computer hardware specifications (processor speed. RAM. a database move. they should also be prepared to provide the following: • • • • Street address Phone number Fax number Email address To help the Technical Support representative resolve the problem promptly and effectively. or a software upgrade)? If there was an error message. and be ready to provide it when inquiring about an existing case Software version and product registration numbers of the MicroStrategy software products you are using Case 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. and steps taken to troubleshoot the case thus far • Business/system impact If this is the Support Liaison’s first call. a major database load. and so on) xxxii Resources • • © 2011 MicroStrategy. be prepared to provide the following additional information: • Case number: Please keep a record of the number assigned to each case logged with MicroStrategy Technical Support.Preface MicroStrategy Functions Reference Full description of the case including symptoms. . error messages(s). Inc. disk space.

com When you provide feedback to us. please include the name and version of the products you are currently using.MicroStrategy Functions Reference Preface 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 If the issue requires additional investigation or testing. Your feedback is important to us as we prepare for future releases.com Send suggestions for product enhancements to: support@microstrategy. The Support Liaison should perform any agreed-upon actions before contacting MicroStrategy Technical Support again regarding the issue. © 2011 MicroStrategy. Inc. the Support Liaison and the MicroStrategy Technical Support representative should agree on certain action items to be performed. If the Technical Support representative is responsible for an action item. Feedback xxxiii . Feedback Please send any comments or suggestions about user documentation for MicroStrategy products to: documentationfeedback@microstrategy. the Support Liaison may call MicroStrategy Technical Support at any time to inquire about the status of the issue.

Inc.Preface MicroStrategy Functions Reference xxxiv Feedback © 2011 MicroStrategy. .

page 43 How MicroStrategy processes functions. 1 . page 46 Additional examples of functions in expressions. object definitions. UNDERSTANDING FUNCTIONS IN MICROSTRATEGY Introduction This chapter provides the following information: • • • • • • The basics of MicroStrategy objects. and functions. page 2 Function syntax and formula components.1 1. page 66 © 2011 MicroStrategy. page 24 Adding functions to expressions with the Insert Function Wizard. Inc. page 4 Using functions in expressions.

and so on. application objects. (This list of objects is not exhaustive. Examples include the following: • • • Month + 5 Sum(Revenue) New York AND Los Angeles In the first example. This metric is a Microstrategy object that you can create. You want to generate a report with a five-month forecast. Your Architect. and metrics. Customer Name. One approach would begin with creating a new attribute called 5 Months Ahead. An object is a basic building block in MicroStrategy. hierarchies. Many objects require you to specify an expression when creating or modifying them. the expression Sum(Revenue) is used to define a relatively simple metric. In the second example above. and functions To understand functions and their role in MicroStrategy. will create attributes by mapping conceptual data from your data warehouse to names like Month. and custom groups. . February is 2. and configuration objects include project sources. it is important to grasp the basic concepts underlying objects and expressions. Schema objects include facts. Inc. 2 The basics of MicroStrategy objects. and configuration objects. and users. where January is 1. application objects include reports. object definitions.) Microstrategy objects are created. using the expression Month + 5 in its attribute definition. Expressions can be used in many places. Metrics in particular often require complicated expressions. database instances. or Product Category that will appear on your reports. each Month element in your data warehouse is assigned a numeric ID between 1 and 12. Your Designer will create metrics that access and manipulate numeric data from your data warehouse. maintained and deleted by you. There are three types of objects: schema objects.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference The basics of MicroStrategy objects. for instance. object definitions. and functions © 2011 MicroStrategy. “Sum” tells Microstrategy to read individual Revenue entries from the data warehouse and add them together to produce one single number that will be displayed as Revenue on your report. documents. An expression is any combination of characters that can be used as a result.

and transformations. In this book. consolidation elements. From creating basic objects to building complex reports and analyzing data. /. object definitions. filters. Functions in MicroStrategy are powerful tools used to define MicroStrategy objects (when they are integrated into object definitions) and initiate complex user-selected calculations. all of which are MicroStrategy objects. they are also used to define attribute forms. Wherever you use an expression. The example Sum(Profit) in a metric definition uses the Sum function to add various Profit entries in a data warehouse to arrive at one final number to display on a report.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 The last example above shows a logical expression. Although functions are most commonly used in metric expressions. Inc. which are the basic building blocks of all MicroStrategy content and functionality. +. you can create custom expressions using a large library of functions that come with and are supported by MicroStrategy. which might be used in a filter. The basics of MicroStrategy objects. *) • Abs • Round • Ln • Cos • Avg • Count • Sum MicroStrategy Objects That Can Use These Functions • • • • • • • Attribute form Consolidation Custom group Fact Metric Subtotal Transformation Group-value • Metric • Subtotal © 2011 MicroStrategy. and the MicroStrategy objects that can be created using those functions. Objects that rely on these expressions are often edited by changing the object expressions. Function type Single-value Function Examples • Arithmetic operators (–. facts. A filter comprised of the expression New York AND Los Angeles would let a user answer questions such as “Which business travelers flew out of New York and out of Los Angeles in 2006?” Expressions often form the basis of objects. subtotals. the terms “object expression” and “object definition” are interchangeable unless otherwise noted. you can use a function. custom groups. To create an expression that accomplishes your goal. and functions 3 . several functions belonging to each type. you will almost always utilize a Microstrategy function. Functions commonly used to create specific objects The following table lists the function types described above.

The use of each function is described in detail in the rest of this book. Arguments provide the inputs to functions In this guide. This section covers the basics of functions and their key components. metric. Although an expression can have unique characteristics. Function parameters are used to fine-tune the behavior of functions. there is a basic syntax for applying functions in expressions. . and the function’s behavior is often further specified using one or more parameters. attribute. Each function is designated by a function name.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Function type OLAP Function Examples • Rank • MovingMin • NTile • And • Or • Between • ApplyComparison • • • • • ApplySimple ApplyAgg ApplyOLAP ApplyLogic ApplyComparison MicroStrategy Objects That Can Use These Functions Metric Logical Comparison Apply Filter Filter • • • • • • • Attribute form Consolidation Custom group Fact Metric Transformation Filter Function syntax and formula components You can use functions in any situations where you build an expression. 4 Function syntax and formula components © 2011 MicroStrategy. as well as their parameters and arguments. or constant. This section provides information on function types. Inc. MicroStrategy functions are grouped into function types. Functions operate on an argument that can be a fact.

and Not. HomoscedasticTTest. OLAP functions (also known as Relative functions): These functions take multiple elements from a list and return a new list of elements. Examples of this category are Avg. page 6. or compare a list to a threshold value. AvgDev. ApplyComparison. Logical functions: These functions provide basic comparisons and return TRUE or FALSE values based on the evaluation of the formula. *. Inc. and so on. ApplyAgg. see Group-value functions. Ddb. NTile. For details. ApplySimple. and so on. Examples include Rank. RunningSum. and so on. Each of the functions in this category substitutes for one of the function types mentioned above and can be used wherever that type is • • • • • © 2011 MicroStrategy.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 This guide does not include information on Data Mining functions. StDev. For details. ApplyOLAP. This information can be found in the Data Mining Services chapter of the MicroStrategy Advanced Reporting Guide. and so on. Slope. page 10. For details. Count. Ln. see Comparison functions. Group-value functions (also known as Grouping or Aggregate functions): These functions take one or more lists of values as input and generate a single output value for each list. Comparison functions: These functions compare single values or lists of values. and the relative positions of elements within the list determines how computation is performed. page 8. Abs. -. see Logical functions. Greater than(>). Truncate. For details. /). Sum. Examples of this category are simple mathematical operators (+. Round. resulting in an output element for each component. Correlation. MovingAvg. page 9. Apply functions: These functions provide access to functions and syntactic constructs that are not standard in MicroStrategy but are offered by various relational database management system (RDBMS) platforms. Cos. see OLAP (Relative) functions. Less than (<). page 11. For details. Like. Each element is related to and dependent on one or more other elements in the list. This type of function includes And. Function types MicroStrategy functions are classified into the following types: • Single-value functions (also known as Non-grouping or Scalar functions): These functions operate on each individual component of an input variable or argument. see Single-value functions. Or. Examples of this category are Between. Intercept. Function syntax and formula components 5 . Accrint.

consolidation elements. using a single-value function that operates on four arguments. metrics. A simple example using numbers follows: Using the single-value “+” (addition) function. and C each contain one component. ApplySimple can be used wherever a single-value function is used. They 6 Function syntax and formula components © 2011 MicroStrategy. More generally. and multiplication operators (–. Rather. Cos. Inc. see Apply (Pass-through) functions. In other words. attribute forms. division. given variables D and E used as arguments in the addition function. whose value is 3) In the example above.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference used. Single-value functions can be used to create facts. ApplySimple. the basic requirement for a function to be categorized as single-value is that the number of output components equals the number of input components of the arguments. containing a single output component. resulting in an output component for each set of input components. Transforming a fact and creating a compound metric are similar in that both use a single-value function to turn one or more lists of values into another list of values. and transformations. For example. and so on. returns five components. Trunc. B. D+E results in a five-component list. addition. Other examples include Abs. Round. /. A+B=C Where • • • A=1 (an argument containing one component whose value is 1) B=2 (an argument containing a single component whose value is 2) C=3 (the returned value. Sin. Ln. where D and E each contain a five-component list. *) are common examples of single-value functions. . For example. where each argument is composed of a five-component list. Subtraction. A. Single-value functions A single-value function operates on each individual component of one or more arguments. The following two examples illustrate the use of single-value functions in the creation of a transformed fact and a compound metric. +. page 11. For details. Single-value functions need not take a single value as an argument or even a single argument. the number of output components is equal to the number of input components in each argument.

see Abs (absolute value). resulting in a single value for the metric. In both of the previous examples.2. Microstrategy uses the list of values for the two input variables Revenue and Cost to generate. while in a compound metric the single-value function is applied after the group-value function. The next section addresses group-value functions in more detail.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 differ in that.08. page 94. -7.5. 2. Once the single-value function has been applied. For more information on the Abs and Avg functions. The two resulting variables are stored as intermediate results. 80. 7. page 314 and Avg (average). for a transformation. see Abs (absolute value). Inc. Function syntax and formula components 7 . is applied to produce an average of those values. For more information on the Abs and Avg functions. Example 1: Transformed fact Avg(Abs([Account Transactions])) Suppose Account Transactions is a list of the following values: -300. page 94. © 2011 MicroStrategy. both single-value and group-value functions were used. the group-value function. the single-value function must be applied before a group-value function. The single-value function.Avg(Cost){Quarter} In this example.5. the single-value function “-” (subtraction) is applied by Microstrategy to subtract one intermediate result from the other. 900. page 314 and Avg (average). Absolute. two new variables each containing a single value. Avg. It is important to note that the single-value function returns five elements of output for five elements of input. Example 2: Compound metric Avg(Revenue){Quarter} . 900. -80.7. the group-value function Avg is applied to both the Revenue and Cost facts in your data warehouse. First. Next.2. using the Avg function twice.7. is applied to the list. The result set is the absolute value of each element in the list: 300. and 2. 258.

IRR. nested metrics. ApplyAgg. The following examples illustrate their use. For more information. Median. the function reduces the seven elements of the input value to a single output value of 35. 47. see Median. which is a list of the following elements: 27. page 105. . 8 Function syntax and formula components © 2011 MicroStrategy. Var. Min. Stdev. and compound metrics. Inc. Example 2: Median Median([Employee Age]) The only difference between Example 2 and Example 1 above is the fact that the group-value function. Last. and so on. 30. The existence of a GROUP BY clause in a SQL statement indicates that you are using a group-value function. as well as in the calculation of subtotals. 40. (For more information on the Sort By parameter. 43. see Avg (average). see BreakBy and SortBy parameters. Count. page 18). page 94. First.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Group-value functions A group-value function takes one or more lists of values as input and returns a single output value for each list. Sort by specifies the order that the values returned by an expression will appear on a report. The function reduces the seven elements of the input value to a single output value of 36. 35. 32. see Parameters. Again. is used.) Group-value functions can be used to create simple metrics. the group-value function Avg operates on the argument Employee Age. Example 1: Average Avg([Employee Age]) In this example. and NPV functions also belong to this category. The most common group-value functions include Avg. Median. Sum. page 19. but they have an additional sort by feature (for more information. For more information on the Avg function. instead of Avg. Max.

though. Unlike group-value functions. all the functions with Running as the prefix (for example. RunningSum. MovingStdev. Unlike single-value functions. page 18). Rank. the computation depends upon the conditions set by the BreakBy parameter that defines when the calculation restarts and the SortBy parameter that defines how the list of values is sorted (see Parameters. all the functions with Moving as the prefix of the name (for example. when the next Customer Region is encountered. ApplyOLAP also belongs to the OLAP category. Examples of OLAP functions include RunningStdevP. To break by an attribute or hierarchy means to restart calculations that use OLAP. (Notice in the figure below that the Total Revenue and the Running Sum for Arizona are equal because the calculation for RunningSum © 2011 MicroStrategy. NTile. To break by an attribute or hierarchy in an expression. Inc.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 OLAP (Relative) functions Online Analytical Processing (OLAP) functions are also referred to as Relative functions because each element in a list of values is related to and dependent on one or more other elements in the list. RunningCount. The RunningSum metric computes the sum of the revenue for each Customer Region by adding the revenue for each Customer State to the revenue of the Customer States in the rows above it and displaying the incremented total. Example: RunningSum RunningSum <BreakBy={[Customer Region]}. and the positions of the elements within the list determine how computation is performed. you set the BreakBy parameter. Function syntax and formula components 9 . OLAP functions include Rank. An OLAP function takes multiple elements from a list and returns a new list of elements. OLAP functions are only used in the creation of metrics. MovingMin. the number of elements in the input list and the number of elements in the output list remains the same. The following is an example. The BreakBy Customer Region condition causes calculations to begins again. and so on). functions when the analytical engine reaches the next instance of the specified attribute or hierarchy. and NTileValueSize). SortBy= ([Customer State]) >(Revenue) BreakBy refers to the attribute or hierarchy where calculations for an OLAP function restart. or Relative. and so on). RunningAvg. however. NTileSize. and various expressions that calculate percent values. MovingDifference. and all the NTile functions (such as NTile. NTileValue.

Contains. a different Customer Region than Wyoming. the previous Customer State on the report. which limit report data to a subset based on your need. > (greater than).) Because of the SortBy Customer State condition. ApplyComparision. Inc. or compare a list to a threshold value. . Between. as shown in the report excerpt below. Using these functions. 10 Function syntax and formula components © 2011 MicroStrategy. Ends with.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference has restarted. the filter limits the states in your yearly income report to those with accrued revenue greater than $500. Comparison functions Comparison functions allow you to compare values. Comparison operators include < (less than). and so on. They are only used to create filters.000. the Customer States are listed in ascending (alphabetical) order. = (is equal to). Example: > (Greater than) Revenue > “500000” In this example. since Arizona is categorized in Southwest. you can compare single values or lists of values.

For numeric values. Function syntax and formula components 11 .MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Logical functions Logical functions provide basic comparisons and return TRUE or FALSE values based on the evaluation of the formula.) RDBMS functions.. There are five predefined Apply functions that can be used to replace regular or predefined functions of the same type. They both denote functions in Microstrategy that provide access to functions or syntactic constructs that are not standard in Microstrategy but are provided by various Relational Database Management System (RDBMS) platforms. arithmetic) operators can be used. Example: And ((Revenue . That syntax is beyond the scope of this book and will vary from RDBMS to RDBMS. all of which can only be used to build filters where criteria are provided for the inclusion and exclusion of data from a report display or metric calculation. Apply (Pass-through) functions The terms Apply functions and Pass-through functions are interchangeable. Inc. 0 is treated as FALSE. can answer questions such as “Which of our regions produced revenue that exceeded a ‘success’ threshold?” Logical operators include And. The functions are as follows: • ApplySimple: These functions are used where simple (e.g.000 and the Sell-through Percentage is greater than 25%. and 1 is treated as TRUE. since they always bypass Microstrategy’s parsers and validators. while necessary. Not. this filter limits report data to those states where Profit (defined as Revenue . The name “Pass-through” derives from the fact that Microstrategy passes information to a database which then uses its own functions.Cost) is greater than $50. and ApplyLogic. These functions provide a means to combine data evaluations and comparison operators into complex expressions. These expressions. © 2011 MicroStrategy.Cost) > 50000) And [Sell-through Percentage] > 25 Built for the attribute State. in turn. (Using the native functionality of your RDBMS via Pass-through functions requires that you know the syntax of your particular RDBMS. Or. must be used with care.

>. Inc. because using RDBMS functions effectively bypasses the validations and other benefits of MicroStrategy products. ApplyRelative: These functions are used where Online Analytical Processing (OLAP) functions (e.g. Rank) can be used. and Term Date (as well as Revenue). . Like and In) can be used. as shown below: Item Blouse Jeans Gloves Leather Shoes Winter Hat Winter Boots Effec Date 06/01/2007 05/30/2007 10/01/2007 06/15/2007 11/01/2007 12/01/2007 Term Date 07/30/2007 06/17/2007 10/25/2007 06/22/2007 11/08/2007 12/15/2007 Revenue 1000 500 150 750 900 2200 Each row in the table corresponds to an item that was on sale during the time between Effec Date and Term Date. and NOT) can be used. OR. Example: ApplyComparison used to check a prompted date In this example. a table in your data warehouse contains the columns Item. Using Apply functions is recommended only when corresponding functionality does not exist in the MicroStrategy product.. Microstrategy encourages you to submit an enhancement request for inclusion of the desired feature in a future product release. With Apply functions. When you need to use an Apply function.g. Sum) can be used.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference • • • • ApplyAgg: These functions are used where aggregate functions (e. Your objective is to generate a report that lists all items (and an associated metric that you choose) that were on 12 Function syntax and formula components © 2011 MicroStrategy. ApplyComparison: These functions are used where comparison operators (e.. AND. =...g. Filter and Metric editors to utilize RDBMS functions that are not provided by Microstrategy.g. MicroStrategy strongly advises against using Apply functions when standard Microstrategy functions can be used to achieve the same goal. ApplyLogic: These functions are used where logical operators (e. Effec Date. project designers can customize expressions in the Attribute.

In effect. the attribute Effec Date. In this case. MicroStrategy returns an error when the report is executed.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 sale on a particular date your user chooses at run time. you must know the syntax of the corresponding function or operation in the RDBMS you are using. because the latter does not offer the validating features that MicroStrategy does. create a report filter using the Custom expression box located in the Advanced Qualification pane of the Filter Editor. first create a value prompt named Test Date that allows the user to input a date. Inc. (See Value Prompts in the Advanced Prompts chapter of the Microstrategy Advanced Reporting Guide for more information on creating date prompts. you have a “type mismatch” problem. (To use Apply functions.) Even though the filter is validated when you click Validate. you would have used it instead of an RDBMS function. while MicroStrategy is expecting to compare an attribute to the attributes Effec Date and Term Date. To generate this report. If an appropriate MicroStrategy function existed. (See also the Advanced Filters chapter of the Microstrategy Advanced Reporting Guide for more information on Custom expressions. The error results from the fact that you are supplying the SQL engine with two attributes and a value prompt. using that prompt. where n is a positive integer © 2011 MicroStrategy. and the attribute Term Date.) To test the date prompt. you can use an Apply function. It is important to remember that you have chosen to use an Apply function only because MicroStrategy does not have a built-in function to accomplish your task.) Next. All three of these values are passed to the database using placeholders in the form of #n. Function syntax and formula components 13 . Instead of having MicroStrategy test the date value prompt. you instruct your database to perform the test. use a custom expression to pass three values to the database for comparison: the value prompt Test Date. as shown below.

with the specific forms of the passed attributes specified by the characters after the “@” sign. The outer portion of the expression contains the Microstrategy function ApplyComparison. indicating that they (and only they) were on sale on 06/16/07. Blouse. respectively. Inc. [Effec Date]@ID specifies that Microstrategy pass the ID form of the Effec Attribute instead of the DESC or any other form that may exist in the database. At run time. Whenever 06/16/07 falls between Effec Date and Term Date on a particular row. The Custom expression in the Advanced Qualification pane of the Filter Editor depicted below shows the syntax needed for this example: Notice that the syntax is nested. and Term Date. which is contained within double quotes. Code that is passed to the database using an Apply function is always enclosed in quotes.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference that increases by 1 for each successive item being passed. the item on that row is returned in the result set. the RDBMS reads the table row by row to see if the date falls between Effec Date and Term Date. #0. #1. Effec Date. In this example. (You can verify this result by looking at the data warehouse table shown in the beginning of this section. and the arguments that are passed with that code are written as placeholders in the form of #n. The first value passed is referred to as #0. Jeans. the second is #1. . 14 Function syntax and formula components © 2011 MicroStrategy. The inner portion of the syntax. and Leather Shoes are returned. and so on. starting with 0. the third #2. is the database operation #0 between #1 and #2. so that the database effectively receives the following syntax: Test Date between Effec Date and TermDate If the user chooses 06/16/07 as the value of Test Date at run time. as well as the Microstrategy prompt Test Date and the attributes Effec Date and Term Date.) If your report is set up with Item as a row attribute. and #2 are replaced by Test Date. In this example. those three items appear on your report.

The first datepart function extracts the year (as directed by yy) from the ID attribute form of the Hire Date attribute. they are compared with the = operator. If the year of a particular Hire Date element is the same as the year of the system date. [Hire Date]@ID) Each piece of the custom expression is explained below. #0. • • • © 2011 MicroStrategy. Your RDBMS extracts the year from both the Hire Date and the system date. • The datepart function extracts a specified part of a given date.) The second datepart function extracts the year (as instructed by yy) from the current. page 135. Function syntax and formula components 15 . The container that hands the necessary function to your RDBMS is an Apply function. The following custom expression uses the ApplySimple function to test whether the year of Hire Date is the same as the current year: ApplySimple ( "datepart(yy. page 11. More detailed information on Apply functions in general can be found in Apply (Pass-through) functions. [Hire Date]@ID) = ApplySimple ( "datepart(yy. the custom expression statement evaluates as true and that Hire Date attribute element is returned in the result set of your report. or system. The placeholder. specifically. (Apply functions use your database’s computational capabilities instead of those of MicroStrategy. ApplySimple. see Apply (Pass-Through) functions. getdate())". #0)".MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 For additional information about Apply functions. ApplySimple acts as an interface between you and the database. The system date is obtained via the RDBMS function getdate(). page 132. and when the RDBMS returns both year values. More information on ApplySimple functions. If the year of a particular Hire Date element is different than the year of the system date. The syntax of each Apply function as well as examples appear in the sections that immediately follow. Example: Test whether Hire Date is in the current year Your HR department requires a list of employees that have been hired during the current calendar year. stands for the argument [Hire Date]@ID that is passed to your RDBMS. date. Inc. In other words. is found in ApplySimple. with MicroStrategy passing information to it. The ID attribute form—as opposed to the DESC or any other attribute form—is specified by @ID.

Any time you type an attribute whose name contains one or more spaces. the attribute must be enclosed in square brackets. Any time you type an attribute whose name contains one or more spaces. this example uses an ApplyComparison function to demonstrate Apply functionality within the custom expression. see the Attribute-to-attribute qualifications section of the Advanced Filters chapter of the Advanced Reporting Guide. while [Call Center]@DESC sets the second argument passed to your RDBMS as the description form of the Call Center attribute. (The use of brackets around compound object names is standard for many • 16 Function syntax and formula components © 2011 MicroStrategy. Example: Customer City = Call Center using ApplyComparison You need a list of customers who live in the same city as one of your call centers. with the second argument. [Customer City]@DESC. and that Hire Date attribute element is filtered out of the report.) The custom expression used here evaluates whether one attribute is exactly the same as another: ApplyComparison (“#0 like #1”. Remember that this comparison is done by your RDBMS—not by MicroStrategy. #1. Inc. . The attribute Hire Date is enclosed in brackets. [Call Center]@DESC) Each piece of the custom expression is explained below: • • The ApplyComparison function is used with RDBMS comparison operators. While it is possible to generate this report with a custom expression that does not use an Apply function. (For steps to create this report without the use of an Apply function. #0. the attribute must be enclosed in brackets. The next example uses ApplyComparison. The attributes Customer City and Call Center are enclosed in brackets. comparing the first argument. ApplySimple.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference the custom expression statement evaluates as false. (The use of brackets around compound object names is standard for many objects in MicroStrategy and is not restricted to custom expressions and Apply functions.) The above example used an Apply function. [Customer City]@DESC sets the first argument passed to your RDBMS as the description form of the Customer City attribute. #0 like #1 is the actual comparison. such as the like operator used in this example.

and Call Center attributes yields the results below. they are separated by commas.) Placing a filter that uses the custom expression above on a report that lists the Customer City. can have parameters. which displays up to three tabs—Parameters. Also.) Notice that the custom expression qualification filter accomplished the goal of returning only data that satisfies the criterion that the Customer City attribute is the same as the Call Center attribute. whether standard or user-defined. the Revenue metric has been added. If more than one parameter is used. (Only a portion of the report is shown. which are contained within angle brackets <> in an expression. Function syntax and formula components 17 . and Sort By. About function parameters Parameters determine how functions perform calculations. Inc.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 objects in MicroStrategy and is not restricted to custom expressions and Apply functions. Function parameter notations are only displayed in the Desktop interface if the parameter settings are changed from the default and you have set your View option to Show Function Parameters. You define parameters in the Function Name Parameters dialog box. Customer. Any function. Break By. For steps on how to access this dialog box and how to set function parameters with the © 2011 MicroStrategy.

In general. such as BreakBy and SortBy. If a function has additional parameters. see Accessing and modifying function parameters. NULL: is a TRUE/FALSE parameter that determines if the NULL value can be used in the calculation. and therefore they are not always displayed. The following subsections discuss the three tabs in more detail.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Insert Function Wizard. page 20. Since every function object has parameters. the Parameters tab is always displayed. 18 Function syntax and formula components © 2011 MicroStrategy. . Fact ID: forces the calculation to take place on a fact table containing the Fact_ID. Not all these settings apply to every function in the user interface. all group-value functions display the FactID Parameter setting. Inc. Parameters There are three standard Parameter settings for a function object: • • • Distinct: is a TRUE/FALSE parameter that allows you to use all values or only the unique values in the calculation. The parameters specific to each function are listed with the function description in chapters 2 and 3 of this book. the related tabs are displayed accordingly. OLAP functions do not have any of these Parameter settings. but they may have BreakBy and/or SortBy parameters (discussed later).

A sort by includes whether to sort in ascending or descending order. and NPV) are also defined by the SortBy parameter. each of which has its own individual settings. A few group-value functions (First. Given the same input argument(s). Sort by may also be performed on the value of the subexpression. Last. and which metadata object to sort by. To break by an attribute or hierarchy means to restart counting values for expressions that use relative functions. Inc. many functions have BreakBy and/or SortBy parameters. The break by level must be greater than or equal to the level of aggregation for the expression itself. the same function with different parameter settings yields different outputs. Function syntax and formula components 19 . and expressions that calculate rank or percent values. NTile. Examples of relative functions are RunningStdevP. page 41). • Good examples can be found in the OLAP functions: Rank has a BreakBy parameter. SortBy: order of the return values of an expression in relation to the order of the value or metadata object given. and MovingAvg has a SortBy parameter. IRR. © 2011 MicroStrategy. Two parameters than can affect the output of a function are: • BreakBy: logical level where the calculation of values for an expression restarts. The First and Last functions are used effectively to calculate subtotals (see Subtotal expressions.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 The following table shows which setting is displayed for which function(s) on the Parameters tab in the Function Name Parameters dialog box: Parameter Distinct Functions Max Min Avg Stdev Variance FactID NULL All group-value functions Count BreakBy and SortBy parameters In addition to the Parameters settings. which is the input argument. Rank.

• To access and modify function parameters with the Insert Function Wizard 1 Open an object editor for a MicroStrategy object that can include functions in its expression. 20 Function syntax and formula components © 2011 MicroStrategy. page 43. If the SortBy parameters of the function are not set to sort by Day. Function Name Parameters dialog box: This interface is used to modify the parameters of a function that has been added to an object expression and validated. Creating a user-defined subtotal that uses the Last function provides the last day inventory subtotal. Accessing and modifying function parameters MicroStrategy Desktop provides different methods for accessing and modifying function parameters. Inc. page 24 below that discusses the different types of expressions in MicroStrategy. the function may not provide the correct answer. You can access and modify function parameters from the following interfaces: • Insert Function Wizard: This interface is used to help guide you in the initial inclusion of a function in an expression for a MicroStrategy object. The report subtotals are the last day’s inventory. For steps to access the Insert Function Wizard from the different object editors. refer to the MicroStrategy online help and search for “Steps to access the Insert Function Wizard”. You can also refer to the section Using functions in expressions. attributes. and transformations. For more information. The Insert Function Wizard can be used to build a function and add it to an expression for metrics. facts.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference For example. subtotals. . see Adding functions to expressions with the Insert Function Wizard. an inventory report lists the on-hand supply for each day.

Each page allows you to modify different function parameters. Inc. Function syntax and formula components 21 . page 25 Attribute form expressions. The Insert Function Wizard opens. The pages you see depend on the function you select. page 36 Fact expressions. For more information. page 40 © 2011 MicroStrategy. see the following sections: • • • • • Metric expressions. page 38 Filter expressions.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 2 Click the Insert Function button. 3 Use the Next and Back buttons to step through the pages of the Insert Function Wizard. page 32 Custom Group expressions. To access and modify function parameters with the Function Name Parameters dialog box This functionality is available in any editor in Desktop where functions are used in expressions. labeled as f(x) on the expression toolbar.

for example RunningSum. . as demonstrated in the image below.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference • • Subtotal expressions. You can also insert a function using the Insert Function Wizard (see the procedure To build an expression using the Insert Function Wizard. page 41 Transformation expressions. page 44). You can insert a function by writing the name of the function and all required parameters into the expression. Inc. 2 Highlight the function name. 3 Right-click the function name and select function name parameters. page 42 1 Insert a function into an object expression and validate the expression. within a validated expression in the expression box. 22 Function syntax and formula components © 2011 MicroStrategy.

sorted by region in ascending order. For another RunningSum example and its report. Inc. see OLAP (Relative) functions. and settings editable. © 2011 MicroStrategy.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 The Function Name Parameters dialog box opens. Function syntax and formula components 23 . Example 1: Distinct parameter Count<Distinct=True>(Order) In this metric. Examples of function parameter effects The following examples briefly illustrate the impact of parameters on function execution. from this dialog. This example uses the RunningSum function. you modify the default parameter setting to Distinct=True and retrieve a count of only the unique Orders. page 9. Example 2: RunningSum RunningSum<BreakBy={Quarter}. SortBy=(Region)>(Revenue) This metric is defined to display the running sum of revenue on a quarterly basis. All parameter tabs for the selected function are available.

and Sell-through Percentage. In function syntax. For an in-depth discussion of attributes. facts. Arguments in MicroStrategy are most often references to lists of values. and metrics. Profit Margin. some common examples of attributes are Year. Examples of metrics include Percent Growth. Facts: Facts are the most commonly used input for metrics. Examples of columns include TOT_DOLLAR_SALES. The expressions for these objects define how column data is retrieved from the warehouse. the arguments are enclosed in parentheses (). Inc. and Region. Examples of facts include Units Sold. They are included in reports to define the level of detail.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference About arguments Arguments are the input data used in the calculation of a function. Metrics: Metrics represent calculations performed on data and can themselves be used as input for further calculation by a function. . They are used to create: • • • Metric expressions Attribute form expressions Consolidation expressions 24 Using functions in expressions © 2011 MicroStrategy. or logical values (such as TRUE or FALSE) as well as constants (such as NULL). in a MicroStrategy environment the input could comprise one or more of the following objects: • Attributes: Attributes are most often used to group fact data. • • • Using functions in expressions Functions are the basis for many MicroStrategy objects. it is also contained in brackets [ ]. Depending on the function selected and the object being created. refer to the MicroStrategy Advanced Reporting Guide. Columns: Column data is used when creating attribute form expressions and fact expressions. and the object name is alphanumeric or contains multiple words. They are numerical lists obtained from specific columns in a fact table. They can be lists of values or variables referencing lists of values. text. TOT_COST and CUST_CITY_ID. and Discount. Typically non-numeric. Category. Units Received. Arguments can be numbers. If the argument is a reference to a MicroStrategy object.

• Formula: is the most important part of a metric definition. Inc. While all metrics have a formula. and non-group functions. After deciding on the target (the attribute). In SQL. refer to the MicroStrategy Advanced Reporting Guide. the formula becomes part of the SELECT clause of the SQL command. Metric expressions Metrics are MicroStrategy objects that represent calculations performed on data. which can contain arithmetic operators. All metrics. see Base Formulas in the MicroStrategy Advanced Reporting Guide. Other optional components of a metric include condition (filter) and transformation. attributes. facts. not all of them have dimensionality. It is a mathematical expression using one or more functions. Formula and dimensionality are the two important components in a metric. or metrics). This type of formula is called a base formula. For the purposes of this book. You can use the same formula in multiple metric definitions. © 2011 MicroStrategy. by default. applied to the data to be used in the calculation (facts. • Dimensionality: determines the attribute level at which a metric is calculated.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 • • • • • Custom group expressions Fact expressions Filter expressions Subtotal expressions Transformation expressions This section explores the various roles of functions for each type of object and how to access the expression builder in each case. in dimensionality you can further define filtering and grouping involved in the metric. Using functions in expressions 25 . A base formula does not have dimensionality (see below). we only discuss formula and dimensionality related to the use of functions. For more information. constants. You can define metrics by using the available functions to analyze your data and determine business measures. For information on all metric components. attributes. calculate at the report level. group functions.

In other words. For example. the OLAP functions always yield compound metrics. however. While the single-value and group-value functions are used to create both simple and compound metrics under different circumstances (see examples to follow). where you can click the Subtotals/Aggregation tab and check if the Allow Smart Totals option is enabled. due to their unique characteristics (see OLAP (Relative) functions.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference There are two types of metrics: • Simple metric: has a formula and dimensionality (level). Inc. A quick way to check whether a metric is simple or compound is through the Metric Editor. Sum(Revenue Cost){~+}. . a compound metric is made of more than one complete metric. Any metric that is not a simple metric is a compound metric by default. A compound metric cannot have dimensionality placed on the entire metric. then it is a compound metric. such as Sum or Avg. are themselves metrics. A simple metric must use at least one group-value function. for example. It can also contain a non-group function or arithmetic operator. it is a simple metric. See the Filter Expressions subsection for details. in addition to the required group function. through the use of functions. the outermost formula must be a group function. It can stand alone or be used as a building block for a compound metric. If it is. if not. Compound metric: is a combination of expressions that. all arithmetic functions that are used as the root to connect two metrics yield compound metrics. The following three types of functions can be used to build simple and compound metrics: • • • Single-value functions Group-value functions OLAP functions The optional condition (filter) component of a metric can contain logical and comparison operators. page 9). although dimensionality can be set separately on each of its component metrics. • 26 Using functions in expressions © 2011 MicroStrategy.

all metrics have a formula.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Examples of dimensionality in metrics As mentioned previously. yield simple metrics. Together they make up the base formula. but not all metrics have dimensionality. © 2011 MicroStrategy. the numbers are calculated to reflect monthly sales data. which is indicated by {~+}. Using functions in expressions 27 . Example 1: Simple metric with dimensionality at the report level Avg(Revenue) {~+} In this example. This simple aggregation metric has dimensionality. meaning that the metric is calculated at the lowest level on the report. which. For example. as well as formula and dimensionality. the fact Revenue. the root of the expression is Avg. Inc. when used alone. and it has one child. if a report contains revenue by year and month. The following examples and diagrams illustrate the formation of simple and compound metrics. All group-value functions are aggregation functions.

1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Example 2: Simple metric with dimensionality at Year level Sum(Cost) {~ +. indicated by {Year +}. and the child is the fact Cost. the numbers are calculated to reflect yearly cost data. This means that if a report contains cost by year and month. unlike in Example 1. Together they make up the base formula. This simple aggregation metric has dimensionality.year +} In this example. dimensionality is set at the level of the attribute Year. Example 3: Compound metric without dimensionality of its own Avg(Revenue){~ +}/ Sum(Revenue) {~ +} 28 Using functions in expressions © 2011 MicroStrategy. Inc. However. . the root of the expression is Sum.

and each of which has its own dimensionality. The metric as a whole has its own dimensionality and is a simple metric. both of which are simple metrics themselves. Avg(Revenue) and Sum(Revenue). Example 4: Simple metric with dimensionality of its own (Avg(Revenue)/Sum(Revenue)) {~+} In this example.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 In this example. © 2011 MicroStrategy. Inc. then the result will be the same as in Example 3. If the two base formulas are replaced by two metrics. Using functions in expressions 29 . two base formulas are involved by the division (/) function. The whole expression itself is a compound metric because it uses two metrics and does not have its own dimensionality. a compound metric without dimensionality of its own. Notice that neither of the base formulas has dimensionality of its own. the root Division (/) has two children. The aggregation takes place at the root level instead of its children’s level.

The metric itself does not have dimensionality and is a compound metric. the root is the Case function that has three children: the Greater Than function (>). The Greater Than function has two children of its own. use the Input Metric Formula dialog box from within the report. which is a metric based on the existing data in a report. and Metric 2. 4. Accessing metric functions You can access functions to create metrics in several ways. Inc.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Example 5: Compound metric without dimensionality of its own Case((Avg(Cost) {~+})>(Sum(Revenue){~+}). For more information on the Case function. Metric 1. . refer to the MicroStrategy Advanced Reporting Guide. 30 Using functions in expressions © 2011 MicroStrategy. refer to Chapter 2. 4. both of which have dimensionality of their own. Standard Functions. You can use the Metric Editor when creating a new metric in a project. AvgRevenue. and 5. To create a derived metric. For more information on this method. Avg(Cost). You can also create metrics in Command Manager.5) In this example.

or report view. Inc. Then expand the Functions. The Metric Editor opens with the selected metric loaded. point to New and then select Metric. Then right-click and select Edit from the shortcut menu. The New Metric dialog box is displayed. The Insert Function wizard opens. select the appropriate metric in the folder list.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Metric Editor The Metric Editor is used to create new metrics and edit existing metrics in MicroStrategy. To access the Metric Editor 1 Log in to a project. The Metric Editor displays. 2 In the MicroStrategy Desktop File menu. The interface allows you to build metric expressions and validate them. To access the editor. which are created from objects already present in the report. You can also edit existing metrics by using the Metric Editor. • • Input Metric Formula dialog box The Input Metric Formula dialog box is used to create derived metrics. accessing the functions in one of the following ways: • Expand the Functions and Operators folder using the drop-down list or shortcut list in the Object Browser pane. Click (Insert Function) in the Definition pane. 4 Build the metric expression. Operators. or Plug-In Packages folder to access the various categories of functions and operators. Type the function name and all required metric syntax directly in the Enter your formula here box. object browser. © 2011 MicroStrategy. 3 Choose a Metric template and click OK to proceed. Using functions in expressions 31 .

32 Using functions in expressions © 2011 MicroStrategy. Customer. and arguments that are used in the expression are columns. These units are part of an attribute. Inc.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference To access the Input Metric Formula dialog box 1 From the Insert menu in the Report Editor. The types of attribute form expressions are as follows: • • • • Simple Implicit Derived Heterogeneous For more information on these types of attribute forms. refer to the MicroStrategy Advanced Reporting Guide. or Plug-In Packages folder to access the various categories of functions and operators. right-click above a metric heading in the Report Grid. this book discusses derived expressions. Or. The Input Metric Formula dialog box is displayed. select New Metric. Click (Insert Function) in the Definition pane. Name. . In the context of MicroStrategy functions. Access the functions in one of the following ways: • Expand the Functions and Operators folder using the drop-down list or folder list. for example. and Address. point to Insert. and then select New Metric in the shortcut menu. Then expand the Functions. A derived expression can only use single-value functions. and these expressions act on column data and can contain functions. • • Attribute form expressions Attribute forms are identifiers or descriptors of an attribute. Operators. 2 Build a metric using the available report objects. such as ID. The Insert Function wizard opens. See the examples described below. Attribute forms are defined by at least one expression. Type the function name and all required metric syntax directly in the Enter your formula here box.

MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Example 1: Subtraction ( .#0. can be defined by using the single-value function. For more information. Age. InitCap.getdate())". where Name is defined as the customer’s first name. [BIRTH_DATE]) The attribute form. and last name.) (Year(CurrentDate()) . Example 2: InitCap InitCap([CUST_LAST_NAME]) Text data is typically in all upper-case or all lower-case letters. ApplySimple.Year([HIRE_DATE])) The attribute form Employee Experience is defined by the above expression using the simple mathematical operator. • © 2011 MicroStrategy. middle name. Inc. to make the first letter capitalized and all other letters in lower case. do not use a form group for the attribute form expression. you can use the single-value function. you cannot use Customer@ Name. Use a single form because form groups are ignored by the Analytical Engine. This example shows that for the attribute form of customer’s last name. Using functions in expressions 33 . For example. The syntax of apply functions is database-specific. This example can be found in the MicroStrategy Tutorial project in the following folder: MicroStrategy Tutorial/Schema Objects/Attributes/Geography. Note the following: • For all Apply functions. subtraction. Example 3: ApplySimple ApplySimple("Datediff(YY. page 131. see Internal functions.

Then right-click and select Edit from the shortcut menu. point to New and then select Attribute. object browser. To add a new expression to the existing form. This automatically opens the New Attribute Form Expression dialog box. click New. This automatically opens the New Attribute Form Expression dialog box. 34 Using functions in expressions © 2011 MicroStrategy. The Insert Function wizard opens. 4 The Modify Attribute Form Expression dialog displays with the selected expression loaded. The Attribute Editor opens. The Modify Attribute Form dialog box displays. 2 Select the attribute form you wish to edit from the Attribute Forms pane and then click Modify. The three dialog boxes are New Attribute. if the cascading dialog box option is enabled in the Desktop Preference (as it is by default). 3 Select the expression you wish to edit and click Modify. select the appropriate attribute in the folder list. To add a new form to the existing Attribute. Type the function name and all required expression syntax directly in the Enter your formula here box. click New. Create New Attribute Form. and Create New Attribute Form Expression. Inc. or report view. The Attribute Editor opens three dialog boxes.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference To access attribute form expressions For a new attribute 1 From the MicroStrategy Desktop File menu. . 2 Build your expression by using the functions in one of the following ways: • • Click (Insert Function) in the Definition pane. The Create New Attribute Form Expression dialog box is where functions and operators are used. For an existing attribute 1 To access the editor.

are as follows: • • • CE01 = {Region = North-East} CE02 = {Region = Mid-Atlantic} CE03 = ({CE01} – {CE02})/{CE02} Other single-value functions can also be used for consolidation elements. Only single-value functions can be used in the definition of a consolidation element as well as calculations between consolidation elements. *. Using functions in expressions 35 . but only through the SDK. Only the basic mathematical operators (+. The following examples demonstrate definitions using functions and calculations: • • • CE04 = Ln({Region = North-East}) CE05 = Ln({Region = Mid-Atlantic}) CE06 = Abs({CE04} – {CE05}) For more information on consolidations.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 5 Create or edit the expression. Inc. without changing the structure of your metadata or your warehouse definition. Examples of consolidations. see the MicroStrategy Advanced Reporting Guide. -. accessing the functions in one of the following ways: • • Click (Insert Function) in the Definition pane. © 2011 MicroStrategy. /) can be used through MicroStrategy Desktop to define consolidation elements. The Insert Function wizard opens. Consolidation element expressions Consolidations enable you to group attribute elements for use in a report. using these operators. Type/edit the function name and all required expression syntax in the Enter your formula here box. The elements contained in a consolidation are called consolidation elements (CEs). A consolidation element expression defines how the attribute elements are calculated.

36 Using functions in expressions © 2011 MicroStrategy. in the lower right corner of the editor. Only the operators can be typed directly in the box. 3 The New Consolidation Element pane is enabled. A custom group can organize attribute elements through: • • • • • • Attribute qualification Set qualification A report A filter Banding Advanced qualification For more information on custom groups. . A custom group expression defines how the elements in the custom group are calculated. You must drag and drop attributes into the Enter your expression here box. The Consolidation Editor opens. A custom group can group attribute elements in a way that is not defined in the data warehouse. 2 Double-click Click here to add new consolidation element. see Custom Groups and Consolidations in the MicroStrategy Advanced Reporting Guide. Build the expression for the new element. Inc. point to New and then select Consolidation.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference To access the consolidation element expressions 1 In the MicroStrategy Desktop File menu. You can create relationships between the attribute and the custom group. Custom Group expressions A custom group is an object that can be placed on a template and is made up of a collection of elements called custom group elements.

The Custom Group Editor opens.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 When you define custom group elements through advanced qualification. 4 In the Custom Group Options pane. you can use two types of functions: • • Logical functions Comparison functions See the following examples. 3 Provide a name for the new element and double-click Add Qualification. Example 1: Subtraction ( . Inc. 5 The Advanced Qualification pane opens. © 2011 MicroStrategy. Using functions in expressions 37 . select Add an Advanced qualification and click OK.) ([Unit_Profit] . The functions are accessed in one of the following ways: • • Click (Insert Function) in the Definition pane. Type the function name and all required expression syntax directly in the Enter your formula here box. The Insert Function wizard opens. This is where the expression is built.[Unit_Cost]) > 500 Example 2: And ([Units Sold] > 500) and ([Unit Profit] > 1000) To access the custom group element expressions 1 In the MicroStrategy Desktop File menu. 2 Double-click Double-click here or drag an object from the object browser to add a custom group element. point to New and then select Custom Group.

Inc. The fact expression is part of the Fact Definition component of a fact structure. *). Example 1: Subtraction ( . -. Both examples can be found in the MicroStrategy Tutorial project in the following folder: MicroStrategy Tutorial/Schema Objects/Facts. See the following two examples.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Fact expressions Facts are objects created by and shared between MicroStrategy users. You can use functions to create fact expressions.[UNIT_COST]) The fact Unit Profit is defined using the table columns Unit_Price and Unit_Cost and a simple mathematical operator. this book discusses derived fact expressions. Derived fact expressions can only use single-value functions. Facts can be defined as: • • • Implicit Derived Heterogeneous For more information on facts and fact structure. They relate numeric data values from the data warehouse to the MicroStrategy reporting environment. subtraction. .DISCOUNT)) The fact Revenue is defined using three table columns and two arithmetic operators. see the MicroStrategy Project Design Guide. /. including simple arithmetic operators (+. subtraction and multiplication. 38 Using functions in expressions © 2011 MicroStrategy. In the context of MicroStrategy functions.) ([UNIT_PRICE] . A fact expression defines how a fact is calculated. Example 2: Multiplication ( * ) ([QTY_SOLD] * ([UNIT_PRICE] . and arguments that are used in the expressions are columns.

The Insert Function wizard opens. Using functions in expressions 39 . Type the function name and all required expression syntax directly in the Enter your formula here box. The Fact Editor opens two pages: Fact and Create New Fact Expression. Inc. 2 The Expression page is where the expression is built. or select an existing expression and click Modify. point to New and then select Fact. 3 Build an expression by using functions in one of the following ways: • • Click (Insert Function) in the Definition pane. The Fact Editor displays with the selected fact loaded. You can use either the Fact Editor or the Fact Creation Wizard to create facts. The Create New Fact Expression or Modify Fact Expression page displays. For an existing fact 1 Select an existing fact in the MicroStrategy Desktop main screen.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 To access fact expressions For a new fact with an expression 1 In the MicroStrategy Desktop File menu. The functions are accessed in one of the following ways: • • Click (Insert Function) in the Definition pane. 2 Click New to add a new expression to the fact. Then right-click and select Edit from the shortcut menu. only the Fact Editor allows you to use advanced expressions to define the fact. Type the function name and all required expression syntax directly in the Enter your formula here box. © 2011 MicroStrategy. however. The Insert Function wizard opens.

It is used as the optional condition component of a metric.Cost). The custom filter expression is used here for illustration purposes. You can achieve the same result by using a set (metric) qualification on a compound metric (such as the one in the example defined as Revenue . Example 1: Greater than ( > ) ((Revenue . A filter can be a report object. In this example. A filter can also be a metric qualifier created using custom expressions employing functions.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Filter expressions A filter specifies the conditions that data must meet to be included in the report results. Example 2: ApplyComparison ApplyComparison("#0 between #1 and #2". a report filter. as long as the root node is a logical or comparison function (see Example 1). . [Order Date]@ID. Inc.000. For detailed information on report filters. It is up to you which method you prefer to use. refer to the MicroStrategy Advanced Reporting Guide. that is. Only the following types of functions can be used in filter expressions: • • Logical operators Comparison operators Single-value functions can be used at the sublevel in a filter expression. a filter is specified after the WHERE clause. the filter compares a user-entered date to see if it is between the Order_Date and the Ship_Date. In SQL. or a view filter. You can create this type of filters by using the Advanced Qualification dialog box within the Filter Editor.Cost) > “5000”) This example uses a simple comparison operator to create a filter to limit the display of profit to values greater than $5. 40 Using functions in expressions © 2011 MicroStrategy. a report limit. that restricts the data returned or the display or view of data on a report. [Ship Date]@ID) ApplyComparison is commonly used to create custom filters. ?[Value Prompt Date].

are simple aggregate functions that satisfy many subtotaling requirements.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 To access an advanced filter qualification 1 In the MicroStrategy Desktop File menu. Using functions in expressions 41 . double-click Double-click here to add a qualification or drag an object from the Object Browser. using single-value functions or group-value functions. or Plug-In Packages folder to access the various categories of functions and operators. select the Add an Advanced qualification option. Then expand the Functions. you can create a user-defined subtotal using the Subtotal Editor or through the SDK. Then use the Custom Expression box to build and validate your custom filter. © 2011 MicroStrategy. The standard predefined subtotal functions. Click (Insert Function) in the Definition pane. Then click OK. The Advanced Qualification pane is displayed. 3 In the Filtering Options pane. The Filtering Options pane is displayed. The Filter Editor is displayed. Subtotals are applied to report metrics to calculate totals and for dynamic aggregation. 4 Select Custom Expression from the Option list. • • Subtotal expressions Subtotals allow you to dynamically control the computation and display of report data within desired groupings. Inc. 2 In the Filter Definition pane. which are automatically available for use with every metric and report. If they do not answer your particular needs. Access the functions in one of the following ways: • Expand the Functions and Operators folder using the drop-down list or folder list. The Insert Function Wizard opens. Operators. point to New and then select Filter. Type the function name and all required metric syntax directly in the Enter your formula here box. User-defined subtotals allow you to develop your own subtotals.

therefore. A typical example of this type of analysis is a TY/LY comparison (This Year versus Last Year). Inc. Type the function name and all required subtotal syntax directly in the Enter your formula here box. 3 The Subtotal Editor is very similar to the Metric Editor. you must have the appropriate privileges to create or modify them. Operators or Plug-In Packages folder to access the various categories of functions and operators. The Subtotal Editor displays.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Both predefined and user-defined subtotals can be applied to reports from the Subtotals/Aggregation tab in the Metric Editor. . you can do one of the following: • Expand the Functions and Operators folder using the drop-down list or shortcut list in the Object Browser pane. Click (Insert Function) in the Definition pane. 2 In the MicroStrategy Desktop File menu. 42 Using functions in expressions © 2011 MicroStrategy. For more information on subtotals and the procedures for creating and applying them. Then expand the Functions. Transformations are schema objects. • • Transformation expressions Transformations are schema objects that use business rules to compare values at different time periods. The Insert Function wizard opens. point to New and then select Subtotal. Example: Division ( / ) Sum(Sum(x*[Units Sold]){Year}/Sum([Units Sold]){Year}){} To access functions in the Subtotal Editor 1 Log in to a project. refer to the Reports chapter of the MicroStrategy Advanced Reporting Guide or the MicroStrategy online help. To access the functions used to create a new subtotal.

Using functions in expressions 43 . To access functions in transformations 1 In the MicroStrategy Desktop File menu. Adding functions to expressions with the Insert Function Wizard The Insert Function Wizard is available wherever functions are used. Then click OK. and setting the available parameters. refer to the MicroStrategy Advanced Reporting Guide or the MicroStrategy online help. The Expression Editor opens. These expressions define how (and from where) the information is retrieved for the transformation of the specified attribute. The Transformation Editor is displayed. 2 Select the attribute on which to base the transformation. and specifically in the definition of member expressions.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 There are two types of transformations: expression-based and table-based. Single-value functions can be used in expression-based transformations. It guides you through the process of selecting a function. Inc. For more information on transformations and their components. Type the function name and all required expression syntax directly in the Enter your formula here box. 3 Build an expression for the transformation of the selected member attribute. The Insert Function wizard opens. accessing functions in one of the following ways: • • Click (Insert Function) in the Definition pane. choosing the data on which the function acts. point to New and then select Transformation. The Select Member Attribute dialog box also opens. © 2011 MicroStrategy.

2 Navigate through the folder structure to the function you want to use. The Arguments page opens. . Select the function and click Next to continue. Inc. The Select Function page of the Insert Function Wizard is displayed.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference To build an expression using the Insert Function Wizard For detailed information on each page of the Insert Function Wizard. When a function is highlighted. 44 Using functions in expressions © 2011 MicroStrategy. 1 Click the Insert Function button to access the wizard. 3 Include the arguments for your function by typing the values or names of the arguments or by browsing for the arguments: • Type the appropriate values or name of the arguments into the available boxes. refer to the MicroStrategy online help and search for “Using the Insert Function Wizard”. its syntax and a short description are displayed in the lower left corner of the window.

Parameter values are displayed only if you have set your view to Show Function Parameters and have modified a parameter from its default setting. Min. For group-value metrics such as Count. meaning that the calculation searches for the input argument from the lookup table. Otherwise. and Max. 5 Set the values of the parameters. 4 Click Next when you have provided all arguments.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 • Click the (ellipsis) button. The default for FactID is (Nothing). make a selection from the pull-down list to force the calculation to look in another table. which is a standard Windows dialog box for file selection. standard parameters (Distinct. Click open to select the argument and return to the Insert Function Wizard. The expression built through the Insert Function Wizard displays in the appropriate editor. Using functions in expressions 45 . and FactID) display together on the only page available. if applicable. Inc. The Parameters page is displayed (if applicable). © 2011 MicroStrategy. 7 Click Finish. The Open dialog box opens. Select the argument on which the function acts. called Parameters. 6 Define the SortBy and BreakBy parameters in their separate windows. NULL.

If the database can perform the calculation. the SQL Engine sends the instructions to the database. • Those that can be processed only by the database. such as statistical and financial functions. and communicates with the Analytical Engine as necessary. For example. see Appendix A. • Those that can be processed either by the Analytical Engine or by the database. For a list of functions supported for each certified database type. which comprises the following: • SQL Engine: generates the SQL and associated logic for functions performed by the database. subtotal calculations on the result set. If a database platform does not support a given function that can only be processed by the database. This is because smart metrics change the default order of metric evaluation and only the Analytical Engine can support such a change. a compound metric containing the function cannot be smart metric enabled. such as finance functions. • • Types of function processing Functions supported by the Intelligence Server are of three types: • Those that can be processed only by the Analytical Engine. 46 How MicroStrategy processes functions © 2011 MicroStrategy. If the Analytical Engine does not support a given function. MicroStrategy and Database Support for Functions. . such as complex functions. Query Engine: sends the SQL generated by the SQL Engine to the data warehouse for execution. metric calculations that are not or cannot be performed using SQL. otherwise. that function cannot be calculated. the Analytical Engine processes the task. such as date-and-time functions. Analytical Engine: extends the capability of the system beyond what the RDBMS provides.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference How MicroStrategy processes functions MicroStrategy Intelligence Server has an engine component. it performs complex calculations on a result set returned from the data warehouse. and so on. Inc.

Group-value functions in simple metrics This subsection contains two examples that illustrate the processing of group-value functions. This report shows the sales for each region. the first one showing the SQL for a function supported by the database and the second one by the Analytical Engine. The following subsections explore through examples of how the various uses of functions result in different SQL syntax. The following examples discuss how MicroStrategy performs the group-value computations by providing the SQL syntax for specific situations. Inc. and OLAP functions. These function types include group-value. How MicroStrategy processes functions 47 . The SQL generated to process the request differs depending on what processes the request. Report 1A. in © 2011 MicroStrategy. The database. All of these examples use the functions in the context of metrics. The SQL syntax also differs depending on the database used. or by both the engine and the database. only the database. where the attribute Region is placed on the row axis and a simple metric defined as M1A=Sum(Revenue){~} is on the column axis. Tutorial data is stored in a Microsoft® Access database. Each example contains two reports. Within these categories are functions supported by only the Analytical Engine. Using group-value functions The computation of group-value functions is done by either the Intelligence Server or the database depending upon the function used and support available. single-value. AvgDev(Revenue) Consider a simple report. Example 1: Sum(Revenue) vs. when the database supports the function.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 How Intelligence Server uses functions Recall that there are several categories of functions recognized by Intelligence Server. Most of these examples (except where noted) can be recreated using the objects in the MicroStrategy Tutorial.

The following SQL is generated: • Report 1A (SQL Group-value function) . The following SQL is generated: • Report 1B (MicroStrategy Group-value function) select a11. a11.[REGION_ID] Now.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference this case Microsoft Access. again with the same attribute. Region. a13.[CUST_CITY_ID] AS CUST_CITY_ID.[REGION_ID] [An analytical SQL] In Report 1B.[REGION_ID] AS REGION_ID. but with a different simple metric defined as M1B=AvgDev(Revenue){~} on the column axis. [LU_CALL_CTR] a12.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CITY_CTR_SLS] a11.[CALL_CTR_ID] and a12.[REGION_NAME]) AS REGION_NAME. on the row axis. The notation [An analytical SQL] indicates that the computation is taking place in the Analytical Engine.[CALL_CTR_ID] = a12.[REGION_ID] AS REGION_ID. a12. • It displays the final result. the computation is performed by the Analytical Engine. • 48 How MicroStrategy processes functions © 2011 MicroStrategy.[TOT_DOLLAR_SALES]) AS WJXBFS1 from [CITY_CTR_SLS] a11. [LU_REGION] a13 where a11. [LU_REGION] a13 where a11. Inc.[CALL_CTR_ID] = a12. The database does not support the function Average Deviation. max(a13.[REGION_ID] = a13.[CALL_CTR_ID] AS CALL_CTR_ID. sum(a11. This report shows how revenue data varies from its mean for each region.[CALL_CTR_ID] and a12.[REGION_NAME] AS REGION_NAME. . namely AvgDev([TOTAL_ DOLLAR_SALES]){~} for each region. therefore. a11. It uses the result set (that is held in memory) to compute the metric. consider Report 1B.[REGION_ID] = a13. Intelligence Server performs the following steps: • It retrieves all fact data from the warehouse.Microsoft Access select a12. [LU_CALL_CTR] a12. [TOTAL_ DOLLAR_SALES] is the column alias used for the fact (Revenue) in the temporary table during SQL generation. supports the function Sum.[REGION_ID] group by a12.

[COUNTRY_ID] drop table ZZT1Y03009ZMD000 The first pass of SQL creates a temporary table to hold the data.[COUNTRY_ID] AS COUNTRY_ID. AvgDev(Revenue) {~. Notice that attribute Country is a parent of Region. since attribute Region is on the reports. [LU_REGION] a11 where pa1. Country} vs. Country} Now use the same report template as in Example 1. the AvgDev function is supported by Intelligence Server. the Sum function is supported by the database.[CALL_CTR_ID] group by a12.[CALL_CTR_ID] = a12. but add a dimensionality to each metric for comparison.[COUNTRY_ID] = a11. The second pass computes the metric at the Country level. WJXBFS1 DOUBLE) insert into ZZT1Y03009ZMD000 select a12.[REGION_ID] AS REGION_ID.[COUNTRY_ID] select a11. in Report 2B.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 In the previous examples. Example 2: Sum(Revenue) {~.[REGION_NAME] AS REGION_NAME. The SQL generated for both reports is as follows: Report 2A (SQL Group-value function) . Use Sum(Revenue){~. [LU_CALL_CTR] a12 where a11. pa1.Country} for Report 2A and AvgDev(Revenue){~. Inc. sum(a11. while the third pass joins with © 2011 MicroStrategy. a11. the dimensionality of both metrics is defined as {~}.[TOT_DOLLAR_SALES]) AS WJXBFS1 from [CITY_CTR_SLS] a11. The next example explains how Intelligence Server processes dimensionality. How MicroStrategy processes functions 49 .[WJXBFS1] AS WJXBFS1 from [ZZT1Y03009ZMD000] pa1. In Report 2A. and the relationship is one to many. the Analytical Engine can insert records back into the temporary database structures after the function calculation is performed so that dimensionality can be applied. When metric dimensionality is defined.Country} for Report 2B.Microsoft Access create table ZZT1Y03009ZMD000 ( COUNTRY_ID BYTE. which means that they both are calculated at the report level of Region.

[LU_REGION] a11 where pa1. The first example shows a single-value function applied before a group-value function. This is referred to as transforming a fact.[CALL_CTR_ID] create table ZZMD00 ( COUNTRY_ID BYTE. a11. [LU_CALL_CTR] a12 where a11. Report 2B (MicroStrategy Group-value function) select a11. a12. a11.[WJXBFS1] AS WJXBFS1 from [ZZMD00] pa1.[REGION_ID] AS REGION_ID. The final pass drops the temporary table. WJXBFS1 FLOAT) [An analytical SQL] insert into ZZMD00 values ([DummyInsertValue]) select a11. Inc. This is referred to as a compound metric.[CALL_CTR_ID] = a12. Using single-value functions The key to understanding the computation of a single-value function is to identify the way it is used. 50 How MicroStrategy processes functions © 2011 MicroStrategy. In the next pass. The second example shows a single-value function applied after the group-value function. an Analytical SQL pass is necessary to compute AvgDev since it is not a database supported group-value function. pa1.[COUNTRY_ID] AS COUNTRY_ID. the results of the calculation are inserted back into the temporary database structures. The next two subsections provide examples of the two uses of single-value functions and how they are processed.[COUNTRY_ID] drop table ZZMD00 In Report 2B.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CITY_CTR_SLS] a11. .[CUST_CITY_ID] AS CUST_CITY_ID.[CALL_CTR_ID] AS CALL_CTR_ID. since it is used to display the result for all regions.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference attribute Region since the result of the aggregation has to be displayed for each region.[REGION_NAME] AS REGION_NAME. a11.[COUNTRY_ID] = a11. The last SQL pass is the same as Report 2A.

For example. the fact Revenue is transformed into another fact. namely the natural logarithm values defined as Ln(Revenue) or the truncated revenue values defined as Trunc(Revenue). max(a14.Duration: 0:00:40. The following example describes this type of usage and displays the SQL that is generated. Consider the two metrics defined as follows: • • M3A = Sum(Ln(Revenue)){~+} M3B = Sum(Trunc(Revenue)){~+}. in this case. The use of transform in this context refers to retrieving a fact in a different form.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Each example contains two reports. last year’s revenue instead of this year’s revenue. The database. The following SQL is generated: Report 3A (SQL single-value before group-value function) .45 select a13.ORDER_AMT)) WJXBFS1 from ORDER_FACT a11 join LU_EMPLOYEE a12 on (a11.REGION_NAME) REGION_NAME. How MicroStrategy processes functions 51 . Inc.SQL Server 2000 Pass0 . the first one showing the SQL syntax when calculations are processed by the database and the second one when calculations are processed by the Intelligence Server.REGION_ID REGION_ID.REGION_ID = a14. sum(LOG(a11. you can obtain the absolute value for a fact or the natural logarithm.EMP_ID = a12.CALL_CTR_ID) join LU_REGION a14 on (a13. but the fact is the same. Put M3A with Region on the template. for example. supports the function Ln.EMP_ID) join LU_CALL_CTR a13 on (a12. SQL Server 2000.CALL_CTR_ID = a13. This differs from a transformation where the data retrieved is different when a transformation is applied.REGION_ID © 2011 MicroStrategy. Transforming a fact into another fact In this case.REGION_ID) group by a13.

[LU_CALL_CTR] a12. the functions Trunc and Sum are computed by the Intelligence Server. a12.[REGION_ID] = a13. and multiplication operators (–.[CALL_CTR_ID] = a12. as noted by the text [An Analytical SQL]. +.[CALL_CTR_ID] and a12. The Ln function uses the syntax LOG in SQL Server 2000. the following SQL is generated: Report 3B (MicroStrategy single-value before group-value function) select a11. [LU_REGION] a13 where a11. 2 Then. The examples illustrate the SQL generated when the 52 How MicroStrategy processes functions © 2011 MicroStrategy.[REGION_NAME] AS REGION_NAME. Intelligence Server computes the new fact Trunc([Dollar Sales]) first and then uses the Sum function to sum the new fact for each region.[CALL_CTR_ID] AS CALL_CTR_ID. this is what happened: 1 The Ln function is applied to the fact Revenue. division. a13. Calculating a compound metric Single-value functions can be used to create compound metrics.[CUST_CITY_ID] AS CUST_CITY_ID. Now. *) are common examples of single-value functions.[REGION_ID] [An Analytical SQL] In this case. /. addition. a11. Inc. .1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Based on the SQL. which is defined in the warehouse by the column ORDER_AMT.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CITY_CTR_SLS] a11. the Sum function is performed on the new fact.[REGION_ID] AS REGION_ID.Country}) (Sum([Dollar Sales]){~} + Sum([Freight]) {~}) The examples below use a compound metric and a metric that transforms a fact in the same report. See the following examples: • • (Sum([Dollar Sales]){~}/Sum([Dollar Sales]) {~. Subtraction. namely Ln(Revenue). a11. put M3B with Region on the template.

in this case SQL Server 2000.ORDER_ID ORDER_ID. LOG(sum(a11. respectively. supports the Ln function.EMP_ID) join LU_CALL_CTR a13 on (a12. and metric M4A together with attribute Region on the template.ORDER_AMT)) WJXBFS2 from ORDER_FACT a11 join LU_EMPLOYEE a12 on (a11.SQL Server 2000 Pass0 .ORDER_AMT WJXBFS1 from ORDER_FACT a11 © 2011 MicroStrategy. a13. max(a14. and the database does not support the Trunc function. Inc.67 select a11. The database.Duration: 0:00:02.ORDER_AMT)) WJXBFS1. a14. a11. The Ln function uses the syntax LOG in SQL Server 2000. a11. if you put metrics M3B and M4B together with attribute Region on the template. then the following SQL is generated: Pass0 . the single-value function Ln is calculated before the group-value function Sum.REGION_NAME) REGION_NAME. Consider the following metric definitions: • • M4A = Ln(Sum(Revenue){~}) M4B = Trunc(Sum(Revenue){~}) Put metric M3A.Duration: 0:00:12. How MicroStrategy processes functions 53 . Ln is calculated after Sum. and for metric M4A.REGION_ID) group by a13.REGION_ID REGION_ID.CALL_CTR_ID = a13.REGION_ID REGION_ID.REGION_NAME REGION_NAME. from the previous example.EMP_ID EMP_ID.58 select a13.CALL_CTR_ID) join LU_REGION a14 on (a13.ORDER_DATE DAY_DATE. a11.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 function is supported by the database and the Intelligence Server. The following SQL is generated: Report 4A (SQL single-value before and after group-value functions) . sum(LOG(a11. Similarly.REGION_ID To process metric M3A.EMP_ID = a12.REGION_ID = a14.

5). is retrieved and used to compute both metrics. Window Size in Moving functions For this example.EMP_ID = a12. the computation restarts for every category.Duration: 0:00:08. 54 How MicroStrategy processes functions © 2011 MicroStrategy. Moreover.CALL_CTR_ID = a13. . define metric M1A as Sum(Revenue){~+}. Then create an OLAP metric called OM1. which is defined as column ORDER_AMT in the ORDER_FACT table. comparing the SQL syntax when the database performs the OLAP function calculations with the one when the Intelligence Server performs the computation. OM1 computes the moving average of M1A with a window size of 5.CALL_CTR_ID) join LU_REGION a14 on (a13. Using OLAP functions You can better understand how Intelligence Server computes OLAP functions by observing several examples based on the following properties: • • • • • Window size BreakBy SortBy NULL handling Tie handling There are two examples for each subsection. Inc.REGION_ID) Pass1 . that is defined as MovingAvg <BreakBy = {Category}.EMP_ID) join LU_CALL_CTR a13 on (a12.REGION_ID = a14.46 [An Analytical SQL] The fact. The OLAP metric is computed after it is sorted by the value of M1A in ascending order. SortBy = (Value)>([M1A].1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference join LU_EMPLOYEE a12 on (a11. Revenue.

60 select a13.[CATEGORY_DESC]) AS CATEGORY_DESC.CATEGORY_ID order by sum((a11.QTY_SOLD * (a11.[ITEM_ID] Pass1 .QTY_SOLD * (a11. [LU_SUBCATEG] a13.Oracle 9i Pass0 . sum((a11.Microsoft Access Pass0 .QTY_SOLD * (a11. © 2011 MicroStrategy. a12.window size) .Duration: 0:00:00. put the attributes Category and Item on the Row axis and the above metrics on the Column axis. max(a12.15 select a13. max(a14. if you execute the above report against a database that does support OLAP computations (in this case Oracle 9i).[CATEGORY_ID] = a14.CATEGORY_ID CATEGORY_ID.Duration: 0:00:10.[CATEGORY_ID] group by a13.ITEM_NAME ITEM_NAME.UNIT_PRICE a11. avg(sum((a11.01 [An Analytical SQL] Alternatively.[SUBCAT_ID] = a13.[ITEM_ID] = a12. then the following SQL is generated: Report 5B (DB OLAP function .a11.[CATEGORY_ID]. a11.UNIT_PRICE . LU_ITEM a12.ITEM_ID ITEM_ID.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Now.[CATEGORY_ID] AS CATEGORY_ID. [LU_ITEM] a12. a11.DISCOUNT)))) over(partition by a13. sum(a11.UNIT_PRICE a11.window size) . a11.DISCOUNT))) WJXBFS1.DISCOUNT))) asc rows 4 preceding) WJXBFS2 from ORDER_DETAIL a11.Duration: 0:00:00.[ITEM_ID] AS ITEM_ID.CATEGORY_DESC CATEGORY_DESC. Inc. a14.[TOT_DOLLAR_SALES]) AS WJXBFS1 from [ITEM_MNTH_SLS] a11.[ITEM_ID] and a12. How MicroStrategy processes functions 55 . [LU_CATEGORY] a14 where a11.[SUBCAT_ID] and a13. Run this report with an empty filter against a database that does not support OLAP functions (in this case Microsoft Access).[ITEM_NAME]) AS ITEM_NAME. the following SQL is generated: Report 5A (MicroStrategy OLAP function .

CATEGORY_ID group by a13. the Intelligence Server always selects Category even though Category is not on the template. In the above examples. then this attribute must also be in the partition by clause.ITEM_ID = a12.CATEGORY_ID = a14. On the other hand. and if the database computes it. Run a report similar to the one for window size. If the Analytical Engine computes the OLAP function. a11. OLAP metric OM1 must still restart the calculation (break by) for each Category and therefore remains in the appropriate Select and Partition by clauses. you can start over certain computations of OLAP functions when a part of the metric belongs to a different attribute element. then the level of aggregation for metric M1A is replaced by Subcategory. Attributes in the BreakBy parameter of an OLAP metric are always applied. deleting the attributes Category and Item from the template and adding Subcategory. the BreakBy parameter is only available at the attribute level. Intelligence Server must select this attribute in the select clause. This is true whether the attribute is on the template or not.CATEGORY_DESC. which is on the template. In other words.ITEM_ID and a12. meaning that they are always in the Select clause. BreakBy parameter. The results for metric M1A are completely different from the previous report because if Category and Item are not on the template. Inc.CATEGORY_ID. a12. it is sufficient to bring back just the input metric (WJXBFS1). since the SortBy parameter setting is by Value. If the database computes the OLAP function.ITEM_NAME The following example shows how the Intelligence Server computes OLAP functions when the database does not support OLAP functions. 56 How MicroStrategy processes functions © 2011 MicroStrategy. they are also in the Partition by clause. there is an OLAP function with Category in the BreakBy parameter. The Intelligence Server retrieves all components: the input metric. and SortBy parameter.SUBCAT_ID and a13. Notice that in both the SQLs below. In the previous example (window size). BreakBy in OLAP functions In the Intelligence Server.SUBCAT_ID = a13.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference LU_SUBCATEG a13. a14. LU_CATEGORY a14 where a11. .ITEM_ID.

SUBCAT_DESC SUBCAT_DESC.a11.Microsoft Access Pass0 .SUBCAT_ID. [LU_SUBCATEG] a12 where a11. max(a12.CATEGORY_ID © 2011 MicroStrategy. LU_ITEM a12. a13. How MicroStrategy processes functions 57 .QTY_SOLD * (a11.Duration: 0:00:00.[CATEGORY_ID] AS CATEGORY_ID.[SUBCAT_ID] AS SUBCAT_ID. the following SQL is generated: Report 6A (MicroStrategy OLAP function <BreakBy>) .[SUBCAT_ID] = a12.DISCOUNT))) asc rows 4 preceding) WJXBFS2 from ORDER_DETAIL a11.SUBCAT_ID = a13.DISCOUNT))) WJXBFS1.00 [An Analytical SQL] If the database supports computation of OLAP functions (in this example Oracle). sum((a11.DISCOUNT)))) over(partition by a13.[SUBCAT_DESC]) AS SUBCAT_DESC. then the following SQL is generated: Report 6B (DB OLAP function) . avg(sum((a11. a12. Inc.SUBCAT_ID SUBCAT_ID.Duration: 0:00:09.ITEM_ID and a12.[SUBCAT_ID].[TOT_DOLLAR_SALES]) AS WJXBFS1 from [CITY_SUBCATEG_SLS] a11.CATEGORY_ID order by sum((a11.Duration: 0:00:00.[CATEGORY_ID] Pass1 .SUBCAT_ID group by a12.Oracle Pass0 .SUBCAT_DESC. a13.UNIT_PRICE a11. a13.39 select a12.UNIT_PRICE .QTY_SOLD * (a11.QTY_SOLD * (a11.ITEM_ID = a12.[SUBCAT_ID] group by a11.CATEGORY_ID CATEGORY_ID.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 For a database that does not support OLAP functions (in this case Microsoft Access). a12. LU_SUBCATEG a13 where a11.UNIT_PRICE a11. sum(a11.63 select a11. a13.

• Sort by Objects: This type of sorting can use either attributes or metrics. a12. page 55) and 6B (in Report 6B (DB OLAP function) .QTY_SOLD * (a11. then by Customer@Name in descending order.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Sorting in OLAP functions For OLAP functions. Inc.window size) .[CUSTOMER_ID] AS CUSTOMER_ID. The metric OM2 is sorted by Customer City@ID in ascending order.[CUST_REGION_NAME] AS CUST_REGION_NAME. a11.Microsoft Access select a14.[CUST_FIRST_NAME] AS CUST_FIRST_NAME. and the metric OM2 to the template. a15.[CUST_REGION_ID] AS CUST_REGION_ID.UNIT_PRICE . Note that if the database can perform computation of OLAP functions.[CUST_CITY_ID] AS CUST_CITY_ID. SortBy = ([Customer City]@ID asc.a11. For a database that does not support OLAP functions (in this case Microsoft Access). In this example. Basically. though the attribute Customer City is not on the template. the OLAP metric is sorted by a normal attribute (either by ID or Desc). there are two choices for the SortBy parameter setting: • Sort by Value in Subexpression: See Reports 5B (in Report 5B (DB OLAP function . 58 How MicroStrategy processes functions © 2011 MicroStrategy. sorting is done before performing computations. a12. then the definition of the subexpression M1A displays in the order by clause. Customer@Name dsc)>([M1A]) Then add the attributes Customer Region and Customer. For example.Oracle 9i.[CUST_LAST_NAME] AS CUST_LAST_NAME.Oracle. The following examples demonstrate the differences in processing when an attribute or metric is used. and Customer City is a child of Customer Region. Create an OLAP metric defined as: OM2 = RunningSum<BreakBy = {[Customer Region]}. a12. the following SQL is generated: Report 7A (MicroStrategy OLAP function <SortBy>) . page 57) for examples. Assume that attribute Customer is a child of the attribute Customer City. . the above reports contain: “order by sum((a11.DISCOUNT))) asc” to represent the <SortBy = Value ascending> parameter setting.

a13.CUST_STATE_ID = a15. a13. a13.CUST_LAST_NAME.CUST_REGION_NAME. a12.CUST_FIRST_NAME desc rows unbounded preceding) WJXBFS1 from ORDER_FACT a11. a16. LU_CUST_STATE a15.[CUSTOMER_ID] = a12. [LU_CUST_STATE] a14.[CUST_CITY_ID] = a13.CUST_REGION_ID CUST_REGION_ID.CUST_REGION_ID.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CUSTOMER_SLS] a11.Oracle Pass0 . a12.ORDER_AMT)) over(partition by a15. Inc. [LU_CUST_REGION] a15 where a11.CUST_LAST_NAME CUST_LAST_NAME.CUST_LAST_NAME desc. [LU_CUSTOMER] a12. a13. a13. LU_ORDER a12.CUSTOMER_ID CUSTOMER_ID.CUSTOMER_ID and a13.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 a11. a13.ORDER_ID = a12. sum(sum(a11. LU_CUST_CITY a14. a13. the following SQL is generated: Report 7B (DB OLAP function <SortBy>) .[CUST_CITY_ID] and a13.[CUST_STATE_ID] = a14.[CUSTOMER_ID] and a12. a16.CUST_REGION_NAME CUST_REGION_NAME.CUST_FIRST_NAME.CUST_REGION_ID group by a15. How MicroStrategy processes functions 59 .ORDER_ID and a12.CUST_REGION_ID order by a13.CUST_CITY_ID CUST_CITY_ID.00 select a15.CUSTOMER_ID.CUST_CITY_ID = a14. a13. LU_CUST_REGION a16 where a11.CUST_REGION_ID = a16.[CUST_REGION_ID] = a15.CUST_STATE_ID and a15.Duration: 0:00:15.CUST_FIRST_NAME CUST_FIRST_NAME.[CUST_STATE_ID] and a14.CUSTOMER_ID = a13.CUST_CITY_ID asc. [LU_CUST_CITY] a13.CUST_CITY_ID © 2011 MicroStrategy.[CUST_REGION_ID] [An Analytical SQL] If the database supports computation of OLAP functions (in this example Oracle 9i). LU_CUSTOMER a13.CUST_CITY_ID and a14.

7) 60 How MicroStrategy processes functions © 2011 MicroStrategy. the following SQL is generated: Report 8A (MicroStrategy OLAP function <SortBy>) . SortBy = (Customer@[Last Name] desc.Microsoft Access Pass0 .[CUST_FIRST_NAME] AS CUST_FIRST_NAME. an OLAP metric is sorted by an attribute and a metric. a11.[CUSTOMER_ID] AS CUSTOMER_ID. For optimization purposes. In this example. the Intelligence Server only groups by the ID column.[CUST_REGION_ID] in (3. the SQL has to issue group by CUST_LAST_NAME and CUST_FIRST_NAME due to the sort by Customer@Name. Sort by attribute Customer City@ID is done because of attribute Customer that is a child of Customer City. For databases that do not support OLAP functions (in this case Microsoft Access).[TOT_DOLLAR_SALES] AS WJXBFS1 from [CUSTOMER_SLS] a11. In Report 7B. a12. and metric OM3 to the template. [LU_CUST_REGION] a15 where a11.[CUST_LAST_NAME] AS CUST_LAST_NAME.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference In both SQLs.[CUST_REGION_ID] = a15. a11. [LU_CUST_CITY] a13. a12.[CUST_REGION_ID] and a14. a15. this attribute is also in the group by clause. The OLAP metric OM3 is sorted by Customer Last Name and then by the metric [M1A].[CUST_STATE_ID] and a14.[CUST_STATE_ID] = a14. [LU_CUSTOMER] a12.[CUST_CITY_ID] and a13. Inc.CUST_CITY_ID. Create an OLAP metric defined as: OM3 = RunningSum<BreakBy = {[Customer Region]}.47 select a14. This VLDB setting can be set for any report that uses an OLAP metric with a sort by attribute description.[CUST_CITY_ID] = a13. In Report 7B.[CUSTOMER_ID] = a12. .[CUST_REGION_NAME] AS CUST_REGION_NAME. [M1A] asc)>([M1A]) Then add attributes Customer Region and Customer. [LU_CUST_STATE] a14. the Intelligence Server selects a13.[CUSTOMER_ID] and a12.[CUST_REGION_ID] AS CUST_REGION_ID. even though attribute Customer City is not on the report.Duration: 0:00:00. There is a VLDB setting that allows you to group by non-ID columns.

Duration: 0:00:00. a12.CUST_REGION_ID and a15. a13.CUST_CITY_ID = a14. sum(a11.06 [An Analytical SQL] If the database supports computation of OLAP functions (in this example Oracle). NULL is treated as zero for the sum of values across the function parameters.CUST_STATE_ID = a15.ORDER_ID = a12.CUST_REGION_ID CUST_REGION_ID. a13. LU_CUST_CITY a14.ORDER_AMT)) over(partition by a15.CUST_STATE_ID and a15. How MicroStrategy processes functions 61 .CUST_FIRST_NAME CUST_FIRST_NAME. NULL is placed at the end of a list. Inc.CUST_REGION_NAME CUST_REGION_NAME. a13. a12. the following SQL is generated: Report 8B (DB OLAP function <SortBy>) .CUST_REGION_ID in (7.CUSTOMER_ID and a13.CUSTOMER_ID CUSTOMER_ID. NULL is always ignored.CUST_CITY_ID and a14.ORDER_AMT) WJXBFS1. LU_CUST_STATE a15.ORDER_AMT) desc rows unbounded preceding) WJXBFS2 from ORDER_FACT a11. This behavior is © 2011 MicroStrategy. LU_CUST_REGION a16 where a11. a16. as required by the ANSI standard.CUST_REGION_ID order by a13. a13. Databases also put NULL at the end.CUST_LAST_NAME desc.CUSTOMER_ID.CUSTOMER_ID = a13.Oracle select a15.CUST_REGION_ID = a16.CUST_FIRST_NAME NULL handling in OLAP functions When sorted by Intelligence Server. LU_CUSTOMER a13.CUST_REGION_ID. For RunningCount or MovingCount functions. sum(a11.CUST_REGION_NAME. 3) group by a15. a16. sum(sum(a11.CUST_LAST_NAME. For other computations.ORDER_ID and a12. LU_ORDER a12.CUST_LAST_NAME CUST_LAST_NAME.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Pass1 . such as RunningSum or MovingAvg.

/. Count. /. IRR. NPV.Schema Objects/Functions and Operators/Plug-In Packages. which always preserves the original order retrieved from the database (via ODBC) to the Intelligence Server. These functions are located at . Max. Plug-In Package Functions and the Function Plug-in Wizard online help. +. +. Ln. or *. and then let the Engine use them for further analysis. Min. It is not known whether databases use the same sort algorithm. Average. and so on. They are intended to provide three full-featured libraries of functions that are most commonly used by customers— financial functions. and statistical functions. Intelligence Server uses a Merge-Sort algorithm. the Intelligence Server and database computation of OLAP functions can produce different results whenever there is a tie on the data. The plug-in functions. 62 How MicroStrategy processes functions © 2011 MicroStrategy. Log.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference consistent for Intelligence Server and ANSI-compliant database OLAP functions. such as Sum. and so on that are usually calculated by the database. and Confidence. about 130 of which are predefined plug-in functions created by MicroStrategy. Examples include Accrint. Abs. For detailed information on individual functions. . The Intelligence Server performs standard computations such as Sum. AvgDev. behave as if they are an integrated part of the MicroStrategy product and are indistinguishable from all other MicroStrategy functions or operators. usually called user-defined functions. Tie handling in OLAP functions Tie Handling is related to the SortBy parameter when you sort a tie in a metric... Average. Inc. Using custom plug-in functions Function Plug-Ins in the MicroStrategy Engine allow users to define their own collection of functions. math functions. The MicroStrategy product is equipped with approximately 250 functions and operators. therefore. refer to Chapter 4. HomoscedasticTTest. -.

and statistical packages. You can create individual functions or even entire function packages. Guided by the wizard. Implementing: creates the code that embodies the algorithms and compiling this code into a library that is used by MicroStrategy. Executing: creates new metrics that use the algorithms and using those metrics in a MicroStrategy report. provided by MicroStrategy. After the new plug-in function is created. Inc.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Creating user-defined plug-in functions Using the MicroStrategy Function Plug-In Wizard. once a function is imported. Importing: adds the library to a MicroStrategy project so that its algorithms are available for use in the project. The main stages of the creation process are described as follows: • • • • • Designing: determines how to implement the analytical procedures into a computer algorithm. As mentioned previously. it will be used in the same way as any other standard MicroStrategy function. mathematical. For instructions on creating a plug-in function. which is used to build a library containing your algorithms. such as the financial. You can create the following types of functions: • • • Single-value functions Group-value functions OLAP functions The datatypes of input arguments can be: • • • Numeric Date String © 2011 MicroStrategy. you start by creating a Microsoft Visual C++ project with placeholders where you can add custom analytic code. you need to launch MicroStrategy Desktop to import it so it can be used for all the reports. How MicroStrategy processes functions 63 . Creating: creates the Microsoft Visual C++ project. refer to the Function Plug-in Wizard online help. you can define custom functions relevant to your business case scenarios.

6789' 64 How MicroStrategy processes functions © 2011 MicroStrategy. predicts the value after n additional time intervals Example: FORECAST<2>(100.160) = 200 • CUSTOMNUMBERFORMAT(numeric1) = string1 Simple function with numeric scalar as input argument and string scalar as output argument No parameters Transforms a number into a string representation of that number not supported by any of MicroStrategy's out-of-the-box metric format strings Example: CUSTOMNUMBERFORMAT(123456789) = '1 2345. Inc. n.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference A plug-in function can contain more than one parameter. Supported datatypes for parameters include: • • • • • • • • Byte Short Long Float Double String (BSTR) Bool Date The following two examples illustrate how plug-in functions could be defined: • FORECAST<n>(numeric_vector1) = numeric1 Aggregate function with a numeric vector as an input argument and a numeric scalar as an output argument One parameter. which is a long integer Given a series of values each one time interval apart.120. .140.

4 Provide a name in the Project Name text box. Then click OK.. The New window is displayed. Inc.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 To install the Function Plug-In Wizard 1 From . select Programs. and then Microsoft Visual C++. click FPWizard.Step 1 of 2 window is displayed.\MicroStrategy\Desktop. and then expand the Using custom functions folder. expand the Metrics folder.. 2 Launch the Using custom functions topic. Do not use spaces in the project name. For illustration purposes. then Microsoft Visual Studio. if needed. Because the project name will become the name of the library. search for custom functions. 5 Change the location of the project. How MicroStrategy processes functions 65 . 3 Click the Function Plug-in Wizard on-line help link. To activate the Function Plug-In Wizard 1 From the Start button. This topic contains a link to the Function Plug-in Wizard online help. 2 From the File menu. select New. To access the Function Plug-in Wizard online help from the MicroStrategy online help 1 In the master MicroStrategy online help. © 2011 MicroStrategy. select MicroStrategy Function Plug-in Wizard. The Function Plug-in Wizard .exe. The Function Plug-in Wizard online help opens in a new help window. 3 On the Projects tab. use something short and descriptive. 6 Click Help for the Function Plug-in Wizard online help whenever needed. 2 Follow the prompts to install. the project name myFP is used throughout the online help. or open the Creating and Modifying Additional Report Objects folder. The InstallShield window is displayed.

2002? To answer this question. you must first find the average of daily sales in 2002 and 2003 for each call center. 66 Additional examples of functions in expressions © 2011 MicroStrategy. Sum and Avg. . Day}){~} This is a simple metric that contains the nested group-value functions.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Additional examples of functions in expressions Hypothesis Testing example The report and report objects in this example can be found in the following folder: MicroStrategy Tutorial\Public Objects\ Reports\Technical Reports\Reports by Feature\ Analytics\Statistics and Forecasting\ Hypothesis Testing Which call centers had a statistically significant decrease in the average daily sales in 2003 vs. Inc. You accomplish this using the Average Daily Sales metric. defined as: Average Daily Sales = Avg(Sum(Revenue){~.

Day}){~} © 2011 MicroStrategy. Inc. Additional examples of functions in expressions 67 . you check the standard deviation of daily sales in 2002 and 2003 for each call center. However. The following report appears. The metric is defined as: StDev Daily Sales = StDev(Sum(Revenue){~. by adding Standard Deviation in Daily Sales to the report. placing the Call Center attribute on the row axis and Year attribute on the column axis.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Next. an average value by itself does not represent the complete picture. create a report that uses this metric. In this report it looks like all call centers had a significant decrease in the average daily sales in 2003 compared to 2002. To get more information.

In statistics. This must be tested for each call center. . you next want to find out which call centers have a statistically significant difference in their average daily sales between these two years. then you can use a function called HomoscedasticTTest to compute the p-value. p-value is the probability of making a decision to reject a fact.0%. In general. they may have been caused by random fluctuations. This tolerance level is usually set to between 2. In the context of this example. the lower average daily sales in 2003 are not necessarily a progressive decrease over 2002. for each call center. Therefore. given that actually they are about the same.5 – 10. against the hypothesis that the average daily sales are significantly different. given that the fact is correct. If you assume that the population standard deviations of daily sales for both years are the same. If you assume that the population daily standard 68 Additional examples of functions in expressions © 2011 MicroStrategy. The hypothesis testing is accomplished by computing the p-value. They also have higher standard deviations of daily sales in 2002 than 2003. it is the probability of making a mistake by concluding that the average daily sales in 2002 is significantly different from 2003.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference The resulting report provides the average and the standard deviation of daily sales for both years. you want to restrict this type of error so that it is smaller than a certain tolerance level. Inc. This report shows that all call centers have greater average daily sales in 2002 than 2003. You can get the result by testing the hypothesis that the average daily sales are the same. Based on this observation. This means that the volatility of daily sales in 2002 is higher than that for 2003. with the exception of Charleston and Web.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

deviations are different, then you must use the function HeteroscedasticTTest. The following examples consider both of these assumptions and compute the p-value using HomoscedasticTTest and HeteroscedasticTTest. This report uses simple metrics based on metrics. This is because to calculate the p-value, you need to compute the Daily Sales for each call center for each day. You also need to group the fact Revenue at the levels of Day and Call Center for both years. The fact table DAY_CTR_SLS is available at the levels of Employee, Order, and Day. Call Center is related to the fact table via Employee. You need a table with a structure similar to the following:
Call Center Northwest Day 1 ... N Southeast 1 ... N Daily Sales in 2002 123456 123456 123456 123456 123456 123456 Daily Sales in 2003 123456 123456 123456 123456 123456 123456

There is no table in the warehouse with this structure; therefore, you need to create it temporarily using metrics. These metrics are then used in simple metrics to calculate the p-value. Follow the steps below to build the necessary metrics for the Hypothesis Testing report. 1 Build a metric to create the column for [Daily Sales in 2003] in the temporary table. This metric is defined as: Daily Sales in 2003 = Sum(Revenue){~, Day}<2003> The default level notation {~} is placed on the metric since the default is to group by an attribute on the report. In this example, that report attribute is Call Center.

© 2011 MicroStrategy, Inc.

Additional examples of functions in expressions

69

1

Understanding Functions in MicroStrategy

MicroStrategy Functions Reference

2 Use a transformation to build a metric for the column [Daily Sales in 2002]. The transformation is necessary because attribute Day is a child of attribute Year. To show Daily Sales in Day 1, 2, …, N of 2002 together with Daily Sales in Day 1, 2, …, N of 2003, you must use the Last Year’s transformation instead of a filter. This metric is defined as: Daily Sales in 2002 = Sum(Revenue){~, Day}<2003>|[Last Year’s]| 3 Build the simple metrics to compute the p-value for each call center by using the metrics above. The simple metrics are defined as follows: HeteroscedasticTTest<0, 0>([Daily Sales in 2002], [Daily Sales in 2003]){~} HomoscedasticTTest<0, 0>([Daily Sales in 2002], [Daily Sales in 2003]){~} Create a report template with the two metrics shown above (for p-value) and attribute Call Center. The Hypothesis Testing report appears below.

The SQL generated for the report Hypothesis Testing is as follows: Pass0 - Duration: 0:00:00.09 create table ZZT1Y01007DMD000 ( DAY_DATE TIMESTAMP, CALL_CTR_ID BYTE, WJXBFS1 DOUBLE) Pass1 - Duration: 0:00:00.30

70 Additional examples of functions in expressions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

insert into ZZT1Y01007DMD000 select a12.[DAY_DATE] AS DAY_DATE, a11.[CALL_CTR_ID] AS CALL_CTR_ID, a11.[TOT_DOLLAR_SALES] AS WJXBFS1 from [DAY_CTR_SLS] a11, [LU_DAY] a12 where a11.[DAY_DATE] = a12.[LY_DAY_DATE] anda12.[YEAR_ID] in (2003) Pass2 - Duration: 0:00:00.02 create table ZZT1Y01007DMD001 ( DAY_DATE TIMESTAMP, CALL_CTR_ID BYTE, WJXBFS1 DOUBLE) Pass3 - Duration: 0:00:00.23 insert into ZZT1Y01007DMD001 select a11.[DAY_DATE] AS DAY_DATE, a11.[CALL_CTR_ID] AS CALL_CTR_ID, a11.[TOT_DOLLAR_SALES] AS WJXBFS1 from [DAY_CTR_SLS] a11, [LU_DAY] a12 where a11.[DAY_DATE] = a12.[DAY_DATE] anda12.[YEAR_ID] in (2003) Pass4 - Duration: 0:00:00.57 select pa1.[CALL_CTR_ID] AS CALL_CTR_ID, a11.[CENTER_NAME] AS CENTER_NAME, pa1.[DAY_DATE] AS DAY_DATE, pa1.[WJXBFS1] AS WJXBFS1, pa2.[WJXBFS1] AS WJXBFS2, pa1.[WJXBFS1] AS WJXBFS3, pa2.[WJXBFS1] AS WJXBFS4 from [ZZT1Y01007DMD000] pa1, [ZZT1Y01007DMD001] pa2, [LU_CALL_CTR] a11 where pa1.[CALL_CTR_ID] = pa2.[CALL_CTR_ID] and pa1.[DAY_DATE] = pa2.[DAY_DATE] and pa1.[CALL_CTR_ID] = a11.[CALL_CTR_ID] Pass5 - Duration: 0:00:00.10 [An Analytical SQL] Pass6 - Duration: 0:00:00.27 drop table ZZT1Y01007DMD000 Pass7 - Duration: 0:00:00.00

© 2011 MicroStrategy, Inc.

Additional examples of functions in expressions

71

1

Understanding Functions in MicroStrategy

MicroStrategy Functions Reference

drop table ZZT1Y01007DMD001 • Pass0 and Pass1 are issued by Intelligence Server to compute the metric Daily Sales in 2002. The Intelligence Server prepares the temporary table with Call Center and Day as its key. Then, it retrieves the sales in 2002 using the transformation Last Year. • Pass3 and Pass4 are issued to compute the metric Daily Sales in 2003. Attributes Call Center and Day are used as keys to the temporary table. This pass is similar to Pass0 and Pass1 with the only difference being that there is no transformation for this metric. In Pass5, the Intelligence Server computes the p-value for each call center, using the HeteroscedasticTTest and the HomoscedasticTTest functions, and inserts the values back into the table. The remaining passes drop the temporary tables.

In the resulting report, Hypothesis Testing shown above, only San Francisco, Fargo, and Memphis have a p-value of less than 5%. This indicates that the probability of making an error in concluding that the sales have significantly decreased is low. This is strong evidence that average daily sales in San Francisco, Fargo, and Memphis for 2003 are actually different from those in 2002.

Confidence Level example
The reports and report components in this example can be found in the following folder: MicroStrategy Tutorial\Public Objects\ Reports\Technical Reports\Reports by Feature\ Analytics\Statistics and Forecasting\ Confidence Level Who are my valuable customers? (Definition 1) The basic goal is to define a cut-off value that represents the minimum requirement to be classified as a valuable customer. To identify the valuable customers in your customer base, you must determine the parameters that help differentiate those customers from the others. In this example, valuable customers are those whose spending averages above an upper bound of sales orders. The ORDER_FACT table contains all orders received in 2002 and 2003. Assume that the sales order amount is normally distributed with a certain mean and standard deviation. Based on the assumption of normal
72 Additional examples of functions in expressions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

distribution and a confidence level of 99%, you can define valuable customers as those who have an average spending above an upper bound of sales orders. To determine the valuable customers based on this criteria, you need to know several values. Use the following metrics to obtain these values. 1 You must know the average sales order from all orders in the ORDER_FACT table. This is the arithmetic mean of the normal distribution. You can get this value using the Avg function. The metric to compute the average of sales orders from the ORDER_FACT table can be defined as: M01 = Avg(Revenue){[Call Center], Year, Employee, Order, Day} Since Day, Employee, and Order are the highest attributes that are parents of the keys in the ORDER_FACT table, include them as the level of aggregation to make sure that the ORDER_FACT table is used. Also, the average must be calculated over all sales order amounts, so you must set the group-by on the level attributes to none. This ensures that the metric does not group by any of these attributes. 2 You must know the standard deviation of sales orders from all orders. This number is the standard deviation of the normal distribution. You can get this value using the StDevP function. StDevP is the standard deviation of a population, while StDev is the standard deviation of a sample The metric to compute the population standard deviation of sales orders from the ORDER_FACT table is defined as follows: M02 = StDevP(Revenue) {[Call Center], Year, Employee, Order, Day} 3 You must know the number of rows in the ORDER_FACT table. You need it to calculate the cut-off value. Get this value using the Count function, in particular, Count from the ORDER_FACT table. The metric to count the data in the ORDER_FACT table is defined as follows: M03 = Count(Revenue) {[Call Center], Year, Employee, Order, Day}

© 2011 MicroStrategy, Inc.

Additional examples of functions in expressions

73

1

Understanding Functions in MicroStrategy

MicroStrategy Functions Reference

4 Under the assumption of normal distribution with the parameters given above, you must next determine the cut-off value that represents the top 5% of sales order amounts. To do this, you can use the Confidence plug-in function. The metric to compute the cut-off number is defined as follows, using the metrics defined above: M04 = Confidence(1%, [M02], [M03]). The number 0.01 comes from a normal distribution with 99% confidence level. 5 The metric that calculates the upper bound is defined as follows: M05 = [M01] + [M04]. 6 You must calculate the average sales for each customer to get a list of valuable customers based on the criteria. The metric is defined as follows: Average Sales = Avg(Revenue){~} You do not need to include the level of aggregation for Average Sales since the default {~} notation is replaced by the attribute Customer. 7 You must also apply a metric qualification (filter) to restrict the rows returned to those that meet the definition of valuable customers. The filter is defined as follows: F01 = Average Sales greater than M05 with output level {Customer} To generate a report listing valuable customers, create a report template with attribute Customer on the row axis and attribute Customer Region on the page-by axis. Apply filter F01 to the report to produce a list of valuable

74 Additional examples of functions in expressions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

customers for each attribute element in Customer Region. The Valuable Customers 01 report displays as follows:

The SQL generated for the report Valuable Customers 01 is as follows: Pass0 - Duration: 0:00:00.05 create table ZZT1Y0200Y0MD000 ( CUSTOMER_ID SHORT, WJXBFS1 DOUBLE) Pass1 - Duration: 0:00:00.32 insert into ZZT1Y0200Y0MD000 select a11.[CUSTOMER_ID] AS CUSTOMER_ID, a11.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CUSTOMER_SLS] a11 Pass2 - Duration: 0:00:22.68 select a11.[ORDER_ID] AS ORDER_ID, a11.[EMP_ID] AS EMP_ID, a11.[ORDER_DATE] AS DAY_DATE,
© 2011 MicroStrategy, Inc. Additional examples of functions in expressions

75

1

Understanding Functions in MicroStrategy

MicroStrategy Functions Reference

a12.[CUSTOMER_ID] AS CUSTOMER_ID, a11.[ORDER_AMT] AS WJXBFS1 from [ORDER_FACT] a11, [LU_ORDER] a12 where a11.[ORDER_ID] = a12.[ORDER_ID] Pass3 - Duration: 0:00:09.37 create table ZZT1Y0200Y0MD001 ( CUSTOMER_ID SHORT, WJXBFS1 DOUBLE) Pass4 - Duration: 0:00:00.00 [An Analytical SQL] Pass5 - Duration: 0:00:44.24 insert into ZZT1Y0200Y0MD001 values (26, 105.386485104625) Pass6 - Duration: 0:00:00.02 create table ZZT1Y0200Y0MQ002 ( CUSTOMER_ID SHORT) Pass7 - Duration: 0:00:00.48 insert into ZZT1Y0200Y0MQ002 select pa1.[CUSTOMER_ID] AS CUSTOMER_ID from [ZZT1Y0200Y0MD000] pa1, [ZZT1Y0200Y0MD001] pa2 where pa1.[CUSTOMER_ID] = pa2.[CUSTOMER_ID] and(pa1.[WJXBFS1] > pa2.[WJXBFS1]) Pass8 - Duration: 0:00:02.10 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, [ZZT1Y0200Y0MQ002] 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

76 Additional examples of functions in expressions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

a13.[CUST_STATE_ID] = a14.[CUST_STATE_ID] and a14.[CUST_REGION_ID] = a15.[CUST_REGION_ID] Pass9 - Duration: 0:00:00.36 drop table ZZT1Y0200Y0MD000 Pass10 - Duration: 0:00:00.00 drop table ZZT1Y0200Y0MD001 Pass11 - Duration: 0:00:00.00 drop table ZZT1Y0200Y0MQ002 • Pass0 and Pass1 compute the average sales per customer (Average Sales metric) and put the results in a temporary table. • • • Pass2 brings back three ORDER_AMT facts, puts them into memory, and uses them to compute M01, M02, and M03. Pass 3 creates a temporary table used to store the results of the calculations. Pass4 calculates M02 using the Intelligence Server because the group-value function StDevP is not supported by the Access database. The values of M01, M02 and M03 are used to compute M05. Pass5 inserts the results of the calculations into the temporary table. Pass6 and 7 use the earlier two temporary tables to qualify on valuable customers based on the definition. Pass8 displays the report with attributes Customer and Customer Region. The remaining passes drop the temporary tables.

• • • •

Who are my valuable customers? (Definition 2) This example generates a list of valuable customers based on a different definition from the previous example. Assume a normal distribution of sales orders is still valid, but the cut-off value is for each Customer Region. This means you must compare the average spending of each customer against the average spending of the Customer Region to which the customer belongs. To allow for more variation, take the average value from the year 2003 data, but use sample standard deviations for both years. Use a confidence level of 95%.

© 2011 MicroStrategy, Inc.

Additional examples of functions in expressions

77

1

Understanding Functions in MicroStrategy

MicroStrategy Functions Reference

Valuable customers are defined as those customers who have total spending above the cut-off value. The cut-off value is calculated using the filters and metrics defined below: 1 The filter used to limit the calculation of average sales orders to only 2003 data is defined as follows: 2003 = Year in (2003) 2 The metric used to calculate the average sales order is defined as follows: M07 = Avg(Revenue){[Customer Region], Year, Employee, Order, Day}<2003> 3 The metric used to calculate the standard deviation of sales orders is defined as follows: M08 = StDev(Revenue){Customer Region, [Call Center], Year, Employee, Order, Day} 4 The metric used to determine the cut-off value is defined as follows, using the preceding metrics: M09 = M07 + 1.96 * M08 The number 1.96 comes from a normal distribution with 95% confidence level. In practice, this number is often rounded to 2 instead of 1.96. 5 The metric, used to determine each customer’s spending so that it can be compared to the cut-off value, is defined as follows: M10 = Sum(Revenue){~} 6 The Metric Qualification (filter) needed to restrict the report to a list of valuable customers based on Definition 2 is defined as follows: F03 = M10 greater than M09 with output level {Customer} 7 To view the last order sales from all valuable customers, use the metric defined as follows: Last Order Sales = Sum(Revenue){~, Day} You must compute order sales for each customer at the Day level from the ORDER_FACT table, but must take it from the last Day on that fact table. The {~} is replaced by any attribute on the report. In this example, it is the attribute Customer.
78 Additional examples of functions in expressions
© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Understanding Functions in MicroStrategy

1

Build a report putting the attribute Customer on the row axis, the attribute Customer Region on the page-by axis, the Last Order Sales metric on the column axis, and applying the filter F03. The Valuable Customers 02 report displays as follows.

The SQL generated by the Valuable Customers 02 report is as follows: Pass0 - Duration: 0:00:00.02 create table ZZT1Y0200YAMD000 ( CUSTOMER_ID SHORT, WJXBFS1 DOUBLE) Pass1 - Duration: 0:00:00.37 insert into ZZT1Y0200YAMD000 select a11.[CUSTOMER_ID] AS CUSTOMER_ID, a11.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CUSTOMER_SLS] a11 Pass2 - Duration: 0:00:00.10 create table ZZT1Y0200YAMD001 (
79

© 2011 MicroStrategy, Inc.

Additional examples of functions in expressions

94 select a11.[ORDER_DATE] = a16. a15. [LU_CUSTOMER] a13.[ORDER_ID] and a12.[DAY_DATE] anda16.75 insert into ZZT1Y0200YAMD001 select a15. [LU_CUST_CITY] a14.[ORDER_ID] = a12. [LU_CUST_CITY] a14.[CUST_STATE_ID] = a15.Duration: 0:00:09. a11.[CUSTOMER_ID] and a13.[CUSTOMER_ID] = a13.[CUST_REGION_ID] Pass4 .Duration: 0:00:00.[CUST_STATE_ID] and a11. [LU_ORDER] a12.[ORDER_AMT]) AS WJXBFS1 from [ORDER_FACT] a11.[ORDER_ID] AS ORDER_ID.82 create table ZZT1Y0200YAMD002 ( CUST_REGION_ID BYTE.[CUST_REGION_ID] AS CUST_REGION_ID.[CUST_CITY_ID] and a14.[CUST_STATE_ID] = a15. Inc. [LU_CUST_STATE] a15 where a11.Duration: 0:00:00.[ORDER_ID] = a12.[CUST_CITY_ID] = a14. a11.Duration: 0:00:19.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference CUST_REGION_ID BYTE.[ORDER_DATE] AS DAY_DATE. [LU_DAY] a16 where a11.00 [An Analytical SQL] Pass7 .[EMP_ID] AS EMP_ID. WJXBFS1 DOUBLE) Pass3 .[CUST_REGION_ID] AS CUST_REGION_ID.[ORDER_AMT] AS WJXBFS1 from [ORDER_FACT] a11.[CUSTOMER_ID] = a13.[CUST_CITY_ID] = a14.Duration: 0:00:16.[CUSTOMER_ID] and a13. avg(a11. .[ORDER_ID] and a12. [LU_CUSTOMER] a13.[CUST_STATE_ID] Pass5 . WJXBFS1 DOUBLE) Pass6 .[CUST_CITY_ID] and a14. a11. [LU_CUST_STATE] a15. [LU_ORDER] a12.81 80 Additional examples of functions in expressions © 2011 MicroStrategy.[YEAR_ID] in (2003) group by a15.

[ZZT1Y0200YAMD001] pa2.[ORDER_AMT]) AS WJXBFS1 from [ORDER_FACT] a11.[WJXBFS1]))) Pass10 .361.[WJXBFS1]).94 insert into ZZT1Y0200YANB004 select a11.[CUST_REGION_ID] = pa2.[CUST_STATE_ID] = a13.00 create table ZZT1Y0200YAMQ003 ( CUSTOMER_ID SHORT) Pass9 . 0. [LU_CUST_CITY] a12. a12.[CUSTOMER_ID] Pass12 .[CUST_CITY_ID] = a12.[CUST_REGION_ID] and pa2.[ORDER_ID] and a12. CUSTOMER_ID SHORT.[CUST_REGION_ID] = pa3.[ORDER_DATE] AS DAY_DATE.[CUSTOMER_ID] AS CUSTOMER_ID.[CUSTOMER_ID] AS CUSTOMER_ID from [ZZT1Y0200YAMD000] pa1. © 2011 MicroStrategy.[WJXBFS1]) + IIF(ISNULL(pa3. 0. [ZZT1Y0200YAMD002] pa3 where pa1. a12.Duration: 0:00:00. [LU_ORDER] a12.Duration: 0:00:00.[CUSTOMER_ID] = pa4. WJXBFS1 DOUBLE) Pass11 .47 insert into ZZT1Y0200YAMQ003 select pa1. sum(a11.[WJXBFS1]).02 create table ZZT1Y0200YANB004 ( DAY_DATE TIMESTAMP.276979147296) Pass8 .[ORDER_ID] = a12. pa3.[CUSTOMER_ID] and a11. Additional examples of functions in expressions 81 .MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 insert into ZZT1Y0200YAMD002 values (3.Duration: 0:00:34.Duration: 0:00:00. [ZZT1Y0200YAMQ003] pa4 where a11.[CUSTOMER_ID] = a11.Duration: 0:00:01.[CUST_CITY_ID] and a12.01 create table ZZT1Y0200YAMB005 ( CUSTOMER_ID SHORT.[CUST_REGION_ID] and (pa1.[CUST_STATE_ID] and a13.[WJXBFS1] > (IIF(ISNULL(pa2. Inc. pa2.[CUSTOMER_ID] group by a11. [LU_CUST_STATE] a13. [LU_CUSTOMER] a11.[ORDER_DATE].

[LU_CUST_REGION] a14 where pa5. max(pa5.[CUSTOMER_ID] and a11. [LU_CUSTOMER] a11.[DAY_DATE] = pa6.Duration: 0:00:00.[CUST_STATE_ID] and a13.[CUST_REGION_NAME] AS CUST_REGION_NAME.[CUST_REGION_ID] = a14.Duration: 0:00:05.01 drop table ZZT1Y0200YAMD001 Pass17 .[CUST_CITY_ID] and a12.[CUSTOMER_ID] = a11.[CUSTOMER_ID] AS CUSTOMER_ID. Inc.Duration: 0:00:18. [LU_CUST_CITY] a12. pa5.Duration: 0:00:00.31 drop table ZZT1Y0200YAMD000 Pass16 . a11.01 drop table ZZT1Y0200YANB004 Pass20 .Duration: 0:00:00. a13. 82 Additional examples of functions in expressions © 2011 MicroStrategy.[CUSTOMER_ID] Pass14 . a11.[CUST_LAST_NAME] AS CUST_LAST_NAME.[WJXBFS1] AS WJXBFS1 from [ZZT1Y0200YANB004] pa5.Duration: 0:00:00.Duration: 0:00:00.01 drop table ZZT1Y0200YAMB005 • Pass0 and Pass1 compute metric M10.[CUST_CITY_ID] = a12.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference WJXBFS1 TIMESTAMP) Pass13 .[DAY_DATE]) AS WJXBFS1 from [ZZT1Y0200YANB004] pa5 group by pa5.Duration: 0:00:00. [ZZT1Y0200YAMB005] pa6. [LU_CUST_STATE] a13.[WJXBFS1] and pa5.00 drop table ZZT1Y0200YAMQ003 Pass19 .[CUST_REGION_ID] Pass15 .51 select distinct pa5. .[CUSTOMER_ID] = pa6.[CUSTOMER_ID] and pa5.[CUST_STATE_ID] = a13.[CUST_REGION_ID] AS CUST_REGION_ID.00 drop table ZZT1Y0200YAMD002 Pass18 .[CUST_FIRST_NAME] AS CUST_FIRST_NAME. • Pass2 and Pass3 compute metric M07.65 insert into ZZT1Y0200YAMB005 select pa5. a14.[CUSTOMER_ID] AS CUSTOMER_ID.

Pass6. Pass5. Pass11. This type of data can help you understand how customers spend their money. is not supported by the database (Microsoft Access) so it is calculated by Intelligence Server. All other passes drop the temporary tables. © 2011 MicroStrategy. This example uses analysis to answer the following questions: • • • • • How many customers exist in each customer region? What is the average spending of customers in each customer region? What is the median spending of customers in each customer region? What is the standard deviation of customer spending in each customer region? How much is the 25th and 75th percentile of customer spending in each customer region? These are statistical descriptors about customers in each customer region. How do I learn more about my customers? You can get more information about the customers in each region by performing statistical calculations on their spending.Simple example The report and report components 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\ Statistical Descriptors\Component Objects . Pass8 and Pass9 obtain the list of valuable customers. Additional examples of functions in expressions 83 . Inc. Pass10. and Pass7 compute (1.96 * M08). but instead give information about detailed behavior in each customer region.Simple The Component Objects . • • • • Statistical Descriptors . The group-value function for M08. They are not simple Sum functions for each customer region.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 • Pass4. evaluating the filter condition F03. StDev.Advanced folder contains examples beyond the one explained here. Pass 14 displays the results for the report. Pass12. and Pass13 compute the Last Order Sales metric.

Customer+}){~} 4 This metric determines the standard deviation of customer spending in each region: e. 0.StDev of Revenue Per Customer = Stdev(Sum(Revenue){~ . Customer}){~} 2 This metric determines the average spending of customers in each region: a. Customer}){~} 3 This metric determines the median spending of customers in each region: b. Customer}){~} 5 This metric determines the threshold for the 25th percentile: 25th Percentile of Revenue Per Customer = Percentile(Sum(Revenue){~ .75){~} Create a report and place all of the above metrics on the row axis and place the attribute Customer Region on the column axis. build a set of simple metrics based on other metrics. Execute the report and the Statistical Descriptors . 1 This metric determines the number of customers in each region: Count of Customers = Sum(Count(1){~. Customer}.Simple report displays as follows: 84 Additional examples of functions in expressions © 2011 MicroStrategy.Median Revenue Per Customer = Median(Sum(Revenue){~+. Customer}. .25){~} 6 This metric determines the threshold for the 75th percentile: 75th Percentile of Revenue Per Customer = Percentile(Sum(Revenue){~.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference To answer the questions above.Mean Revenue Per Customer = Avg(Sum(Revenue) {~ . 0. These metrics are defined using nested group-value functions. Inc.

pa1.[CUST_STATE_ID] and a13.01 create table ZZT1Y02011LMD000 ( CUSTOMER_ID SHORT.[CUSTOMER_ID] AS CUSTOMER_ID.Duration: 0:00:00.[WJXBFS1] AS WJXBFS1.[WJXBFS2] AS WJXBFS6 from [ZZT1Y02011LMD000] pa1.[CUST_REGION_ID] = a14. the Northwest customer region has the least number of customers.[WJXBFS2] AS WJXBFS3.Duration: 0:00:00.[CUSTOMER_ID] AS CUSTOMER_ID. pa1. The SQL generated for the Statistical Descriptors .Duration: 0:00:02. a13.[WJXBFS2] AS WJXBFS5.32 insert into ZZT1Y02011LMD000 select a11.[CUST_REGION_ID] Pass3 .[CUST_CITY_ID] and a12. Inc. [LU_CUSTOMER] a11. [LU_CUST_CITY] a12. pa1. For example.[CUST_CITY_ID] = a12.Simple report is as follows: Pass0 .[CUST_STATE_ID] = a13.[TOT_DOLLAR_SALES] AS WJXBFS2 from [CUSTOMER_SLS] a11 Pass2 . 1 AS WJXBFS1.04 select pa1.Duration: 0:00:00.[CUST_REGION_ID] AS CUST_REGION_ID. Additional examples of functions in expressions 85 .20 drop table ZZT1Y02011LMD000 © 2011 MicroStrategy.[WJXBFS2] AS WJXBFS2. a14. pa1.[CUST_REGION_NAME] AS CUST_REGION_NAME.18 [An Analytical SQL] Pass4 .Duration: 0:00:00.[CUSTOMER_ID] = a11. [LU_CUST_STATE] a13. a11. pa1. WJXBFS1 LONG.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 This report provides information on the behavior of customer spending in each customer region. WJXBFS2 DOUBLE) Pass1 .[WJXBFS2] AS WJXBFS4. pa1. [LU_CUST_REGION] a14 where pa1.[CUSTOMER_ID] and a11. but most customers in that region spend more than any other region.

[WJXBFS2].1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference • The first two passes of SQL (Pass0 and Pass1) prepare and calculate the two metrics used in other metrics. Stdev. namely: Count(1){~. Each instance of the column corresponds to each metric that uses it in a calculation. • • Forecasting example The report and report components 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 How to forecast future sales based on existing sales data? The MicroStrategy Tutorial project has sales data for the years 2000 and 2001. 86 Additional examples of functions in expressions © 2011 MicroStrategy. which is essentially Sum(Revenue). The remaining passes drop the temporary tables. The column pa1. . is pulled five times. and Percentile. Inc. • In Pass2 and Pass3 the Intelligence Server pulls results from Pass1 to compute the outer metrics. Linear extrapolation involves the assumption that the trend of past data will continue in a linear fashion. Using this data. Customer} The Intelligence Server optimizes the process by pulling only a single column of Sum(Revenue) even though it is used in several other metrics. Avg. Median. Customer} Sum(Revenue){~. and the same slope and Y-intercept are applied to extend the line into the future. you can forecast potential sales for the years 2002 and 2003. To plot a sales line for the future. In Pass4 the Intelligence Server acts as an in-memory database. apply linear extrapolation techniques to the historical data. using the values from Pass3 to calculate the following group-value functions: Sum. The slope and Y-intercept values are calculated based on historical data.

Year} 2 The metric that expresses the Year elements as a series of integers. Inc. Additional examples of functions in expressions 87 . build a set of metrics that calculate each of the components in the analysis. YearNumber) {~. Year}) 3 The metric that calculates the slope of the line produced by the Revenue {Year} metric is defined as follows: SlopeMetric = Slope([Revenue {Year}]. The metric is defined as follows: Forecast = ((SlopeMetric * YearNumber) + InterceptMetric) © 2011 MicroStrategy. is defined as follows: YearNumber = RunningSum <SortBy= (Year@ID)> (Sum(1) {~. This formula follows the standard formula for a line: y = mx + b. YearNumber) {~. to simplify the analysis. 1 The metric that calculates sales revenue at the Year level is defined as follows: Revenue {Year} = Sum(Revenue) {~. Year} 4 The metric that calculates the Y-intercept of the line produced by the Revenue {Year} metric is defined as follows: InterceptMetric = Intercept([Revenue {Year}]. then use those metrics together to create the final Forecasting metric. Year} 5 The final metric synthesizes the three preceding metrics into a forecast value.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 To perform the analysis.

The Forecast (Graph) report displays as follows: The sales for 2000 and 2001 are actual recorded values. a11. The following SQL is generated for the Forecast (Graph) report. WJXBFS1 DOUBLE) Pass1 . and the sales for 2002 and 2003 are a linear extrapolation of the existing data into the future. A sales forecast is generated for all available years. the Tutorial warehouse must be moved into a database platform that fully supports outer joins.[CATEGORY_ID] AS CATEGORY_ID.[TOT_DOLLAR_SALES] AS WJXBFS1 from [YR_CATEGORY_SLS] a11 88 Additional examples of functions in expressions © 2011 MicroStrategy. Forecast (Grid).[YEAR_ID] AS YEAR_ID.1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference Place the Forecast metric on a report with Year. There is another report in the Forecasting folder. The MicroStrategy Tutorial includes Microsoft Access as its default database.06 create table ZZT1Y0100BWMD000 ( YEAR_ID SHORT.Duration: 0:00:00. a11. . However. it requires the use of outer joins to work properly.02 insert into ZZT1Y0100BWMD000 select a11. in order for the Forecast report to work. Inc. CATEGORY_ID BYTE. This report places the Forecast metric alongside the Revenue metric for comparison. Pass0 .Duration: 0:00:00.

Duration: 0:00:00. [LU_YEAR] a12 group by a12.00 [An Analytical SQL] Pass5 . Additional examples of functions in expressions 89 .[YEAR_ID] AS YEAR_ID.03 create table ZZT1Y0100BWMD001 ( YEAR_ID SHORT. pa1. 1) Pass6 .[WJXBFS1] AS WJXBFS1. 1. [ZZT1Y0100BWMD001] pa2 where pa1.Duration: 0:00:00.02 © 2011 MicroStrategy. pa1.Duration: 0:00:00.[YEAR_ID] Pass7 .01 select pa1.11 insert into ZZT1Y0100BWMD001 values (2000.04 select a12.[CATEGORY_ID] and pa1.[WJXBFS3] AS WJXBFS4 from [ZZT1Y0100BWMD000] pa1.Duration: 0:00:00.0) AS WJXBFS1 from [LU_CATEGORY] a11. sum(1.00 [An Analytical SQL] Pass9 .[YEAR_ID] AS YEAR_ID.[WJXBFS1] AS WJXBFS3. a11. WJXBFS1 DOUBLE. 1. 1. pa2. WJXBFS3 DOUBLE) Pass4 .[YEAR_ID].Duration: 0:00:00.[CATEGORY_ID] Pass3 . a11. CATEGORY_ID BYTE.[YEAR_ID] = pa2. WJXBFS2 DOUBLE.03 create table ZZT1Y0100BWMD002 ( CATEGORY_ID BYTE. WJXBFS1 DOUBLE.[CATEGORY_ID] AS CATEGORY_ID.Duration: 0:00:00.Duration: 0:00:00.[CATEGORY_ID] = pa2.[CATEGORY_ID] AS CATEGORY_ID. pa2.Duration: 0:00:00.MicroStrategy Functions Reference Understanding Functions in MicroStrategy 1 Pass2 . pa1.[WJXBFS1] AS WJXBFS2. Inc. WJXBFS2 DOUBLE) Pass8 .

01 drop table ZZT1Y0100BWMD002 • Pass0 and Pass1 calculate the Revenue {Year} metric. 33788. • • • 90 Additional examples of functions in expressions © 2011 MicroStrategy. this forces the metric into its own pass of SQL (instead of sharing Pass #02 with the Revenue {Year} metric).1 Understanding Functions in MicroStrategy MicroStrategy Functions Reference insert into ZZT1Y0100BWMD002 values (1. (IIF(ISNULL((pa3. (pa3. pa2.25) Pass10 .[CATEGORY_ID] = pa3. -559. a11.Duration: 0:00:00.[WJXBFS2])). Consequently.[WJXBFS2]).00 drop table ZZT1Y0100BWMD001 Pass13 .[YEAR_ID] AS YEAR_ID. • Pass2 calculates the inner portion of the YearNumber metric.[WJXBFS1] * pa2. and InterceptMetrics. In Pass10.Duration: 0:00:00.[WJXBFS2])) AS WJXBFS1 from [ZZT1Y0100BWMD001] pa2.Duration: 0:00:00. The mx+b calculation can be seen in the SQL. 0. Inc. The Intelligence Server performs the calculations based on the data in the temporary table from passes 0 to 2. assigning the integer 1 to each year available in the LU_YEAR lookup table.Duration: 0:00:00.[CATEGORY_ID] and pa2. Values are calculated and inserted back into the temporary tables.01 drop table ZZT1Y0100BWMD000 Pass12 . not just the years with data in the fact table. Note that this metric was defined by adding “Year” dimensionality with filtering “None”.[CATEGORY_DESC] AS CATEGORY_DESC. [ZZT1Y0100BWMD002] pa3. SlopeMetric.[CATEGORY_ID] = a11.[WJXBFS1] * pa2. all years in the lookup table get numbered. 0.[CATEGORY_ID] Pass11 . Passes 3 to 9 calculate the YearNumber. [LU_CATEGORY] a11 where pa2. . the Forecast metric is calculated based on the information from all of the previous calculations.25.[WJXBFS2])) + IIF(ISNULL(pa3.01 select pa2. pa3. The remaining passes drop the temporary tables.[CATEGORY_ID] AS CATEGORY_ID.

page 131 NULL/Zero functions. page 221 © 2011 MicroStrategy. STANDARD FUNCTIONS Introduction The standard functions in this chapter range from simple operations like Sum and Product to internal functions that allow you to define your own metrics. Taken as a set. and filters. page 201 String functions. validating data. The following categories of functions are covered: • • • • • • • Basic functions. page 92 Date and time functions. facts. page 118 Internal functions. grouping data. they provide a powerful toolset for performing common mathematical calculations. page 150 Rank and NTile functions. examining correlation.2 2. 91 . Inc. page 148 OLAP functions. and formatting report information for display.

Min. . The information provided for each function includes • • An explanation of the data returned by the function The syntax of the function including function name. which returns the sum of values in a single value list. available parameters. page 114). See Appendix A. invalid data types. You can also construct these types of metrics using the plus operator (see Plus (+). MicroStrategy and Database Support for Functions. or key information to know before using the function (if applicable) An example of the function in use. Inc. and are among the most commonly used functions. and so on. • • • Basic functions These are basic mathematical functions like Avg. Least. 92 Basic functions © 2011 MicroStrategy. Greatest. this may be either a report example or a simple text description of the data returned based on the specified input Note the following: • • The report examples in this section use objects and data found in the MicroStrategy Tutorial. page 237) instead of the Add function. and the types of data that can be used with the function The mathematical expression illustrating exactly how the calculation is defined in MicroStrategy (if applicable) Usage notes describing any error conditions. for a list of the databases and the functions they support. the parameter setting defaults.2 Standard Functions MicroStrategy Functions Reference Each section in this chapter describes a function category and presents a list of functions within each category. The Add function differs from the Sum function (see Sum. Add can take multiple metrics as inputs and add the values of the metrics. Add Returns the sum of two or more values. Each section also presents the data necessary to understand and implement each individual function. Max.

In the report shown below. which returns the average of values in a single value list. Average Average performs a sum of a set of values and divides this total by the number of values in the set. Basic functions 93 . This returns the average (also known as arithmetic mean) for the set of values.. Inc. ArgumentN) Where The arguments must be metrics or constants.. The Average function can take multiple metrics as inputs and average the values of the metrics. © 2011 MicroStrategy. the Total Paid Compensation metric uses the formula Add([Paid Bonus]. You can use this function to compute and display the average of two or more metrics on a report. Example You can use the Add function to return the sum of related metrics.MicroStrategy Functions Reference Standard Functions 2 Syntax Add(Argument1. Argument2. The Average function differs from the Avg function (see Avg (average). page 94)..[Paid Salary]) to return the total compensation paid to each employee.. This report was created in the MicroStrategy Human Resources Analysis Module.

The Count function is most commonly used to aggregate attributes. see Count. Inc. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. FactID. Distinct is a TRUE/FALSE parameter that allows you to use all values in the calculation or to calculate using only the unique values. This returns the average (arithmetic mean) of the listed values. This is a group-value function. Avg (average) Avg calculates the sum of a single value list and divides the result by the number of values in the list.9. fact. UseLookupForAttributes is a TRUE/FALSE parameter that can be used when performing an aggregation of an attribute.. Syntax Avg<Distinct. Avg is often used to create subtotals and metrics based on fact data. Example Example 1: In this simple example the average of a value list containing the values (4.2. Argument2. . ArgumentN) Where: The arguments must be metrics or constants.. For information on this parameter. including an example of using it with the Count function.. Usage notes The Avg function ignores NULL values but uses zero values in its calculation.. or metric representing a list of numbers. UseLookupForAttributes>(Argument) Where: • • • • Argument is an attribute. page 95.9) is calculated as follows: 94 Basic functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference Syntax Average(Argument1.

Employee. page 8. and Salary as well as the metric Average Salary. Count Count returns the number of elements in a list of values. UseLookupForAttributes. see Example 1: Transformed fact. The report contains the attributes Region. Basic functions 95 . For further examples of using the Avg function. This is a group-value function. © 2011 MicroStrategy. A report filter limits the regions displayed to Northeast and Southeast. Distinct is a TRUE/FALSE parameter that allows you to count all elements in a list or only the unique elements. Null> (Argument) Where: • • Argument is an attribute. Syntax Count<Distinct. or metric representing a list of values. resulting in the regional average salary. fact. FactID. The metric Average Salary is defined as follows: Avg(Salary){Region} The function sums all salaries within a region and divides by the number of values.MicroStrategy Functions Reference Standard Functions 2 (4+9+2+9)/4 = 6 Example 2: This report obtains the average salary for employees in each region. Inc. as well as Example 1: Average. page 7 and Example 2: Compound metric. page 7.

and Southwest. the aggregation is done for all elements of an attribute. South.2 Standard Functions MicroStrategy Functions Reference • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Example This example creates a report that calculates the count of employees in each region. ~}. UseLookupForAttributes is a TRUE/FALSE parameter that can be used when performing an aggregation of an attribute: If you set this parameter to TRUE. and the metric # of Employees. If you set this parameter to FALSE. The function counts each entry within a region and returns the last number in the count. . Southeast. including duplicate elements that can be included by displaying additional attributes on a report. 96 Basic functions © 2011 MicroStrategy. For an example of how to use this parameter. A report filter limits the regions displayed to Central. see Performing counts of attributes. excluding any duplicates caused by additional attributes on the report. the aggregation is done for the unique set of attribute elements. The metric # of Employees is defined as follows: Count(Employee){Region. page 97. Inc. The report contains the attributes Region and Employee.

the Count function counts each listing of the Customer attribute element. • For information on creating derived metrics. The expression used to define the derived metric is Count<UseLookupForAttributes=False>(Customer){} . Inc. the Count function ignores any multiple listings of each Customer attribute element. the Count function is commonly used to count the number of elements for an attribute. By defining the parameter UseLookupForAttributes=True. each separate item is ignored and only the unique attribute elements for Customer are counted. The expression used to define the derived metric is Count<UseLookupForAttributes=True>(Customer){} .MicroStrategy Functions Reference Standard Functions 2 Performing counts of attributes While most functions are commonly used with facts and metrics. see the OLAP Services Guide. each separate item is counted. This report also uses two derived metrics to display the following count information: • Number of Customers: This derived metric displays the count of customers. Basic functions 97 . In the report shown above. which provides a count of customer purchases. the report shown below displays the customer revenue for each item they purchased. In the report shown above. For example. By defining the parameter UseLookupForAttributes=False. Number of Customer Purchases: This derived metric displays the count of customer purchases. along with other OLAP Services features. © 2011 MicroStrategy.

This is a group-value function that shares the sort by capability of the OLAP functions. Quarter. Year) >([Units Received]){@} 98 Basic functions © 2011 MicroStrategy. returning the units received for the first quarter containing a value in 2003. the First function defines the subtotal for the metric units received. Example The First function is often used to define subtotals. The expression defines the subtotal as follows: First<SortBy= (Day. Inc.2 Standard Functions MicroStrategy Functions Reference First Returns the result of an aggregate applied over a set of rows that ranks as the first within a specified order. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. In this example. fact. Syntax First<FactID. SortBy>(Argument) Where: • • • Argument is an attribute. SortBy is a parameter that allows you to define the attribute or metric on which to sort the data. . Month. or metric representing a list of values.

Inc. For detailed instructions on creating and applying user-defined subtotals. GeoMean (geometric mean) This function can be used to find the average for a set of values contributing to a product. or metric representing a list of numbers. GeoMean is a group-value function. This function takes the product of a set of values of size N and returns the Nth root of the result (also known as geometric mean). Syntax GeoMean <FactID>(Argument) Where: • Argument is an attribute. 99 . Basic functions © 2011 MicroStrategy. While the Avg function is used to find the arithmetic mean for a set of values contributing to a sum. GeoMean can be used to determine the average growth rate for a given compound interest with variable rates. see the MicroStrategy Advanced Reporting Guide. fact.MicroStrategy Functions Reference Standard Functions 2 Argument is the metric to which the subtotal is applied.

. Inc. and 20% the third year.20. Expression GM y = n y 1 y 2 y 3 …y n Usage notes This function returns an error if a value in the value list is negative.. It is used for comparisons between metrics. and in the third year by 1.283 The geometric mean is 1.10 * 1.60 * 1. (1.283... the second year by 1. Example Suppose you have an investment that earns 10% the first year. which returns the largest value in a single value list. The Greatest function differs from the Max function. so the average rate of return is about 28%.10. Greatest can take multiple lists as input and compare the elements in the lists. Syntax Greatest(Argument1. and so forth. This can be understood as looking for a constant that you can multiply each year’s investment by. Argument2.10. This constant is the geometric mean. ArgumentN) Where: The arguments must be metrics. Greatest Returns the larger of two or more values. and get the same result as multiplying the first year by 1. because these numbers show that in the first year your investment was multiplied by 1. The average is the geometric mean of these three numbers.. and you want to answer the question “What is its average rate of return?” You do not want to use the Avg function to obtain the arithmetic mean. in the second year by 1.60. 60% the second year.20)1/3 = 1. 100 Basic functions © 2011 MicroStrategy.60.2 Standard Functions MicroStrategy Functions Reference • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

This is a group-value function. returning the total items on hand in the last quarter of 2003. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Basic functions 101 . Syntax Last<FactID. fact. or metric representing a list of values. as shown in the example below. the function compares the values in each position in the list and returns a list containing the highest numbers from each position. Example In this example. List 1 21 18 42 30 7 List 2 50 3 22 6 20 Result List 50 18 42 30 20 Last The Last function returns the last value in a sorted set of values. Given two value lists. The subtotal expression is defined as follows: © 2011 MicroStrategy. Inc.MicroStrategy Functions Reference Standard Functions 2 Example This simple example illustrates how data is returned by the Greatest function. Last is used in the subtotal for the metric End on Hand. SortBy is a parameter that allows you to define the attribute or metric on which to sort the data. It is often used to define subtotals. SortBy>(Argument) Where: • • • Argument is an attribute.

which returns the smallest value in a single value list. The Least function differs from the Min function.. Quarter.. Syntax Least(Argument1. . 102 Basic functions © 2011 MicroStrategy. see the MicroStrategy Advanced Reporting Guide. Argument2. Least can take multiple lists as input and compare the elements of the lists.. Year) >(End on Hand) {@ } For detailed instructions on creating and applying user-defined subtotals. Least This function returns the smaller of two or more values.. ArgumentN) Where: The arguments must be metrics. This is a single-value function. It is used for comparisons between metrics.2 Standard Functions MicroStrategy Functions Reference Last<SortBy= (Day. Month. Inc.

Given two values lists. including an example of using it with the Count function. use the Greatest function. List 1 21 18 42 30 7 List 2 50 3 22 6 20 Result List 21 3 22 6 7 Max (maximum) Max returns the largest value in a list of values. UseLookupForAttributes is a TRUE/FALSE parameter that can be used when performing an aggregation of an attribute. page 95. This is a group-value function. Syntax Max <FactID. The Count function is most commonly used to aggregate attributes. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. see Count. the function compares the values at each position in the lists and returns a list of the lowest values from each position. © 2011 MicroStrategy. fact or metric representing a list of numbers. Inc. For information on this parameter.MicroStrategy Functions Reference Standard Functions 2 Example This simple example illustrates how data is returned by the Least function. To compare the highest values in multiple lists of values. For example. it can be used on a list of prices to determine the maximum cost of an item. UseLookupForAttributes>(Argument) Where: • • • Argument is an attribute. Basic functions 103 .

Maximum Unit Cost. The resulting report appears as follows: 104 Basic functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference Example This example shows a report displaying the cost range of items within a subcategory. The Max function is used to determine the highest cost of an item within a subcategory. The metric. Inc. is defined as follows: Maximum([Unit Cost]) {~} The metric is placed on a report with the attributes Category and Subcategory and the metric Minimum Unit Cost. .

fact or metric representing a list of numbers. Basic functions 105 . Employee. Northeast. and Southeast.MicroStrategy Functions Reference Standard Functions 2 Median Median returns the value in the middle of a set of listed values. A report filter limits the regions displayed to Mid Atlantic. The metric Median Age is defined as follows: Median([Employee Age){Region. Mode is another function that provides a location measure. and the metric Median Age. The report includes the attributes Region.~} © 2011 MicroStrategy. Inc. Example This example shows a report built to obtain the median age of employees within each region. and Employee Age. Usage notes This function provides a location measure: the value returned has a relative position with regard to other values in the list. This is a group-value function. The result will be greater than half the values in the list and less than the other half. The median can be used as an alternative to the arithmetic mean when handling values that are not evenly distributed or contain outliers. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Syntax Median <FactID>(Argument} Where: • • Argument is an attribute.

To compare the lowest values in multiple lists of values. UseLookupForAttributes>(Argument) Where: • • Argument is an attribute. or metric representing a list of numbers. see Example 2: Median. This is a group-value function. Min (minimum) Min returns the lowest value in a list of values. Syntax Min <FactID.2 Standard Functions MicroStrategy Functions Reference The function evaluates the list of employee ages within a region and selects a value in the middle of the value list. it can be used on a list of prices to determine the minimum cost of an item. page 8. For another example of using the Median function. Inc. 106 Basic functions © 2011 MicroStrategy. For example. fact. . use the Least function. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

For information on this parameter. Inc. The Min function is used to determine the lowest cost of an item within a subcategory. The metric Minimum Unit Cost is defined as follows: Minimum([Unit Cost]) {~} The metric is placed on a report with the attributes Category and Subcategory and the metric Maximum Unit Cost. including an example of using it with the Count function. Example This example shows a report displaying the cost range of items within a subcategory.MicroStrategy Functions Reference Standard Functions 2 • UseLookupForAttributes is a TRUE/FALSE parameter that can be used when performing an aggregation of an attribute. see Count. © 2011 MicroStrategy. Basic functions 107 . page 95. The Count function is most commonly used to aggregate attributes.

IsRemovable>(Argument) Where: • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. • Example This example shows a report that retrieves the mode of the unit cost for items in a subcategory. Returns a NULL if there are no recurring values in the range or list. • Argument is an attribute. TVs. For example. the IsRemovable parameter has no effect on the result of the Mode function. IsRemovable=False returns a NULL value as the results of the Mode function when a single value is supplied. it returns a NULL value. The report returns the most frequently repeated unit cost within the various subcategories. as described below: IsRemovable=True returns the single value as the result of the Mode function. or metric representing a list of numbers. Mode<IsRemovable=True>(4) would return the value 4. The report contains the attributes Category and 108 Basic functions © 2011 MicroStrategy. in the cases of Electronics. Usage notes • This function provides a location measure: the value returned has a relative position with regard to other values in the list. Median is another function that provides a location measure. Inc. fact. Syntax Mode <FactID. . and. If multiple values are supplied to the Mode function. Mode<IsRemovable=False>(4) would return NULL. because there are no recurring unit cost values for them. and Video Equipment.2 Standard Functions MicroStrategy Functions Reference Mode Returns the most frequently occurring value in a given list. This is a group-value function. For example. IsRemovable is a parameter that determines whether the Mode of a single value returns that value or a NULL value.

MicroStrategy Functions Reference Standard Functions 2 Subcategory. ArgumentN) Where: The arguments must be metrics or constants. The Multiply function can take multiple metrics as inputs and multiply the values of the metrics.. page 236) rather than the Multiply function. Basic functions 109 . Syntax Multiply(Argument1. Multiply Multiply returns the product of two or more values.. Inc. Argument2.. The Mode Unit Cost metric is defined as follows: Mode([Unit Cost]) The formula listed above uses the Unit Cost fact rather than the Unit Cost metric.. and the metric Mode Unit Cost. You can also construct these types of metrics using the times operator (see Times (*). which returns the product of values in a single value list. A report filter limits the categories displayed to Books and Electronics. page 110). This function differs from the Product function (see Product. © 2011 MicroStrategy.

2 Standard Functions MicroStrategy Functions Reference Example In the report shown below.[Units Sold]) to return the revenue for each item. the Unit Profit metric uses the formula Multiply([Unit Price]. . FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. 110 Basic functions © 2011 MicroStrategy. Product Multiplies all values in a list.3. Inc.2. This is a group-value function. fact. Syntax Product<FactID>(Argument) Where • • Argument is an attribute. Example Given a value list containing the values (1.4). the product calculates as 1*2*3*4 = 24. or metric representing a list of numbers. This report was created in the MicroStrategy Tutorial project.

this function and the Standard deviation of a sample function return approximately equal results. This calculation is based on the assumption that the list of values supplied in the metric represents the entire population of the data for which you want to obtain the standard deviation. Inc. see Standard deviation of a sample. It is a group-value function. arguments correspond to an entire population as opposed to a population sample. When very large population samples are used.MicroStrategy Functions Reference Standard Functions 2 StDevP (standard deviation of a population) The standard deviation is a value which shows how widely values in a population differ from the mean. 111 © 2011 MicroStrategy. fact. For population samples. Compare this example report to the example for StDev to see the different values returned when calculating for a population as opposed to a sample. StDevP returns the standard deviation of a population represented by list of values. It is useful for comparing different sets of values with a similar mean. or metric representing a list of numbers. 2 2 • Example This example shows a report where the standard deviation of the revenue is calculated. Syntax StDevP <FactID >(Argument) Where: • • Argument is an attribute. The calculation is based on the revenue values for each state within a region and calculated at the region level. Basic functions . Expression n∑ x – (∑ x) --------------------2 n Usage notes • For this function. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

or metric representing a list of numbers. The definition of the StDevP metric is as follows: StDevP([Total Revenue]){[Customer Region]. A report filter limits the regions displayed to South. . Syntax StDev <Distinct. FactID>(Argument) Where: • Argument is an attribute. and the metrics Total Revenue and StDevP. Inc. StDev returns the standard deviation of a population based on a sample.2 Standard Functions MicroStrategy Functions Reference The report contains the attributes Customer Region and Customer State. It is useful for comparing different sets of values with a similar mean. fact. 112 Basic functions © 2011 MicroStrategy. This is a group-value function. ~} StDev (standard deviation of a sample) The standard deviation is an indicator of how widely values in a group differ from the mean. Northwest. and Southwest.

The report contains the attributes Customer Region and Customer State. arguments correspond to a population sample as opposed to the entire population. and the metrics Total Revenue and StDev. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Basic functions 113 . this function and the Standard deviation of a population function return approximately equal results. This calculation is based on the assumption that the list of values supplied in the metric represents a sample of the data for which you want to obtain the standard deviation. The calculation is based on the revenue values for each state within a region and calculated at the region level. A report filter limits the regions displayed to South.MicroStrategy Functions Reference Standard Functions 2 • • Distinct is a TRUE/FALSE parameter that allows you to calculate using all values in the list or only the unique values. Northwest. see Standard deviation of a population. For entire populations. The definition of the StDev metric is as follows: StDev([Total Revenue]){[Customer Region]. Expression n∑ x – (∑ x) --------------------n( n – 1) Usage notes • In this function. Compare this example report to the example for StDevP to see the different values returned when calculating for a population as opposed to a sample. Inc. When very large population samples are used. 2 2 • Example This example shows a report where the standard deviation of the revenue is calculated. ~} © 2011 MicroStrategy. and Southwest.

or metric representing a list of numbers. Inc. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. fact. For information on this parameter. Syntax Sum <Distinct. 114 Basic functions © 2011 MicroStrategy. This function is commonly used in metrics and subtotals. . including an example of using it with the Count function. Sum is a group-value function. The Count function is most commonly used to aggregate attributes. UseLookupForAttributes>(Argument) Where: • • • • Argument is an attribute. see Count.2 Standard Functions MicroStrategy Functions Reference Sum Returns the sum of all numbers in a list of values. FactID. UseLookupForAttributes is a TRUE/FALSE parameter that can be used when performing an aggregation of an attribute. page 95. Distinct is a TRUE/FALSE parameter that allows you to calculate using all values in the list or only the unique values.

This is a group-value function. ~} This simple report uses the attributes Customer Region and Customer State. 115 . fact. Northwest. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.MicroStrategy Functions Reference Standard Functions 2 Example In this example. or metric representing a list of numbers. Syntax VarP <FactID>(Argument) Where: • • Argument is an attribute. and Southeast. VarP returns this measure based on an entire population. the metric Regional Revenue is defined as follows: Sum(Revenue) {[Customer Region]. and the metrics Revenue and Regional Revenue to generate a report showing the sum of the revenue for several regions. Basic functions © 2011 MicroStrategy. Inc. VarP (variance of a population) Variance is a measure of how spread out a set of values is. A report filter limits the regions displayed to Northeast.

Inc.2 Standard Functions MicroStrategy Functions Reference Expression n∑ x – (∑ x) --------------------2 n Usage notes For this function. . ~} 2 2 116 Basic functions © 2011 MicroStrategy. arguments relate to an entire population as opposed to a population sample. Compare this example report to the example for variance of a sample to see the different values returned when calculating for a population as opposed to a sample. This example creates a report in which the variance of the units sold in the subcategories within a category is calculated with the assumption that the data provided represents the entire population. The VarP by Category metric is defined as follows: VarP([Units Sold]) {Category. and the metrics Units Sold and VarP by Category. Example Variance is calculated as the average squared deviation of each number from its mean. A report filter limits the categories displayed to Books and Movies. The report includes the attributes Category and Subcategory.

Basic functions 117 . Compare this example report to the example for variance of a population to see the different values returned when calculating for a population as opposed to a sample. fact. This function calculates the variance based on a sample of a population. or metric representing a list of numbers. Inc. It is calculated as the average squared deviation of each number from its mean. Example This example creates a report in which the variance of the units sold in the subcategories within a category is calculated. The Var by Category metric is defined as follows: © 2011 MicroStrategy. The report includes the attributes Category and Subcategory. FactID>(Argument) Where: • • • Argument is an attribute. Distinct is a TRUE/FALSE parameter that allows you to calculate using all values in the list or only the unique values.MicroStrategy Functions Reference Standard Functions 2 Var (variance of a sample) Variance is a measure of how spread out a set of values is. Expression 2 2 n∑ x – (∑ x) --------------------n( n – 1) Usage notes Assume when using this function that arguments constitute a population sample. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. This is a group-value function. and the metrics Units Sold and Var by Category. Syntax Var <Distinct. A report filter limits the categories displayed to Books and Movies. as opposed to a entire population. with the assumption that the data provided is a sample.

For information on whether your database supports various date and time functions. The MicroStrategy Analytical Engine does not calculate date and time functions. It returns this information in the form of a date or timestamp. Inc. ~} Date and time functions This section describes the date and time functions. refer to Appendix A. The results returned by the date/time functions may differ depending on the way your database stores and interprets dates. the function cannot be calculated in your environment. whether Monday is considered the first or second day of the week. so they must be calculated by the database. AddDays AddDays is used to calculate dates that occur N days before or after a given date. MicroStrategy and Database Support for Functions.2 Standard Functions MicroStrategy Functions Reference Var([Units Sold]) {Category. for example. If your database does not include SQL syntax support for a date and time function. . These functions are not supported by the Analytical Engine. 118 Date and time functions © 2011 MicroStrategy.

Offset) Where: • • Date/Time is the input date or timestamp.Offset) Where: • • Date/Time is the input date or timestamp. For information on whether your database supports various date and time functions. 4) = 2004-08-02 AddDays('2004-07-29 02:00:00'. the last date of the new month is returned. Inc. refer to Appendix A. Syntax AddMonths(Date/Time. Offset is an integer number of months to add. Example AddDays('2004-07-29'. If the new date does not occur in the new month. Offset is an integer number of days to add. refer to Appendix A. 4) = 2004-08-02 02:00:00 AddDays('2004-03-01'. For information on whether your database supports various date and time functions. © 2011 MicroStrategy. Date and time functions 119 . MicroStrategy and Database Support for Functions. MicroStrategy and Database Support for Functions.MicroStrategy Functions Reference Standard Functions 2 Syntax AddDays(Date/Time. -4) = 2004-02-26 AddMonths AddMonths is used to calculate dates that occur N months before or after a given date. It returns this information in the form of a date or timestamp.

MicroStrategy and Database Support for Functions. 3) = 2004-10-29 10:00:00 AddMonths('2003-03-31'. MicroStrategy and Database Support for Functions. refer to Appendix A. 3) = 2004-10-29 AddMonths('2004-07-29 10:00:00'. This function does not take input variables. Syntax CurrentDate() For information on whether your database supports various date and time functions. CurrentDateTime Returns the current date and time as provided by the database timer. Inc. refer to Appendix A. -1) = 2003-02-28 CurrentDate Returns the current date as provided by the database timer. This function does not take input variables. . 120 Date and time functions © 2011 MicroStrategy. Syntax CurrentDateTime() For information on whether your database supports various date and time functions.2 Standard Functions MicroStrategy Functions Reference Example AddMonths('2004-07-29'.

not rounded. Date Returns only the date portion of the date-time column. © 2011 MicroStrategy. Example Date('2004-07-29') = 2004-07-29 Date('2004-07-29 02:00:00') = 2004-07-29 DayofMonth Returns a number corresponding to the day of the month of the date provided. For information on whether your database supports various date and time functions. Syntax CurrentTime() For information on whether your database supports various date and time functions. refer to Appendix A. Date and time functions 121 . MicroStrategy and Database Support for Functions. This function does not take input variables. refer to Appendix A. The value returned is an integer between 1 and 31. Syntax Date(Date/Time) Where: Date/Time is the input date or timestamp. Inc. MicroStrategy and Database Support for Functions.MicroStrategy Functions Reference Standard Functions 2 CurrentTime Returns the current time as provided by the database timer. The time is truncated.

For information on whether your database supports various date and time functions. output is the integer 6. For information on whether your database supports various date and time functions. The return value is an integer between 1 and 7. output is the integer 10. Example Input is the date 5/16/2003.2 Standard Functions MicroStrategy Functions Reference Syntax DayofMonth(Argument) Where: Argument is a metric representing a list of dates. 122 Date and time functions © 2011 MicroStrategy. Input is the date 2003/10/10. Input is the date 2003/9/9. output is the integer 11. Example Input is the date 7/11/2002. DayofWeek Returns the number of the day in the week corresponding to the input date. output is the integer 3. Syntax DayofWeek(Argument) Where: Argument is a metric representing a list of dates. refer to Appendix A. . MicroStrategy and Database Support for Functions. Inc. refer to Appendix A. MicroStrategy and Database Support for Functions.

output is the integer 48. © 2011 MicroStrategy. Syntax DaysBetween(Date/Time1. as they are truncated before performing the calculation. The calculation of the difference is based on the number of day boundaries crossed. For information on whether your database supports various date and time functions. refer to Appendix A. MicroStrategy and Database Support for Functions.MicroStrategy Functions Reference Standard Functions 2 DayofYear Returns the number of the day in the year of the input date. Date and time functions 123 . not the number of twenty-four hours periods elapsed. If the first date argument is later than the second date argument. DaysBetween Returns the difference in days between two given dates as an integer value. The result does not display the time stamps. Inc. the result is a negative number. Date/Time2 is the end date. Syntax DayofYear(Argument) Where: Argument is a metric representing a list of dates. The return value is an integer between 1 and 365. output is the integer 16. Example Input is the date 1/16/2003. Input is the date 2/17/2003. Date/Time2) Where: • • Date/Time1 is the start date.

The return value is an integer between 0 and 23. For information on whether your database supports various date and time functions. refer to Appendix A.2 Standard Functions MicroStrategy Functions Reference For information on whether your database supports various date and time functions. Syntax Hour(Argument) Where: Argument is a metric representing a list of dates and times. Example Input is the time 9:45 am. Millisecond Returns the integer value for the millisecond of the input time. Input is the time 11:10 pm. '2004-07-31 01:00:00') = 2 Hour Returns the integer value for the hour of the input time. refer to Appendix A. MicroStrategy and Database Support for Functions. Syntax Millisecond(Argument) 124 Date and time functions © 2011 MicroStrategy. output is the integer 9. . MicroStrategy and Database Support for Functions. '2004-07-25') = -4 DaysBetween('2004-07-29 02:00:00'. Inc. Examples DaysBetween('2004-07-29'. output is the integer 23.

Syntax Minute(Argument) Where: Argument is a metric representing a list of dates and times. output is the integer 45. Input is the time 11:10 pm. Date and time functions 125 . MicroStrategy and Database Support for Functions. Inc. For information on whether your database supports various date and time functions. Syntax Month(Argument) © 2011 MicroStrategy. The return value is an integer between 0 and 59. The return value is an integer between 1 and 12. For information on whether your database supports various date and time functions. Example Input is the time 9:45 am. refer to Appendix A. MicroStrategy and Database Support for Functions. output is the integer 10. Minute Returns the integer value for the minute of the input time. refer to Appendix A. Month Returns the number of the month in the year of the input date.MicroStrategy Functions Reference Standard Functions 2 Where: Argument is a metric representing a list of dates and times.

2 Standard Functions MicroStrategy Functions Reference Where: Argument is a metric representing a list of dates. Example Input is the date 5/16/2003. MicroStrategy and Database Support for Functions. output is the integer 9. MicroStrategy and Database Support for Functions. For information on whether your database supports various date and time functions. Inc. Syntax MonthEndDate(Date/Time) Where: Date/Time is the input date or timestamp. refer to Appendix A. For information on whether your database supports various date and time functions. Example MonthEndDate('2004-07-29') = 2004-07-31 MonthEndDate('2004-07-29 02:00:00') = 2004-07-31 MonthStartDate Returns the date of the first day of the month in which a date or timestamp occurs. Input is the date 2003/9/3. output is the integer 5. . 126 Date and time functions © 2011 MicroStrategy. refer to Appendix A. MonthEndDate Returns the date of the last day of the month in which a date or timestamp occurs.

The result does not display the timestamps. Example MonthStartDate('2004-07-29') = 2004-07-01 MonthStartDate('2004-07-29 02:00:00') = 2004-07-01 MonthsBetween Returns the difference in months between two dates as an integer value. Syntax MonthsBetween(Date/Time1. The difference is calculated by the number of months elapsed and not by the number of month boundaries crossed. If the first date argument is later than the second date argument. MicroStrategy and Database Support for Functions. For information on whether your database supports various date and time functions. '2004-02-28') = -5 © 2011 MicroStrategy. Inc. For information on whether your database supports various date and time functions. Example MonthsBetween('2004-07-29'. the result is a negative number.MicroStrategy Functions Reference Standard Functions 2 Syntax MonthStartDate(Date/Time) Where: Date/Time is the input date or timestamp. MicroStrategy and Database Support for Functions. Date/Time2 is the end date. Date and time functions 127 . as they are truncated before performing the calculation. Date/Time2) Where: • • Date/Time1 is the start date. refer to Appendix A. refer to Appendix A.

For information on whether your database supports various date and time functions. For information on whether your database supports various date and time functions. Syntax Quarter(Argument) Where: Argument is a metric representing a list of dates. Example Input is the date 5/16/2003. MicroStrategy and Database Support for Functions. 128 Date and time functions © 2011 MicroStrategy. Inc. The return value is an integer between 0 and 59. '2004-09-29 01:00:00') = 2 Quarter Returns the number of the quarter in the year of the input date. refer to Appendix A. The return value is an integer between 1 and 4. output is the integer 4.2 Standard Functions MicroStrategy Functions Reference MonthsBetween('2004-07-29 02:00:00'. output is the integer 2. Syntax Second(Argument) Where: Argument is a metric representing a list of dates and times. Input is the date 2003/9/3. MicroStrategy and Database Support for Functions. Second Returns the integer value for the second of the input time. . refer to Appendix A.

MicroStrategy and Database Support for Functions. Input is the date 2003/9/9. refer to Appendix A. output is the integer 47. Example Input is the date 5/16/2003. © 2011 MicroStrategy. Inc. The return value is an integer between 1900 and 9999. For information on whether your database supports various date and time functions. Input is the time 11:10:47 pm. Syntax Week(Argument) Where: Argument is a metric representing a list of dates. Week Returns the number of the week in the year of the input date. output is the integer 13. Syntax Year(Argument) Where: Argument is a metric representing a list of dates. output is the integer 20.MicroStrategy Functions Reference Standard Functions 2 Example Input is the time 9:45:13 am. output is the integer 37. The return value is an integer between 1 and 54. Year Returns the year of the input date. Date and time functions 129 .

Syntax YearStartDate(Date/Time) 130 Date and time functions © 2011 MicroStrategy. refer to Appendix A. MicroStrategy and Database Support for Functions. Syntax YearEndDate(Date/Time) Where: Date/Time is the input date or timestamp. output is the integer 2002. Inc. MicroStrategy and Database Support for Functions. output is the integer 2003. Example YearEndDate('2004-07-29') = 2004-12-31 YearEndDate('2004-07-29 02:00:00') = 2004-12-31 YearStartDate Returns the date of the first day of the year in which a date or timestamp occurs. YearEndDate Returns the date of the last day of the year in which a date or timestamp occurs. refer to Appendix A. Example Input is the date 5/16/2003. .2 Standard Functions MicroStrategy Functions Reference For information on whether your database supports various date and time functions. For information on whether your database supports various date and time functions. Input is the date 2002/9/9.

and “*” to perform single-value operations at the database level. Inc. functions provide access to functionality that is not standard in MicroStrategy but is available in many Relational Database Management Systems (RDBMS). Examples YearStartDate('2004-07-29') = 2004-01-01 YearStartDate('2004-07-29 02:00:00') = 2004-01-01 Internal functions The following are internal function types: • MicroStrategy Apply. You can divide data into bands in the following ways: Banding distributes the values into bands of equal size. The Microstrategy Apply functions are listed below: ApplyAgg defines simple metrics or facts using group-value aggregation functions. • Banding functions are used to differentiate displayed data on a report. For information on whether your database supports various date and time functions. Internal functions 131 . ApplyLogic defines custom filters using logical operators. refer to Appendix A. ApplyOLAP defines compound functions using database-specific OLAP functions such as Rank and RunningSlope. These MicroStrategy functions act as containers for non-standard SQL expressions passed to your warehouse database. BandingC distributes values into a specified number of bands. MicroStrategy and Database Support for Functions. “-”. ApplySimple uses simple operators and functions like “+”.MicroStrategy Functions Reference Standard Functions 2 Where: Date/Time is the input date or timestamp. ApplyComparison defines custom filters using comparison operators. © 2011 MicroStrategy. or Pass-through.

col1 and col2. ApplySimple("#0 * #1 * #2 * #3". and so forth) exceeds the number of objects passed in that function.g. referenced as #0 and #1. Using Apply functions is recommended only when corresponding functionality does not exist in the MicroStrategy product. the last available object in the list. the extra references. 132 Internal functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference BandingP distributes values into bands based on specific intervals of values. Syntax common to Apply functions While each Apply function has its own syntax. Apply (Pass-Through) functions Microstrategy Apply functions provide access to functions or syntactic constructs that are not standard in MicroStrategy but are provided by various Relational Database Management System (RDBMS) platforms. The index for referencing these objects begins with 0 and increases by 1 for each successive object passed.[col2]) uses two more references than there are arguments to pass. the Apply functions share several syntactic features: • The “#n” code in Apply function syntax serves as placeholders for the MicroStrategy objects being passed to your database. #0.[col1].[col1]. • Case functions return specified data based on the evaluation of user-defined conditions. are being passed to your database to be multiplied together (by the database). #1. Microstrategy encourages you to submit an enhancement request for inclusion of the desired feature in a future product release. When you need to use an Apply function.[col2]) indicates that two items. Inc.. so MicroStrategy passes #2 and #3. For example. because using RDBMS functions effectively bypasses the validations and other benefits of MicroStrategy products. ApplySimple("#0 * #1". . MicroStrategy passes the last available object in place of the extra reference(s). If the number of references in an Apply function (e. MicroStrategy strongly advises against using Apply functions when standard Microstrategy functions can be used to achieve the same goal. For example. respectively. as col2. Each of these functions is described in detail in the following subsections.

because form groups are ignored by the Analytical Engine. use four # characters in a row. attributes. attributes. and last name. and metrics as input. Example ApplyAgg(“Regrsxx(#0. middle name. ApplyAgg The ApplyAgg function is used to define simple metrics or facts by using database-specific. see Apply (Pass-through) functions. where Name is defined to contain Customer’s first name. For more general information on Apply functions as well as an example. [Argument 1]. Inc. For example. The ApplyAgg function itself is a group-value function and accepts facts. group-value functions.#1)”.[COUNTRY_NAME]) like ‘Z#%’ • Do not use form groups for the attribute form expression when using Apply functions.MicroStrategy Functions Reference Standard Functions 2 • To use # as a character rather than a placeholder. and metrics as input. Country@DESC) The SQL for the function is: Select a. All placeholders must begin with #0 and increase in increments of 1. instead of using Customer@Name. Internal functions 133 . use ID or any other single form. [Argument 2] {~+} © 2011 MicroStrategy. use a single form. ApplyComparison(UPPER(#0) like ‘Z####%’. See the syntax below for an example. Instead. Syntax ApplyAgg() Accepts facts. page 11.11[COUNTRY_ID] AS COUNTRY_ID from [LU_COUNTRY] a11 where upper(a11.

Year@ID>2003. and metrics as input. attributes.2 Standard Functions MicroStrategy Functions Reference ApplyComparison ApplyComparison is used to define a filter by populating the WHERE clause in the SQL passed to your RDBMS. Inc. Syntax ApplyComparison() Example ApplyComparison ("#0>#1". see Example: ApplyComparison used to check a prompted date. It is used with logical operators such as AND and OR. Example ApplyLogic(“#0 and #1”. and In. like. and can take facts.2) For another example of the ApplyComparison function. page 12. Store@ID. usually reordering the set according to some criteria. Month@ID>200301) ApplyOLAP OLAP functions are group-value functions that take a set of data as input and generate a set of data as output. The ApplyComparison function is used with RDBMS comparison operators such as >. ApplyLogic The ApplyLogic function is used to define custom filters. 134 Internal functions © 2011 MicroStrategy. ApplyLogic is a logical function. Syntax ApplyLogic() Accepts logic (Boolean) values as input. .

ApplySimple can be used to create the following objects: • Attribute form For any Apply function. Syntax ApplyOLAP() Accepts only metrics as input. metrics. • • • • • • Consolidation Custom group Fact Metric Subtotal Transformation For information about consolidations. Internal functions 135 . ApplyOLAP. is used to define metrics but differs in that it only accepts metrics as input. Inc. In general. It is used to insert any single-value. [Metric 1]. The engine ignores any definitions based on attribute forms. database-specific functions and simple operators directly into SQL. © 2011 MicroStrategy. the attribute form in the arguments should be a single form—not a form group. [Metric 2]) ApplySimple The ApplySimple function is a single-value function. Example ApplyOLAP(“RunningSlope(#0. It is used to define compound metrics via database-specific functions such as Rank().MicroStrategy Functions Reference Standard Functions 2 ApplyOLAP is the MicroStrategy Apply function tool used for OLAP functionality when you wish to use the native capabilities of your RDBMS. custom groups.#1)”. like ApplySimple. see the MicroStrategy Advanced Reporting Guide. and subtotals.

they should not be used with ApplySimple or any other Apply functions.#0. Sum and Count are both MicroStrategy functions and are not database-specific.[Column 2]) The two examples immediately above are incorrect and should not be used in your application because of the following two reasons: • ApplySimple is a single-value function and therefore can only be used with single-value functions.[Column 1]) ApplySimple("Count(#0)". therefore. in which [BIRTH_DATE] is an attribute ApplySimple(“Months_between(sysdate.[CURRENT_DT]). • 136 Internal functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference Syntax ApplySimple() Accepts facts.getdate())”. [CURRENT_DT]) Examples: Incorrect usage • • ApplySimple("Sum(#0)".#0)".#0. . in which [CURRENT_DT] is an attribute Compound Metric ApplySimple(“Greatest(#0. Metric_2. Metric_1. and metrics as input. Examples of object creation Expression type Attribute Examples ApplySimple(“Datediff(YY. Sum and Count are both group-value functions and therefore should not be used with ApplySimple.#0)”. Sum(Revenue){~}) Examples in custom expressions • • ApplySimple("Datediff(YY. [BIRTH_DATE]). Inc.#1.getdate())". attributes.#2)”.Metric_3) ApplySimple(" CASE WHEN #0 between 0 and 100000 THEN 'Low' WHEN #0 between 100001 and 200000 THEN 'Med' ELSE 'High' END ". [BIRTH_DATE]) ApplySimple("Months_between(sysdate.

The range and band values are determined by the parameter input to the function. Defining HasResidue as TRUE allows the function to create an additional band which is used to identify all values outside of the defined band range. Usage notes Values in the list that fall outside of the start and end values set in the function syntax are assigned a band of 0 (zero) in the report interface. Banding is a single-value function. StartAt. Banding This function maps metric values that fall within a certain range to a particular integer band value. and examples are listed below. Size is a real number indicating the width of each band. 5. the dollar sales are shown in bands of 0 .10. StopAt. Inc. The banding functions. © 2011 MicroStrategy. if 5.000 is the specified range. For information on banding functions in custom groups. Size) Where: • • • • Argument is a metric. HasResidue is a TRUE/FALSE parameter that defines whether an extra band is created for all values that do not fall within the StartAt and StopAt values.5.15. depending on how you want to divide your data. 10.000. Internal functions 137 .000. StartAt and StopAt are real numbers specifying the full range of the values to be placed in bands.000. their syntaxes.MicroStrategy Functions Reference Standard Functions 2 Banding functions Banding functions are used to group data on a report so that it is both more comprehensible and aesthetically pleasing than when it is displayed as one contiguous list. refer to the MicroStrategy Advanced Reporting Guide.001 . For example. and so on.001 . Syntax Banding <HasResidue>(Argument. MicroStrategy provides different banding options for you to use.

To determine the number of bands.000 is the value at which banding ends. each encompassing a range of 20. 367 (New York). 20. The metric function syntax is as follows: Banding([Total Revenue]. 1. 410. Inc. Only part of the resulting report is displayed here. In this case the total revenue for each city is used to divide the report data into bands: • • The highest total revenue is 405. The result is that 21 bands are created.000 is the size of the range of values included in each band. 410. .000 is 138 Internal functions © 2011 MicroStrategy. 1 is the value at which banding begins.000 dollars of total revenue. 410000. The lowest revenue is 668 (Cleveland). representing the list of values acted on by the Banding function.2 Standard Functions MicroStrategy Functions Reference Example The following example shows how the Banding function acts on report data. defined as Sum(Revenue). 20000) • • • • Total Revenue is the metric.

000 resulting in 20.000 in dollar sales shown in five equal bands). Internal functions 139 . StartAt. Inc. Syntax BandingC <HasResidue>(Argument. 21). StopAt. BandCount) © 2011 MicroStrategy. a total of 25. Each band is given an integer value of between 1 and 21. This is a single-value function. BandingC (banding count) BandingC returns metric data grouped into a specified number of bands and assigns integer values to the resulting bands (for example.5 (rounded to nearest integer.MicroStrategy Functions Reference Standard Functions 2 divided by 20.

410000. you can designate the number of bands created for the range of values. defined as Sum(Revenue). 1 is the value at which banding begins.000 is the value at which banding ends. Example The following example shows how the BandingC function acts on report data. Defining HasResidue as True allows the function to create an additional band which is used to identify all values outside of the defined band range. 410. Only part of the resulting report is displayed here. 25 is the number of bands into which you want the values divided. BandCount is a positive integer indicating the number of bands into which the total is divided. StartAt and StopAt are real numbers specifying the full range of the values to be placed in bands. This example uses the same set of values as the example for the Banding function. .2 Standard Functions MicroStrategy Functions Reference Where: • • • • Argument is a metric. 140 Internal functions © 2011 MicroStrategy. 25) Where: • • • • Total Revenue is the metric. 1. HasResidue is a TRUE/FALSE parameter that defines whether an extra band is created for all values that do not fall within the StartAt and StopAt values. Using the BandingC function. The metric function syntax is as follows: BandingC([Total Revenue]. Inc. Usage notes Values that fall outside of the range indicated by the Start and Stop values are assigned a band of 0 (zero). representing the list of values acted on by the BandingC function.

BoundaryN) © 2011 MicroStrategy. 410.000 . 0 . 20. BandingP (banding points) Returns metric data grouped into bands identified by user-specified boundary point values (for example. This function assigns integer values to the resulting metric and allows you to create band intervals of varying widths.MicroStrategy Functions Reference Standard Functions 2 The result is that 20 bands of equal sizes are created. Inc. 5.. Boundary2..000. Each band is given an integer value of between 1 and 25. To determine the range of each band.000.. Internal functions 141 . Syntax BandingP <HasResidue>(Argument.000 30.400.000 is divided by 25 resulting in bands of 16..000).5. This is a single-value function.20. Boundary1.

000 ≤ [Total Revenue] ≤ 410.100000. All other values specify the boundaries of an interval.410000) Where: • • Total Revenue is the metric.000 Band 4: 60.40000.000 ≤ [Total Revenue] < 80.000 Band 5: 80.000 Band 6: 100.000 ≤ [Total Revenue] < 100. representing the list of values acted on by the BandingP function. Boundary2 is less than Boundary3. The metric function syntax is as follows: BandingP([Total Revenue]. you can designate the boundaries for each interval. Boundary1 through BoundaryN are real numbers indicating the cut-off value for each band.80000. and so on.2 Standard Functions MicroStrategy Functions Reference Where: • • Argument is a metric.000 Band 3: 40.000 ≤ [Total Revenue] < 60. Using the BandingP function. Inc. Boundary1 is less than Boundary2. HasResidue is a TRUE/FALSE parameter that defines whether an extra band is created for all values that do not fall within the Boundary1 and BoundaryN values. Defining HasResidue as TRUE allows the function to create an additional band which is used to identify all values outside of the defined band range. There are six intervals defined as follows: Band 1: 1 ≤ [Total Revenue] < 20000 Band 2: 20.60000.20000. This example again uses the same data set as in the previous examples (Banding and BandingC).000 ≤ [Total Revenue] < 40.000 142 Internal functions © 2011 MicroStrategy. 1. . defined as Sum(Revenue). • Example The following example shows how the BandingP function acts on report data.

This is a single-value function. In general. Case can be used for categorizing data based on multiple conditions.MicroStrategy Functions Reference Standard Functions 2 Only part of the resulting report is displayed here. Inc. The case functions. and examples are listed below. a default value is returned. the software determines which condition evaluates as true and then returns the value that the user has specified that corresponds to that condition. Case This function evaluates multiple expressions until a condition is determined to be true. If all conditions are false. their syntaxes. Case functions Case functions return specified data in a SQL query based on the evaluation of user-defined conditions. 143 © 2011 MicroStrategy. When MicroStrategy queries the data warehouse. a user specifies a list of conditions and corresponding return values. then returns a corresponding value. Internal functions .

The condition can contain metrics. ([Total Revenue] < 600000). ReturnValue2 is a constant or metric value to return if the Condition2 condition is TRUE. the function returns a 2.ReturnValue2.000. 2) 144 Internal functions © 2011 MicroStrategy. if revenue is any other value. ReturnValue1 is a constant or metric value to return if the Condition1 condition is TRUE. . DefaultValue) Where: • • • • • • Condition1 is the first condition to evaluate.. comparison and logical operators.2 Standard Functions MicroStrategy Functions Reference Syntax Case (Condition1. the function returns a 1. and constants. the function returns a 0. comparison and logical operators.. if the revenue is less than 600.. The case metric is defined as follows: Case(([Total Revenue] < 300000). 1.. is less than 300. DefaultValue is the information to return if none of the other conditions are TRUE. .. Example This example generates a report where if the revenue. represented by the Total Revenue metric.000. Condition2 is the second condition to evaluate.. Condition2. Inc. represents any number of Conditions and Return Values that can be passed through this function. The condition can contain metrics. and constants. 0. ReturnValue1.

CaseV (case vector) CaseV evaluates a single metric and returns different values according to the results.. Result2.MicroStrategy Functions Reference Standard Functions 2 Difference between Case and If The If function is very similar to the Case function. © 2011 MicroStrategy. Internal functions 145 . Inc. Value2. Value1 is the first value (constant or metric) to be evaluated. CaseV might return January for a value of 1. while the If function can only evaluate one condition. . For example. Result1. DefaultResult) Where: • • Argument is the metric against which all values are compared. Value1. Each function takes a condition as an argument and returns a value depending on whether the condition is true or not. while the Case function is evaluated only by the Analytical Engine. the If function can be evaluated by either the SQL Engine or the Analytical Engine. etc. February for a value of 2. if provided a list of values ranging from 1 to 12.. Syntax CaseV (Argument. It can be used to perform transformations on a metric. This is a single-value function. The Case function can evaluate multiple conditional arguments. However..

This means that even if the value is 2. is evaluated against multiple numeric values. it is held as 2.. 2. if Unit Profit is any other value. for example..00000. Value2 is the second value (constant or metric) to be evaluated. Inc. . the function returns a 300. Result2 is the information to return (constant or metric) if the Value2 value is equal to the value for the Metric. 1000000) 146 Internal functions © 2011 MicroStrategy. 2. 3. if the Unit Profit for the item is 3.. the function returns a 200. Notice how a single metric.)... The CaseV metric is defined as follows: CaseV ([Unit Profit]. CaseV(int(M1). the function returns a 1000000. 200. 300. Example This simple example generates a report where if the Unit Profit for the item is 2. The report contains the attribute Item and the metrics Unit Profit and CaseV. and therefore 2 and 2.2 Standard Functions MicroStrategy Functions Reference • • • • • Result1 is the information to return (constant or metric) if the Value1 value is equal to the value for the Metric. represents any number of Conditions and Return Values that can be passed through this function. DefaultResult is the information to return (constant or metric) if none of the other values are Equal to the Metric.00000 are never considered equal. it is best if you wrap the metric or argument in the integer function. A report filter limits the items displayed to those in the subcategory Action. Usage notes The metric or argument in the CaseV expression is always held as a float. . For this reason. Unit Profit. A.

Argument2. © 2011 MicroStrategy.. ArgumentN) Where: The arguments for the Coalesce function can be any expression that can be evaluated as null or not null. Coalesce can be used to identify data in tables that may not be fully populated or in metric definitions.MicroStrategy Functions Reference Standard Functions 2 Coalesce Returns the value of the first non-null argument. but more often it is used with the Query Builder feature to support the inclusion of the Coalesce function in SQL queries. Usage Notes You can use the Coalesce function in defining a metric. Refer to the example below for more detailed information... Internal functions 147 .. Syntax Coalesce (Argument1. Inc.

148 NULL/Zero functions © 2011 MicroStrategy. and the result includes a NULL. For example. This is a comparison function. Usage notes The IsNull and IsNotNull functions work only with the data returned from the database.MONTH_ID) = 200410. For more information on Query Builder. NULL/Zero functions The NULL/Zero functions are often used to determine how NULLs and zeros are displayed on a report. In the Query Builder Editor. if the database data is NULL. The WHERE clause of the SQL query checks for the first non-null MONTH_ID column and compares it to the value 200410. returns FALSE. This can happen when you page by. you can filter your SQL query by creating the condition Coalesce(T1. For example. T2. but you are not sure which table has been populated with month data. They can also be used as a form of data validation to ensure meaningful results. see the MicroStrategy Advanced Reporting Guide.2 Standard Functions MicroStrategy Functions Reference Example Your database has two tables T1 and T2 that include the column MONTH_ID with the format yyyymm. IsNotNull Returns TRUE if value input is not NULL. . otherwise. for example. Inc. the IsNotNull function returns a FALSE. you may see NULL data when you manipulate a report after its original generation and that manipulation does not regenerate the data from the database. Syntax IsNotNull(Argument) Where: Argument is a fact or metric. You want to filter on a specific month. an otherwise invalid mathematical expression such as 5 + NULL can be changed to 5 + 0.MONTH_ID. However.

MicroStrategy Functions Reference

Standard Functions

2

IsNull
Returns TRUE if the value is NULL; otherwise, returns FALSE. This is a comparison function. Syntax IsNull(Argument) Where: Argument is a fact or metric. Usage notes 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 see NULL data when you manipulate a report after its original generation and that manipulation does not regenerate the data from the database. This can happen when you page by, for example, and the result includes a NULL.

NullToZero
Converts a value of NULL to 0. If the value is not NULL, the original value is kept. Syntax NullToZero(Argument) Where: Argument is a fact or metric. Example In this simple example, the function NullToZero is applied to a list of values (12, NULL, 97, 43, NULL). The resulting list is (12,0, 97, 43, 0). This function could be applied to a value list before it is acted on by another function such as Average so that NULL values in a list are included as list elements and factored into the average as zeros.

© 2011 MicroStrategy, Inc.

NULL/Zero functions

149

2

Standard Functions

MicroStrategy Functions Reference

ZeroToNull
Converts a value of 0 to NULL. If the value is not 0, the original value is kept. Syntax ZeroToNull(Argument) Where Argument is a fact or metric. Example In this simple example, the function ZeroToNull is applied to a list of values (12, 0, 97, 43, 0). The resulting list is (12, NULL, 97, 43, NULL). This function could be applied to a value list before it is acted on by another function such as Average so that zero values in a list are not included as list elements and therefore not factored into the average.

OLAP functions
OLAP functions are also known as relative functions. They take multiple elements from a list and return a new list of elements. The following applies to all OLAP functions: • • SortBy is applied before the engine performs the calculation of an OLAP function. In OLAP functions, the SortBy parameter can be either a metric or an attribute.

Many OLAP functions calculate measures useful for analyzing a set of values such as the sum, average, and standard deviation. These functions fall into three groups depending on how they select the window of values on which they base their calculations. These groups are as follows: • Running: Functions with a running window include the current value and all preceding values. For example, given the list (1, 2, 3, 4), RunningSum returns the sums 1, 3, 6, and 10. This example is illustrated in the table below. These functions include the word Running in their name, such as RunningAvg and RunningStDev.

150 OLAP functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Standard Functions

2

Moving: Functions with a moving window include the current value and a fixed number of preceding values. For example, given the list (1,2,3,4) and a window size of 2, MovingSum returns 1, 3, 5, and 7. This example is illustrated in the table below. These functions include the word Moving in their name, such as MovingAvg and MovingStDev. OLAP: Functions with flexible windows allow you to set where windows begin and end in relation to the current value. This feature allows you to include both preceding and succeeding values in your calculations. For example, you can use OLAPSum to include one value above and below the current row. This example is illustrated in the table below. These functions include the word OLAP, such as OLAPSum and OLAPAvg.

The table below provides a comparison of the example scenarios described in the above section.
Values 1 2 3 4 RunningSum 1 (1) 3 (1+2) 6 (1+2+3) 10 (1+2+3+4) MovingSum 1 (1) 3 (1+2) 5 (2+3) 7 (3+4) OLAPSum 3 (1+2) 6 (1+2+3) 9 (2+3+4) 7 (3+4)

ExpWghMovingAvg (exponential weighted moving average)
ExpWghMovingAvg allows you to place more or less emphasis on recent data than on past data within a specified number of rows. It is calculated within the specified window size and can restart based on an attribute specified in the function parameters. Syntax ExpWghMovingAvg <BreakBy, SortBy> (Argument, WindowSize, Rate) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. Argument is a metric representing a list of numbers. WindowSize indicates the number of values to use in each calculation.

© 2011 MicroStrategy, Inc.

OLAP functions

151

2

Standard Functions

MicroStrategy Functions Reference

Rate is a positive real number specifying the base weight applied to each argument value. In the calculation, exponents are sequentially applied to the rate value. Assign a rate of less than one to give more emphasis to more recent data; assign a rate of greater than 1 to give greater emphasis to past data.

Expression

∑ (w

k

k–i

× yi )
i

i = k–m+1 z k = ---------------- ∀k = 1 ,… ,n ---------------

∑w
Example

k

i = k–m+1

This example uses small numbers to demonstrate the calculation for the exponential weighted moving average function. For example, you have a list of values (32, 8, 5), with 5 being the most recent value, and you assign a rate of .5 and a window size of 2.
Values 32 8 5 EWM average 32 16 6 Calculation 32(.5)0 / (.5)0 = 32(1)/1 = 32 8(.5)0 + 32(.5)1 / (.5)0 + (.5)1 = 8(1)+ 32(.5) / 1+.5 = 8+16 / 1.5 = 16 5(.5)0 + 8(.5)1 / (.5)0 + (.5)1 = 5(1)+ 8(.5) / 1+.5 = 5+4 / 1.5 = 6

ExpWghRunningAvg (exponential weighted running average)
ExpWghMovingAvg allows you compute a running average while placing more or less emphasis on recent data than on past data. The calculation can restart based on an attribute specified in the function parameters. Syntax ExpWghRunningAvg <BreakBy, SortBy> (Argument, Rate)

152 OLAP functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Standard Functions

2

Where: • • • • BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. Argument is a metric representing a list of numbers. Rate is a positive real number specifying the base weight applied to each argument value. In the calculation, exponents are sequentially applied to the rate value. Assign a rate of less than one to give more emphasis to more recent data; assign a rate of greater than 1 to give greater emphasis to past data.
k

Expression

(w

k–i

× yi )
i

z k = i-= ---------- ∀k = 1 ,… ,n -- 1 --------- k

w

i=1

Example This example uses small numbers to demonstrate the calculation for the exponential weighted running average function. For example, you have a list of values (32, 8, 5), with 5 being the most recent value, and you assign a rate of .5.
values 32 8 5 EWR average 32 16 10 calculation 32(.5)0 / (.5)0 = 32(1)/1 = 32 8(.5)0 + 32(.5)1 / (.5)0 + (.5)1 = 8(1)+ 32(.5) / 1+.5 = 8+16 / 1.5 = 16 5(.5)0 + 8(.5)1 + 32(.5)2 / (.5)0 + (.5)1 +(.5)2 = 5(1)+ 8(.5)+ 32(.25) / 1+ .5 + .25 = 5 + 4 + 8 / 1.75 = 10 (rounded from 9.71)

FirstInRange
Returns the first value in a range of values. FirstInRange can be used to examine data such as inventory at the beginning of each month.

© 2011 MicroStrategy, Inc.

OLAP functions

153

2

Standard Functions

MicroStrategy Functions Reference

Calculations can be restarted based on attributes set in the function parameters. This restart capability differentiates FirstInRange from First. While First is a group-value function and takes both facts and metrics as argument input, FirstInRange is an OLAP function and takes only metrics as argument input. Syntax FirstInRange <BreakBy, SortBy> (Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. Argument is a metric representing a list of numbers.

Expression z k = y 1 ∀k = 1 ,… ,n Where: • • k = row number y1 = first non-NULL value of the metric after applying the BreakBy and SortBy parameters

Example This example shows the results of using the FirstInRange function. The report includes the attributes Customer Region and Customer State and the metrics Profit and FirstInRange. A report filter limits the regions displayed to Northwest, Southeast, and Southwest. The FirstInRange metric is defined as follows: FirstInRange<BreakBy={[Customer Region]}, SortBy= ([Customer State]) >(Profit)

154 OLAP functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Standard Functions

2

In the following report, FirstInRange returns the first profit value in the list of Customer States for each Customer Region.

Lag
The Lag function is useful to display a set of metric values in an order determined by another metric or attribute on the report. This allows you to compare metric values side-by-side. The easiest way to understand the Lag function is with an example, provided below. Syntax Lag <BreakBy, SortBy> (Argument, Offset, DefaultValue) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. Argument is an attribute or metric representing a list of values. It is common to use a metric for Argument. Offset specifies the offset from the current row to display information for. This offset trails behind the current row (you can use the Lead function to use an offset that precedes ahead of the current row, see Lead, page 161). For example, with an offset of two, row three displays data for the row two behind it, which would be row one.

© 2011 MicroStrategy, Inc.

OLAP functions

155

2

Standard Functions

MicroStrategy Functions Reference

DefaultValue is the value displayed for any entries that do not have any data due to the offset. For example, when using an offset of 2, the first two entries use the default value. It is common to enter a value of 0 or NULL for the DefaultValue.

Example On a report with Item, Cost, and Profit, you can use the Lag function to create a Cost (Lag on Profit) metric. This metric displays Cost values based on the descending sort order of the Profit metric, and is defined with the following expression: Lag<SortBy= (Profit Desc) >(Cost, 3.0, 0.0) Notice that the offset is set to three, meaning that the display of cost values lags behind by three entries. This is displayed in the report results shown below. Only the top and the bottom of the report is shown. To view the entire report results, you can create this report in the MicroStrategy Tutorial project.

156 OLAP functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Standard Functions

2

The Cost (Lag on Profit) values are displayed three behind the Cost metric, and are displayed based on the descending sort order of Profit. Notice that with an offset of three, the first three entries for Cost (Lag on Profit) use the default value of zero. Also, the last three values of Cost are not included in the Cost (Lag on Profit) metric. The report has been sorted based on the Profit metric to make the Cost (Lag on Profit) values easier to analyze.

Transformation-style analysis using the Lag and Lead functions
Transformation-style analysis can be supported using the Lag and Lead functions provided with MicroStrategy. These functions can be used to define metrics that compare values from different time periods without the use of transformations. For information on creating transformations, see the Project Design Guide. Note the following: • • The examples shown below were created in the MicroStrategy Tutorial project. The examples below use the Lag function. The Lead function can be used in the same way. The difference in using Lead rather than Lag is that the Lead function would display information by going forward in time rather than backward. For example, while the Lag function can return historical data from one year ago, the same formula used for the Lead function would return historical data from one year ahead. The Lead function does not predict future values. For functions that can predict future values based on historical data, see ForecastV (forecast, vector input), page 348, GrowthV (growth, vector input), page 353, and TrendV (trend, vector input), page 380. Additionally, you can use data mining functions from MicroStrategy Data Mining Services to predict future trends, as described in Data mining functions, page 258. For example, a Last Year’s Monthly Revenue metric can be created using the following function: Lag<SortBy=(Month@ID)>(Revenue,12, ZeroToNull(0))

© 2011 MicroStrategy, Inc.

OLAP functions

157

2

Standard Functions

MicroStrategy Functions Reference

This metric can then be included on a report with the Month attribute and the Revenue metric, as shown below.

This allows you to perform a side-by-side comparison of monthly revenue for different years. In this report, the 2007 monthly revenue is displayed next to the 2008 monthly revenue. The element Jan 2009 is included to show that the Last Year’s Monthly Revenue is displaying the monthly revenue from the previous year. By modifying the offset of the Lag function, you can change the time periods that can be compared side by side. For example, the function listed above uses an offset of 12, which displays monthly data from one year ago. Using an offset of 3 would display monthly data from three months ago, while using an offset of 24 would display monthly data from two years ago. These slight modifications could be used to create separate metrics that could all be

158 OLAP functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Standard Functions

2

included on the same report. The report below shows an example of including three different metrics that use the same Lag formula with a different offset.

The report shown above allows side-by-side comparison of monthly revenue for three different time periods. In this report, the Monthly Revenue 2 Years Ago metric displays no data for months in the year 2008 because no revenue data exists for the year 2006. To use the Lag or Lead functions for transformation-style analysis, the metric formulas must be created to support the required reporting scenario. For example, the report with the Month attribute and the Revenue metric has the Category attribute added to it. To support this reporting scenario, you can modify the Lag formula described above to include the Category attribute, as shown below. Lag<BreakBy={Category},SortBy=(Month@ID)> (Revenue,12,ZeroToNull(0))

© 2011 MicroStrategy, Inc.

OLAP functions

159

Inc. © 2011 MicroStrategy. as shown in the report below: Only the Month attribute elements Jan 2007. This restart capability differentiates LastInRange from Last. 160 OLAP functions . LastInRange Returns the last value in a range of values. LastInRange can be used to examine data such as inventory at the end of each month. SortBy=()> (Argument) Where: • • BreakBy is the attribute indicating where the calculation restarts. which allows the side-by-side comparison of monthly revenue over time for each category. LastInRange is an OLAP function and takes only metrics as argument input. SortBy is the attribute or metric by which the data is sorted.2 Standard Functions MicroStrategy Functions Reference Using the formula shown above. and Jan 2009 are displayed to show that the Last Year’s Monthly Revenue (Category) metric is displaying the monthly revenue from the previous year. the calculation is restarted for each category. Syntax LastInRange <BreakBy={}. Calculations can be restarted based on attributes set in the function parameters. While Last is a group-value function and takes both facts and metrics as argument input. Jan 2008.

page 155). Inc. For example. OLAP functions 161 . when using an offset of 2. Offset specifies the offset from the current row to display information for. SortBy> (Argument. SortBy is the attribute or metric by which the data is sorted. provided below. DefaultValue) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. This offset precedes ahead of the current row (you can use the Lag function to use an offset that trails behind the current row. Argument is an attribute or metric representing a list of values. This allows you to compare metric values side-by-side. The easiest way to understand the Lead function is with an example. see Lag. For example. which would be row three.MicroStrategy Functions Reference Standard Functions 2 • Argument is a metric representing a list of numbers. Syntax Lead <BreakBy.n Where: • • k = row number yk = last non-NULL value of the metric after applying the BreakBy and SortBy parameters Lead The Lead function is useful to display a set of metric values in an order determined by another metric or attribute on the report. row one displays data for the row two ahead of it. • © 2011 MicroStrategy. It is common to enter a value of 0 or NULL for the DefaultValue. DefaultValue is the value displayed for any entries that do not have any data due to the offset. with an offset of two.… . Expression z k = y k ∀ k = 1 . Offset. the last two entries use the default value. It is common to use a metric for Argument.

page 157. and is defined with the following expression: Lead<SortBy= (Profit Desc) >(Cost. Cost. you can use the Lag function to create a Cost (Lead on Profit) metric. see Transformation-style analysis using the Lag and Lead functions. and Profit. On a report with Item.2 Standard Functions MicroStrategy Functions Reference Example For an example of using Lag and Lead functions to perform transformation-style analysis. 0. meaning that the display of cost values is displayed three ahead of the current value. To view the entire report results. This is displayed in the report results shown below. 3. Only the top and the bottom of the report is shown.0) Notice that the offset is set to three. .0. This metric displays Cost values based on the descending sort order of the Profit metric. Inc. 162 OLAP functions © 2011 MicroStrategy. you can create this report in the MicroStrategy Tutorial project.

OLAP functions 163 . SortBy=()> (Argument. SortBy is the attribute or metric by which the data is sorted. Syntax MovingAvg <BreakBy={}.… . the last three entries for Cost (Lead on Profit) use the default value of zero. This is an OLAP function.n Where: • • • yi = metric value at the ith row m= window size n = number of rows/metric values © 2011 MicroStrategy. MovingAvg (moving average) Returns the moving average of the current value and preceding values. WindowSize is a positive integer indicating the number of values to use in each calculation.MicroStrategy Functions Reference Standard Functions 2 The Cost (Lead on Profit) values are displayed three ahead of the Cost metric. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. Argument is a metric representing a list of numbers. Also. Notice that with an offset of three. the first three values of Cost are not included in the Cost (Lead on Profit) metric. Inc. Expression zk = 1 m ∑ yi i = k–m+1 k ∀k = 1 . The report has been sorted based on the Profit metric to make the Cost (Lead on Profit) values easier to analyze. as defined by the WindowSize parameter. The calculations can be restarted based on attributes set in the function parameters. and are displayed based on the descending sort order of Profit.

Argument is a metric representing a list of values. This is an OLAP function. meaning that the value in the Moving Average column represents the average of the current value of the two values that precede it in the value list. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. WindowSize is a positive integer indicating the highest number to use in the count.67 ((40+20+5) / 3) MovingCount Returns the moving count of a list of values. The calculation is shown in the following table. Inc. Values 10 20 30 15 5 20 40 Moving Average 10 (10/1) 15 ((20+10) / 2) 20 ((30+20+10) / 3) 51. SortBy=()> (Argument. 164 OLAP functions © 2011 MicroStrategy. In this case.2 Standard Functions MicroStrategy Functions Reference Example This simple example illustrates how the MovingAvg function calculates a list of values and returns the average of a specified number of values.67 ((5+15+30) / 3) 13.67 ((15+30+20) / 3) 16. the window size is set to 3. The calculation can be restarted based on attributes set in the function parameters. . Syntax MovingCount <BreakBy={}.34 ((20+5+15) / 3) 21.

Example This simple example demonstrates how the MovingCount function counts rows of data. 3. A filter is applied so the only Regions displayed are South. The Moving Count metric is defined as follows: MovingCount<BreakBy={Region}. © 2011 MicroStrategy. and the metrics Revenue and Moving Count.MicroStrategy Functions Reference Standard Functions 2 Expression zk = ∑ yi i = k–m+1 k ∀k = 1 . SortBy= (Value) >(Revenue. Inc. and so on). Northwest. next lowest is 2.0) • • The count restarts for every Region.… . and Southwest.4. The entries are counted based on the value of the metric Revenue in ascending order (the lowest value is counted as 1. For example. OLAP functions 165 .4.4.n Where: • • • • yi = metric value at the ith row m= window size n = number of rows/metric values 1i = 1 if the value at the ith row is not NULL 1i = 0 otherwise Usage Notes If there are more entries in a section than the integer in the window size parameter. then all the remaining entries are given the highest number in the count.2.3. if the window size is 4 and there are 6 entries in the list section. This report uses the attributes Region and Employee. they are counted as follows: 1.

This is an OLAP function. The calculations can be restarted based on attributes set in the function parameters. Argument is a metric representing a list of numbers. SortBy is the attribute or metric by which the data is sorted. Inc. The position of the preceding row used in the calculation is defined in the function arguments. .2 Standard Functions MicroStrategy Functions Reference • The highest number in the count is 3 as designated in the WindowSize parameter. WindowSize is a positive integer indicating the range of values used to compute each difference. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. MovingDifference Returns the moving difference between current and preceding values. SortBy> (Argument. 166 OLAP functions © 2011 MicroStrategy. Syntax MovingDifference <BreakBy.

there are 3 rows in the window. therefore. © 2011 MicroStrategy. the window size is set to 3. The value in the Moving Difference column represents the result of the calculation for every window of three values. the current row is 1.n Where: • • • yi = metric value at the ith row m= window size n = number of rows/metric values Example This example illustrates how the Moving Difference function subtracts the value of a preceding row from the value of the current row and returns the difference. the row immediately preceding it is 2. In other words. Inc. This is an OLAP function. the calculations is row3-row1.MicroStrategy Functions Reference Standard Functions 2 Expression z k = y k – y k – m + 1 ∀k = 1 .… . Values 400 500 700 300 600 800 200 300 (700-400) -200 (300-500) -100 (600-700) 500 (800-300) -400 (200-600) Moving Difference MovingMax (moving maximum) Returns the moving maximum value by comparing current and preceding rows as defined in the function arguments. and the row preceding that is 3. OLAP functions 167 . The calculation is also shown. meaning that the value two rows previous to the current row is subtracted from the current row. In this case. The calculation can be restarted based on attributes set in the function parameters.

2 Standard Functions MicroStrategy Functions Reference Syntax MovingMax <BreakBy. subtracting a value from the user-defined number of preceding rows. Inc. ∀k = 1 . meaning that the value in the Moving Maximum column represents the highest value among the current and preceding two values in the value list. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. The calculation is shown in the following table. SortBy is the attribute or metric by which the data is sorted.… .n Expression z k = max { y i } Where: • • • i = k – m + 1 . the window size is set to 3. SortBy> (Argument. In this case. . WindowSize is a positive integer indicating the number of values to compare in each calculation.k yi = metric value at the ith row m = window size n = number of rows/metric values Example This simple example illustrates how the Moving Maximum function moves through a list of values. Argument is a metric representing a list of numbers.… . Values 550 30 40 70 50 Moving Maximum 550 550 (550>30) 550 (550>40 and 550>30) 70 (70>40and 70>30) 70 (70>50 and 70>40) 168 OLAP functions © 2011 MicroStrategy.

This is an OLAP function. Argument is a metric representing a list of numbers. SortBy is the attribute or metric by which the data is sorted. In this case. meaning that the value in the Moving Minimum column represents the lowest value among the current and preceding two values in the value list.… . The calculation is shown in the following table. OLAP functions 169 . The calculation can be restarted based on attributes set in the function parameters.n i = k – m + 1 . Inc.… . the window size is set to 3.SortBy>(Argument. WindowSize is a positive integer indicating the number of values to use in each calculation. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. Syntax MovingMin <BreakBy.MicroStrategy Functions Reference Standard Functions 2 MovingMin (moving minimum) Compares the current value and preceding values as defined in the function arguments to calculate a moving minimum value. Expression z k = min { y i } ∀k = 1 . Values 550 30 Moving Minimum 550 30 (30<550) © 2011 MicroStrategy.k Where: • • • yi = metric value at the ith row m = window size n = number of rows/metric values Example This simple example illustrates how the Moving Minimum function moves through a list of values returning the lowest value within a specified number of values.

SortBy> (Argument. . Expression ∑ ( yi – y ) zk = Where: • • • • k 2 i = k–m+1 -------------.… . The calculation can be restarted based on attributes set in the function parameters. WindowSize is a positive integer indicating the number of values to use in each calculation.n -------------m yi = metric value at the ith row y = average of metric m = window size n = number of rows/metric values 170 OLAP functions © 2011 MicroStrategy. Syntax MovingStDevP <BreakBy. SortBy is the attribute or metric by which the data is sorted.2 Standard Functions MicroStrategy Functions Reference Values 40 70 50 Moving Minimum 30 (30<40 and 30<550) 30 (30<70 and 30<40) 40 (40<70 and 40<50) MovingStDevP (moving standard deviation of a population) Returns the moving standard deviation of a population based on a list of values that encompasses the whole population. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. Inc.∀k = 1 . This is an OLAP function. Argument is a metric representing a list of numbers.

Compare this example report to the example for MovingStDev to see the different values returned when calculating for a population as opposed to a sample. Running StDevP. Inc.MicroStrategy Functions Reference Standard Functions 2 Example This example shows a report where the moving standard deviation of the revenue is calculated. the information is sorted within the region by state in ascending order. OLAP functions 171 . The report contains the attributes Customer Region and Customer State. The calculation starts over for each region. This calculation is based on the assumption that the list of values supplied in the metric represents the entire population of the data for which you want to obtain the standard deviation. and each calculation is based upon a window size of 3.3) © 2011 MicroStrategy. and StDevP. The definition of the MovingStDevP metric is as follows: MovingStDevP<BreakBy={[Customer Region]}. Southwest. SortBy=<[Customer State])>([Total Revenue]. and Northwest regions. MovingStDevP. and the metrics Total Revenue. A report filter limits data to the South.

∀k = 1 .n -------------m–1 yi = metric value at the ith row y = average of metric m = window size n = number of rows/metric values Example This example shows a report where the moving standard deviation of the revenue is calculated.2 Standard Functions MicroStrategy Functions Reference MovingStDev (moving standard deviation) Returns the moving standard deviation based on a list of values that is a sample of the population. This is an OLAP function.… . Argument is a metric representing a list of number. WindowSize) Where: • • • • BreakBy is the attribute indicating where the calculation restarts. WindowSize is a positive integer indicating the number of values to use in each calculation. Syntax MovingStDev <BreakBy. SortBy is the attribute or metric by which the data is sorted. This calculation is based on the assumption that the list of values supplied in the metric represents a sample of the data for which 172 OLAP functions © 2011 MicroStrategy. SortBy> (Argument. Expression k ∑ ( yi – y ) zk = Where: • • • • i = k–m+1 2 -------------. . The calculation can be restarted based on attributes set in the function parameters. Inc.

and StDev. This is an OLAP function. The calculation starts over for each region. and Northwest regions. The calculations can be restarted based on attributes set in the function parameters. The report contains the attributes Customer Region and Customer State. MovingStDev. Syntax MovingSum <BreakBy. A report filter limits data to the Southwest.SortBy>(Argument. Southeast. the information is sorted within the region by state in ascending order. OLAP functions 173 . Running StDev. SortBy=<[Customer State])>([Total Revenue]. WindowSize) © 2011 MicroStrategy.MicroStrategy Functions Reference Standard Functions 2 you want to obtain the standard deviation. The definition of the Moving StDev metric is as follows: MovingStDev<BreakBy={[Customer Region]}. 3) MovingSum Returns the moving sum of the current value and preceding values as defined in the function arguments. Compare this example report to the example for MovingStDevP to see the different values returned when calculating for a population as opposed to a sample. Inc. and each calculation is based upon a window size of 3. and the metrics Total Revenue.

Values 10 20 30 15 5 Moving Sum 10 30 (20+10) 50 (30+20) 45 (15+30) 20 (5+15) 174 OLAP functions © 2011 MicroStrategy.n Where: • • • yi = metric value at the ith row m = window size n = number of rows/metric values Example This simple example illustrates how the MovingSum function moves through a list of values calculating and returning the sum of a specified number of values. In this case the window size is set to 2 meaning that the sum in the Moving Sum column represents the current value added to the value from the value list that precedes it. .… . WindowSize a positive integer indicating the number of values to sum in each calculation.2 Standard Functions MicroStrategy Functions Reference Where: • • • • Argument is a metric representing a list of numbers. SortBy is the attribute or metric by which the data is sorted. Expression k zk = i = k–m+1 ∑ yi ∀k = 1 . Inc. The calculation is shown in the following table. BreakBy is the attribute indicating where the calculation restarts.

MicroStrategy Functions Reference Standard Functions 2 OLAPAvg (OLAP average) Returns the average of the current value. Syntax OLAPAvg<Distinct. N rows before current row (3): The calculation starts a number of rows before the current row. and SortBy are ignored. OLAPWinStOffset. OLAPWinEndOffset. OLAPWinEndType. preceding values. OLAP functions 175 . You define this offset of rows with the OLAPWinStOffset parameter described below. OLAPWinEndType. OLAPWinStOffset. then the parameters OLAPWinStType. SortBy>(Argument) Where: • Distinct is a TRUE/FALSE parameter that allows you to use all values in the calculation or to calculate using only the unique values. Inc. BreakBy is the attribute indicating where the calculation restarts. which can only include values above the current row in the calculation. N rows after current row (4): The calculation starts a number of rows after the current row. Select one of the following options. and succeeding values as defined in the function arguments. BreakBy. OLAPWinEndOffset. SortBy is the attribute or metric by which the data is sorted. Unlike RunningAvg and MovingAvg. listed by the name of the setting and its corresponding OLAPWinStType value in parentheses: Top of data set (0): The calculation starts at the top value as determined by the BreakBy and SortBy values. OLAPWinStType defines the window type for the starting location of the calculation. If you define Distinct to be true. You define this offset of rows with the OLAPWinStOffset parameter described below. The calculations can be restarted based on attributes defined in the function parameters. • OLAPWinStOffset defines the offset of rows from the current row to start the calculation. You can define this offset if the OLAPWinStType • • • © 2011 MicroStrategy. you can use OLAPAvg to include values both above and below the current row in the calculation. OLAPWinStType. Current row (2): The calculation starts at the current row.

You define this offset of rows with the OLAPWinEndOffset parameter described below. BreakBy={Category} SortBy={Item}>([Unit Cost]) The starting point for the average is defined as three rows before the current row (OLAPWinStType=3. The function is not valid if your starting point is at a lower point than your ending point. OLAPWinEndType=4. • OLAPWinEndOffset defines the offset of rows from the current row to stop the calculation. OLAPWinEndOffset=2). N rows before current row (3): The calculation stops a number of rows before the current row. • 176 OLAP functions © 2011 MicroStrategy. listed by the name of the setting and its corresponding OLAPWinEndType value in parentheses: Bottom of data set (1): The calculation stops at the bottom value. as defined below: OLAPAvg<OLAPWinStType=3. The stopping point for the average is defined as two rows after the current row (OLAPWinEndType=4. Current row (2): The calculation stops at the current row.2 Standard Functions MicroStrategy Functions Reference parameter is defined as N rows before current row (3) or N rows after current row (4). You define this offset of rows with the OLAPWinEndOffset parameter described below. Select one of the following options. Argument is a metric representing a list of numbers. • OLAPWinEndType defines the window type for the ending location of the calculation. . The top value is determined by the BreakBy and SortBy values. You can define this offset if the OLAPWinEndType parameter is defined as N rows before current row (3) or N rows after current row (4). OLAPWinStOffset=3. OLAPWinStOffset=3). Inc. N rows after current row (4): The calculation stops a number of rows after the current row. Example An OLAPAvg Unit Cost metric is created using the OLAPAvg function based on the Unit Cost metric. OLAPWinEndOffset=2.

Even though the calculation starts three rows before the current row. and Unit Cost. Item. © 2011 MicroStrategy. This is calculated by adding $32. There are a few facts about this data to take note of. Notice that with this calculation a value of six is used to calculate the average because six rows were included in the average. These rows are included because the calculation ends two rows after the current row. The first value of OLAPAvg Unit Cost is $15. the calculation would restart for the first Item of the next Category because the function is defined to break by the Category attribute. and $5 to get a total of $45. The fourth value for OLAPAvg Unit Cost is the first value that can include data from all three rows above the current row to two rows below the current row in the calculation (($32 + $8 + $5 + $25 + $19 + $20) / 6 = $18.MicroStrategy Functions Reference Standard Functions 2 This metric is displayed on a report along with Category. there is no data above the current row to include in the calculation.17). This total of $45 is then divided by three (the number of rows included in the calculation) to get the final result of $15. Inc. as shown below. OLAP functions 177 . $8. While it is not shown on this report.

Inc. Unlike RunningCount and MovingCount. If you define Distinct to be true. Syntax OLAPCount<Distinct. OLAPWinEndType. Null is a TRUE/FALSE parameter that defines whether null values are included in the total count. and SortBy are ignored. which can only include values above the current row in the calculation. you can use OLAPCount to include values both above and below the current row in the calculation. and succeeding values as defined in the function arguments. OLAPWinStType.2 Standard Functions MicroStrategy Functions Reference OLAPCount Returns the count of the current value. N rows after current row (4): The calculation starts a number of rows after the current row. You define this offset of rows with the OLAPWinStOffset parameter described below. The calculations can be restarted based on attributes defined in the function parameters. Current row (2): The calculation starts at the current row. BreakBy is the attribute indicating where the calculation restarts. SortBy is the attribute or metric by which the data is sorted. listed by the name of the setting and its corresponding OLAPWinStType value in parentheses: Top of data set (0): The calculation starts at the top value as determined by the BreakBy and SortBy values. preceding values. SortBy>(Argument) Where: • Distinct is a TRUE/FALSE parameter that allows you to use all values in the calculation or to calculate using only the unique values. BreakBy. OLAPWinEndType. OLAPWinStOffset. • • • • 178 OLAP functions © 2011 MicroStrategy. then the parameters Null. Null. N rows before current row (3): The calculation starts a number of rows before the current row. OLAPWinStType. Select one of the following options. . You define this offset of rows with the OLAPWinStOffset parameter described below. OLAPWinEndOffset. OLAPWinStOffset. OLAPWinEndOffset. OLAPWinStType defines the window type for the starting location of the calculation.

© 2011 MicroStrategy. Current row (2): The calculation stops at the current row. BreakBy={Category} SortBy={Subcategory}>([Unit Cost]) The starting point for the count is defined as three rows before the current row (OLAPWinStType=3. as defined below: OLAPCount<OLAPWinStType=3. OLAPWinEndType defines the window type for the ending location of the calculation. listed by the name of the setting and its corresponding OLAPWinEndType value in parentheses: Bottom of data set (1): The calculation stops at the bottom value. You define this offset of rows with the OLAPWinEndOffset parameter described below. OLAPWinEndOffset=2. OLAPWinEndOffset=2). You can define this offset if the OLAPWinStType parameter is defined as N rows before current row (3) or N rows after current row (4). You can define this offset if the OLAPWinEndType parameter is defined as N rows before current row (3) or N rows after current row (4). The top value is determined by the BreakBy and SortBy values. N rows before current row (3): The calculation starts a number of rows before the current row. The function is not valid if your starting point is at a lower point than your ending point. • Example An OLAPCount Unit Cost metric is created using the OLAPCount function based on the Unit Cost metric. Inc. The stopping point for the summation is defined as two rows after the current row (OLAPWinEndType=4. OLAPWinStOffset=3).Select one of the following options. • • OLAPWinEndOffset defines the offset of rows from the current row to stop the calculation.MicroStrategy Functions Reference Standard Functions 2 • OLAPWinStOffset defines the offset of rows from the current row to start the calculation. OLAPWinStOffset=3. OLAPWinEndType=4. You define this offset of rows with the OLAPWinEndOffset parameter described below. OLAP functions 179 . Argument is a metric representing a list of numbers. N rows after current row (4): The calculation starts a number of rows after the current row.

2 Standard Functions MicroStrategy Functions Reference This metric is displayed on a report along with Category. There are a few facts about this data to take note of. there is no data above the current row to include in the calculation. Even though the calculation starts three rows before the current row. This is calculated by counting the current row and two rows after the current row. The first value of OLAPCount Unit Cost is three. Subcategory. 180 OLAP functions © 2011 MicroStrategy. The fourth entry for OLAPCount Unit Cost is the first entry that can count all three rows above the current row to two rows below the current row in the calculation. This entry is able to reach the maximum value of six. and Unit Cost. Inc. . as shown below. Notice that after this entry the count begins to decrease because there are no longer two rows below the current row to include in the calculation. The calculation restarts for the first Subcategory of the next Category because the function is defined to break by the Category attribute.

You define this offset of rows with the OLAPWinStOffset parameter described below. Inc. Syntax OLAPMax<OLAPWinStType. • OLAPWinStOffset defines the offset of rows from the current row to start the calculation. You define this offset of rows with the OLAPWinStOffset parameter described below. and succeeding values as defined in the function arguments. © 2011 MicroStrategy. BreakBy. Current row (2): The calculation starts at the current row. The calculations can be restarted based on attributes defined in the function parameters. Unlike RunningMax and MovingMax. You can define this offset if the OLAPWinStType parameter is defined as N rows before current row (3) or N rows after current row (4). OLAPWinEndOffset. N rows before current row (3): The calculation starts a number of rows before the current row. which can only include values above the current row in the calculation. Select one of the following options. SortBy is the attribute or metric by which the data is sorted. SortBy>(Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts. preceding values. you can use OLAPMax to include values both above and below the current row in the calculation. OLAPWinEndType. N rows after current row (4): The calculation starts a number of rows after the current row. OLAPWinStOffset.MicroStrategy Functions Reference Standard Functions 2 OLAPMax (OLAP maximum) Returns the maximum value based on comparing the current value. OLAPWinStType defines the window type for the starting location of the calculation. listed by the name of the setting and its corresponding OLAPWinStType value in parentheses: Top of data set (0): The calculation starts at the top value as determined by the BreakBy and SortBy values. OLAP functions 181 .

OLAPWinEndOffset=2. • Example An OLAPMax Unit Cost metric is created using the OLAPMax function based on the Unit Cost metric. . Select one of the following options. Argument is a metric representing a list of numbers. The stopping point for the calculation is defined as two rows after the current row (OLAPWinEndType=4. OLAPWinEndType=4. • OLAPWinEndOffset defines the offset of rows from the current row to stop the calculation. The function is not valid if your starting point is at a lower point than your ending point. OLAPWinStOffset=3. 182 OLAP functions © 2011 MicroStrategy. You can define this offset if the OLAPWinEndType parameter is defined as N rows before current row (3) or N rows after current row (4).2 Standard Functions MicroStrategy Functions Reference • OLAPWinEndType defines the window type for the ending location of the calculation. listed by the name of the setting and its corresponding OLAPWinEndType value in parentheses: Bottom of data set (1): The calculation stops at the bottom value. as defined below: OLAPMax<OLAPWinStType=3. OLAPWinEndOffset=2). Inc. The top value is determined by the BreakBy and SortBy values. You define this offset of rows with the OLAPWinEndOffset parameter described below. N rows after current row (4): The calculation starts a number of rows after the current row. OLAPWinStOffset=3). N rows before current row (3): The calculation starts a number of rows before the current row. Current row (2): The calculation stops at the current row. You define this offset of rows with the OLAPWinEndOffset parameter described below. BreakBy={Category} SortBy={Subcategory}>([Unit Cost]) The starting point for the calculation is defined as three rows before the current row (OLAPWinStType=3.

and $6. The second value also returns $14 as it returns the maximum value of $14. There are a few facts about this data to take note of. as shown below. and it is within the window of three rows above the current row to two rows below the current row. there is no data above the current row to include in the calculation. $11. © 2011 MicroStrategy. OLAP functions 183 . and Unit Cost. Even though the calculation starts three rows before the current row. Subcategory. Inc. $6. The first value of OLAPMax Unit Cost is $14. These are included because the calculation ends two rows after the current row. The third value for OLAPMax Unit Cost is the first entry that includes $26 in its maximum calculation. and $7. The rest of the OLAPMax Unit Cost values for the Books Category return $26 because this is the maximum value. This is calculated by returning the maximum value of $14.MicroStrategy Functions Reference Standard Functions 2 This metric is displayed on a report along with Category. $11.

. OLAPMin (OLAP minimum) Returns the minimum value based on comparing the current value. listed by the name of the setting and its corresponding OLAPWinStType value in parentheses: Top of data set (0): The calculation starts at the top value as determined by the BreakBy and SortBy values. and succeeding values as defined in the function arguments. OLAPWinEndOffset. OLAPWinStType defines the window type for the starting location of the calculation. Inc. 184 OLAP functions © 2011 MicroStrategy. Current row (2): The calculation starts at the current row. You can define this offset if the OLAPWinStType parameter is defined as N rows before current row (3) or N rows after current row (4). N rows before current row (3): The calculation starts a number of rows before the current row. which can only include values above the current row in the calculation. Syntax OLAPMin<OLAPWinStType.2 Standard Functions MicroStrategy Functions Reference The calculation restarts for the first Subcategory of the next Category because the function is defined to break by the Category attribute. Unlike RunningMin and MovingMin. you can use OLAPMin to include values both above and below the current row in the calculation. • OLAPWinStOffset defines the offset of rows from the current row to start the calculation. SortBy is the attribute or metric by which the data is sorted. Select one of the following options. N rows after current row (4): The calculation starts a number of rows after the current row. OLAPWinEndType. SortBy>(Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts. BreakBy. OLAPWinStOffset. preceding values. You define this offset of rows with the OLAPWinStOffset parameter described below. The calculations can be restarted based on attributes defined in the function parameters. You define this offset of rows with the OLAPWinStOffset parameter described below.

• OLAPWinEndOffset defines the offset of rows from the current row to stop the calculation. The top value is determined by the BreakBy and SortBy values. You can define this offset if the OLAPWinEndType parameter is defined as N rows before current row (3) or N rows after current row (4).MicroStrategy Functions Reference Standard Functions 2 • OLAPWinEndType defines the window type for the ending location of the calculation. Current row (2): The calculation stops at the current row. OLAP functions 185 . OLAPWinStOffset=3). N rows after current row (4): The calculation starts a number of rows after the current row. Select one of the following options. Argument is a metric representing a list of numbers. listed by the name of the setting and its corresponding OLAPWinEndType value in parentheses: Bottom of data set (1): The calculation stops at the bottom value. © 2011 MicroStrategy. The function is not valid if your starting point is at a lower point than your ending point. OLAPWinStOffset=3. The stopping point for the calculation is defined as two rows after the current row (OLAPWinEndType=4. OLAPWinEndType=4. N rows before current row (3): The calculation starts a number of rows before the current row. OLAPWinEndOffset=2). You define this offset of rows with the OLAPWinEndOffset parameter described below. • Example An OLAPMin Unit Cost metric is created using the OLAPMin function based on the Unit Cost metric. as defined below: OLAPMin<OLAPWinStType=3. Inc. BreakBy={Category} SortBy={Subcategory}>([Unit Cost]) The starting point for the calculation is defined as three rows before the current row (OLAPWinStType=3. OLAPWinEndOffset=2. You define this offset of rows with the OLAPWinEndOffset parameter described below.

Inc. These are included because the calculation ends two rows after the current row. as shown below. and it is within the window of three rows above the current row to two rows below the current row. and $6. . and Unit Cost. The first value of OLAPMinUnit Cost is $6. All of the OLAPMin Unit Cost values for the Books Category return $6 because this is the minimum value. 186 OLAP functions © 2011 MicroStrategy. There are a few facts about this data to take note of. Even though the calculation starts three rows before the current row. there is no data above the current row to include in the calculation. Subcategory. $11. The calculation restarts for the first Subcategory of the next Category because the function is defined to break by the Category attribute. This is calculated by returning the minimum value of $14.2 Standard Functions MicroStrategy Functions Reference This metric is displayed on a report along with Category.

Example The MicroStrategy Tutorial project includes an Avg Revenue per Customer metric. Inc. To extend this analysis.MicroStrategy Functions Reference Standard Functions 2 OLAPRank Returns the rank of the current value based on the other values defined by the sorting criteria. SortBy is the attribute or metric by which the data is sorted. • Syntax OLAPRank<BreakBy. Be aware of the following: • • Since OLAPRank is calculated in the database. SortBy>() Where: • • BreakBy is the attribute indicating where the ranking restarts. you can create an OLAPRank Avg Rev per Customer metric as defined below: OLAPRank<BreakBy={Quarter}. You must include at least one metric in the SortBy parameter. Region@ID) >() © 2011 MicroStrategy. For OLAPRank. the calculation is performed in the MicroStrategy Analytical Engine and an error is returned. If metrics that use OLAPRank are defined as smart metrics. The ranking can be restarted based on attributes defined in the function parameters. You must include at least one metric in the SortBy parameter. The OLAPRank function allows the ranking to be calculated in the database. Any metrics that use the OLAPRank function must not be defined as smart metrics. OLAP functions 187 . rather calculating the ranking using the MicroStrategy Analytical Engine. you can only use this function if your database supports the OLAPRank function. the SortBy parameter is also where you can include the metric to perform the calculation on. SortBy= ([Avg Revenue per Customer]. This metric can be placed on a report along with the attributes Quarter and Region to display the quarterly average revenue per customer for each region.

and then by the OLAPRank Avg Rev per Customer values. The report shown above displays regions based on their average revenue per customer for each quarter. sorted from the lowest average revenue per customer to the highest. Inc. . Performing this analysis over extended periods of time can help to show trends in revenue and regional performance. and Avg Revenue per Customer. However. 188 OLAP functions © 2011 MicroStrategy. The report has been sorted by Quarter. This analysis allows you to quickly see how regions are performing based on average revenue per customer over different quarters. Web has the lowest average revenue per customer. In the first three quarters of data shown above. it displays the regional rank of the quarterly average revenue per customer for each region. Region. This is shown in the report below. their is some variation in the performance of the other regions.2 Standard Functions MicroStrategy Functions Reference When this metric is included on a report with Quarter.

preceding values. Syntax OLAPSum<Distinct. BreakBy is the attribute indicating where the calculation restarts. OLAPWinEndType. You define this offset of rows with the OLAPWinStOffset parameter described below. OLAPWinStOffset. OLAPWinEndOffset. BreakBy. OLAP functions 189 . OLAPWinStType. SortBy>(Argument) Where: • Distinct is a TRUE/FALSE parameter that allows you to use all values in the calculation or to calculate using only the unique values. Current row (2): The calculation starts at the current row. If you define Distinct to be true. and succeeding values as defined in the function arguments.MicroStrategy Functions Reference Standard Functions 2 OLAPSum Returns the summation of the current value. then the parameters OLAPWinStType. N rows after current row (4): The calculation starts a number of rows after the current row. N rows before current row (3): The calculation starts a number of rows before the current row. which can only include values above the current row in the calculation. Inc. Select one of the following options. and SortBy are ignored. Unlike RunningSum and MovingSum. you can use OLAPSum to include values both above and below the current row in the calculation. listed by the name of the setting and its corresponding OLAPWinStType value in parentheses: Top of data set (0): The calculation starts at the top value as determined by the BreakBy and SortBy values. OLAPWinStOffset. SortBy is the attribute or metric by which the data is sorted. OLAPWinEndType. You define this offset of rows with the OLAPWinStOffset parameter described below. OLAPWinStType defines the window type for the starting location of the calculation. The calculations can be restarted based on attributes defined in the function parameters. • • • © 2011 MicroStrategy. OLAPWinEndOffset.

Select one of the following options. The stopping point for the summation is defined as two rows after the current row (OLAPWinEndType=4. . You can define this offset if the OLAPWinEndType parameter is defined as N rows before current row (3) or N rows after current row (4). Argument is a metric representing a list of numbers. OLAPWinEndOffset=2. You define this offset of rows with the OLAPWinEndOffset parameter described below. 190 OLAP functions © 2011 MicroStrategy. listed by the name of the setting and its corresponding OLAPWinEndType value in parentheses: Bottom of data set (1): The calculation stops at the bottom value. OLAPWinStOffset=3. You can define this offset if the OLAPWinStType parameter is defined as N rows before current row (3) or N rows after current row (4). OLAPWinStOffset=3). OLAPWinEndType=4. N rows before current row (3): The calculation stops a number of rows before the current row. OLAPWinEndOffset=2). N rows after current row (4): The calculation stops a number of rows after the current row. You define this offset of rows with the OLAPWinEndOffset parameter described below. BreakBy={Category} SortBy={Subcategory}>([Unit Cost]) The starting point for the summation is defined as three rows before the current row (OLAPWinStType=3. • Example An OLAPSum Unit Cost metric is created using the OLAPSum function based on the Unit Cost metric. • • OLAPWinEndOffset defines the offset of rows from the current row to stop the calculation. Current row (2): The calculation stops at the current row. OLAPWinEndType defines the window type for the ending location of the calculation. The function is not valid if your starting point is at a lower point than your ending point.2 Standard Functions MicroStrategy Functions Reference • OLAPWinStOffset defines the offset of rows from the current row to start the calculation. as defined below: OLAPSum<OLAPWinStType=3. Inc. The top value is determined by the BreakBy and SortBy values.

Inc. there is no data above the current row to include in the calculation.93. Even though the calculation starts three rows before the current row.13.82.75. adding $13. Subcategory. This is calculated by adding $13. OLAP functions 191 . which can give the impression that some calculations are slightly incorrect.75.82 as displayed on the report. © 2011 MicroStrategy. You can display more decimal values for the Unit Cost and OLAPSum Unit Cost metrics to see the exact values. and Unit Cost.MicroStrategy Functions Reference Standard Functions 2 This metric is displayed on a report along with Category.13 actually totals $30. and $6. The first value of OLAPSum Unit Cost is $30. as shown below. For example. $10.93. and $6. $10. There are a few facts about this data to take note of. This difference is because the data is rounded up for display on the report. The data displayed on the report is rounded to the nearest cent. These are included because the calculation ends two rows after the current row.81 rather than $30.

75 + $6. The calculation can restart based on attribute groupings identified in the parameter settings.93 + $10.… .70).2 Standard Functions MicroStrategy Functions Reference The fourth value for OLAPSum Unit Cost is the only value that can include data from all three rows above the current row to two rows below the current row in the calculation ($13. adding the current value to the sum of the preceding values and dividing by the current count of values. .20 + $25. This is an OLAP function.93 + $9.n 192 OLAP functions © 2011 MicroStrategy.43 = $73. Inc. Expression zk = 1 k Where: • • • yi = metric value at the ith row m = window size n = number of rows/metric values k ∑ yi i=1 ∀k = 1 . It cannot include two rows below the current row because the calculation restarts for the first Subcategory of the next Category. SortBy is the attribute or metric by which the data is sorted.38).20 + $25. Syntax RunningAvg <BreakBy.43 = $48.13 + $7.SortBy>(Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts. Argument is a metric representing a list of numbers. The final OLAPSum Unit Cost value for the Books Category can only include the Unit Cost value for the current row and the three rows above it ($6.13 + $7. RunningAvg (running average) Moves through the values in a list and returns the running average. The calculation restarts because the function is defined to break by the Category attribute.93 + $9.

Values 10 20 30 40 50 Running Average 10 (10/1) 15 (30/2) 20 (60/3) 25 (100/4) 30 (150/5) RunningCount Returns the running count for each value in a list of values. This is an OLAP function. SortBy is the attribute or metric by which the data is sorted.MicroStrategy Functions Reference Standard Functions 2 Example This simple example illustrates how the Running Average function walks through a list of values calculating and returning the new average with the addition of each value.SortBy>(Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts.n Where: • • 1i = 0 if the ith row of argument is NULL 1i = 1 otherwise n = number of rows/metric values OLAP functions © 2011 MicroStrategy. Argument is a metric representing the list of values. Expression k zk = ∑ 1i i=1 ∀k = 1 . returning the current count after each value. The calculation is shown in the following table. Syntax RunningCount<BreakBy.… . Inc. The count can be restarted based upon attributes identified in the paramenter settings. 193 .

The evaluation can restart based on attributes identified in the parameter settings. Syntax RunningMax <BreakBy. Northwest. RunningMax (running maximum) Returns the running maximum value in a list of values by comparing the current and preceding values. The entries are counted based on the value of the metric Revenue in ascending order (the lowest value is counted as 1. and so on). SortBy= (Value) >(Revenue) • • The count restarts for every Region. The Running Count metric is defined as follows: RunningCount<BreakBy={Region}. This is an OLAP function. SortBy>(Argument) 194 OLAP functions © 2011 MicroStrategy. and the metrics Revenue and Running Count. . and Southwest. This report uses the attributes Region and Employee. Inc.2 Standard Functions MicroStrategy Functions Reference Example This simple example demonstrates how the RunningCount function counts rows of data. next lowest is 2. A filter is applied so the only Regions displayed are South.

Syntax RunningMin <BreakBy. OLAP functions 195 .k { y i } ∀k = 1 . This is an OLAP function. SortBy> (Argument) © 2011 MicroStrategy. Inc. Expression z k = max Where: • • yi = metric value at the ith row n = number of rows/metric values i = 1 . Values 8 6 10 9 5 8 (8>6) 10 (10>8) 10 (10>9) 10 (10>5) Running Maximum RunningMin (running minimum) Returns the running minimum value in a list of values by comparing current and preceding values.n Example This simple example illustrates how the RunningMax function moves through a list of values comparing each value to the highest value identified so far and returning the maximum value as it progresses.… . SortBy is the attribute or metric by which the data is sorted.… .MicroStrategy Functions Reference Standard Functions 2 Where: • • • BreakBy is the attribute indicating where the calculation restarts. The evaluation can restart based on attributes identified in the parameter settings. The calculation is shown in the following table. Argument is a metric representing the list of numbers.

Inc.2 Standard Functions MicroStrategy Functions Reference Where: • • • BreakBy is the attribute indicating where the calculation restarts. SortBy> (Argument) 196 OLAP functions © 2011 MicroStrategy. The list of values supplied is the population. This is an OLAP function.k { y i } ∀k = 1 .… . Values 8 6 10 9 5 6 (6<8) 6 (6<10) 6 (6<9) 5 (5<6) Running Minimum RunningStDevP (running standard deviation of a population) Returns the running standard deviation of a population for a value expression. Argument is a metric representing the list of numbers.… . The calculation can restart based on attributes identified in the function parameter settings. SortBy is the attribute or metric by which the data is sorted. Expression z k = min Where: • • yi = metric value at the ith row n = number of rows/metric values i = 1 . The calculation is shown in the following table.n Example This simple example illustrates how the Running Minimum function walks through a list of values comparing each value to the lowest value identified so far and returning the minimum value as it progresses. . Syntax RunningStDevP <BreakBy.

The report contains the attributes Customer Region and Customer State. Expression k ∑ zk = Where: • • i=1 ( yi – y ) 2 ---------.MicroStrategy Functions Reference Standard Functions 2 Where: • • • BreakBy is the attribute indicating where the calculation restarts. Argument is a metric representing the list of numbers. A report filter © 2011 MicroStrategy. OLAP functions 197 .∀k = 1 . Compare this example report to the example for RunningStDev to see the different values returned when calculating for a population as opposed to a sample. Inc. and the metrics Total Revenue. The calculation starts over for each region. SortBy is the attribute or metric by which the data is sorted. RunningStDevP.n --------k yi = metric value at the ith row n = number of rows/metric values Example This example shows a report where the running standard deviation of the revenue is calculated. and the information is sorted within the region by state in ascending order. and StDevP. This calculation is based on the assumption that the list of values supplied in the metric represents the entire population of the data for which you want to obtain the standard deviation.… .

SortBy is the attribute or metric by which the data is sorted. SortBy=<[Customer State])>([Total Revenue]) RunningStDev (running standard deviation) Returns the running standard deviation of a sample for a value expression. 198 OLAP functions © 2011 MicroStrategy. Argument is a metric representing the list of numbers. Southeast. . This is an OLAP function. Inc. The list of values supplied is the sample. The definition of the RunningStDevP metric is as follows: RunningStDevP<BreakBy={[Customer Region]}.2 Standard Functions MicroStrategy Functions Reference limits data to the Southwest. The calculation can restart based on attributes identified in the function parameters. Syntax RunningStDev<BreakBy. and Northwest regions.SortBy>(Argument) Where: • • • BreakBy is the attribute indicating where the calculation restarts.

Southeast and Northwest regions. The report contains the attributes Customer Region and Customer State. A report filter is used to limit the data to the Southwest. The definition of the RunningStDev metric is as follows: RunningStDev<BreakBy={[Customer Region]}. and the information is sorted within the region by state in ascending order. RunningStDev. Compare this example report to the example for RunningStDevP to see the different values returned when calculating for a population as opposed to a sample.MicroStrategy Functions Reference Standard Functions 2 Expression k ∑ zk = i=1 ( yi – y ) 2 ---------. SortBy=<[Customer State])>([Total Revenue]) © 2011 MicroStrategy. The calculation starts over for each region. OLAP functions 199 . This calculation is based on the assumption that the list of values supplied in the metric represents a sample of the data for which you want to obtain the standard deviation.∀k = 1 . and the metrics Total Revenue. and StDev.… . Inc.n --------k–1 Example This example shows a report where the running standard deviation of the revenue is calculated.

Expression zk = ∑ i=1 k y i ∀k = 1 .… . the following table illustrates the running sum and its calculations. 4. 3. The calculation starts over for each region. Syntax RunningSum <BreakBy. and the 200 OLAP functions © 2011 MicroStrategy. .n Example Example 1: A running sum displays the results of each calculation as it works towards the total of a set of values. The calculation can restart based on attributes identified in the parameter settings. This is an OLAP function. Values 1 2 3 4 5 Running Sum 1 (0+1) 3 (1+2) 6 (3+3 10 (6+4) 15 (10+5) Example 2: This example shows a report where the running sum of the revenue is calculated. Argument is a metric representing the list of numbers. 5). Using the value set (1. 2.2 Standard Functions MicroStrategy Functions Reference RunningSum This function returns the running sum of the values in a list.SortBy>(Argument) Where: • • • BreakBy is the parameter that sets the attribute designating where the calculation restarts. adding the current value to the preceding values. Inc. It can be used to maintain running totals of values in specific categories as well as an entire set. SortBy is the parameter that sets the attribute or metric by which the data is sorted.

and Northwest regions. NTile functions are used to group the values in an ordered list into one of several buckets or NTiles. instead of attributes. The various NTile functions © 2011 MicroStrategy. Southeast. a ranking option can be set in order to designate ranking by ODBC. Inc. The definition of the Running Sum metric is as follows: RunningSum<BreakBy={[Customer Region]}. and the metrics Total Revenue and Running Sum. A report filter limits data to the Southwest. Each element in the list is assigned an integer corresponding to the bucket to which it belongs. In the VLDB Properties. or the database. Rank and NTile functions 201 . Rank and NTile functions Although Rank belongs to the OLAP functions group.MicroStrategy Functions Reference Standard Functions 2 information is sorted within the region by state in ascending order. it differs from the other OLAP function in that its SortBy parameter uses metrics. SortBy=<[Customer State])>([Total Revenue]) Note that the subtotaled Total Revenue is equal to the last value in the Running Sum column for each region. The report contains the attributes Customer Region and Customer State. the Analytical Engine.

. For example. and the final 21 in the fifth bucket. fourth.. barring identical value rows. 25 rows will have value 2. 25 rows will be assigned a value of 1. BreakBy> (Argument) Where: • Ascending is a TRUE/FALSE parameter that designates the organization of data within the NTiles. and so on. if there are 103 distinct value rows in a partition which has an NTile<Tiles=5>() function.. NTile NTile functions are used to group the values in an ordered list into one of several buckets or NTiles. others allow you to define the size of the buckets. This is an OLAP function. over a user-defined number of buckets. Some functions allow you to define the number of buckets. and ceiling(3*(5/3))=5 include one of the extra three rows each in the second. Tiles. then. and so on. the next 21 in the second bucket. the next 21 in the fourth bucket. For example. . the buckets are calculated so that each bucket has exactly the same number of rows assigned to it or at most one row more than the others (the exception is that identical value rows are placed in the same bucket). sorted in either ascending or descending order. if you have 100 rows in a partition and define an NTile function with four buckets. and fifth buckets. the number of rows assigned per bucket will differ by one at most. the first 20 rows will be in the first bucket. The calculations ceiling(1*(5/3))=2. Syntax NTile <Ascending. 202 Rank and NTile functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference differ in how the buckets are defined. For the Ntile function. These buckets are referred to as equiheight buckets. If the number of rows in the partition does not divide evenly into the number of buckets. Each bucket has an equal number of elements (if possible). The extra rows are added to buckets using the calculations ceiling(1*(buckets/remainder)). NTile distributes the values in the specified metric. Inc. ceiling(remainder*(buckets/remainder)).. the next 20 in the third bucket. ceiling(2*(5/3))=4.

Rank and NTile functions 203 . the function distributes the numbers as follows: • • • • Values 1 through 5 in bucket 1 Values 6 through 10 in bucket 2 Values 11 through 15 in bucket 3 Values 16 through 20 in bucket 4 Example 2: This example shows a report where the customer states were sorted based on revenue and then divided among a specified number of buckets. The NTile metric is a derived one.MicroStrategy Functions Reference Standard Functions 2 • • • BreakBy is the parameter that sets the attribute determining where the calculation restarts. Inc. Example Example 1: If you define Tiles=4 for a metric that contains 20 values. The number of buckets is defined as 8. Tiles is a positive integer that designates the number of buckets or NTiles. The report includes the attribute Customer State and the metrics Total Revenue and NTile. Argument is a metric representing a list of values to be distributed equally (if possible) into n buckets. the syntax for which is as follows: NTile<Tiles=8>([Total Revenue]) © 2011 MicroStrategy.

This is an OLAP function. Within each band the data is sorted in ascending order by the attribute Customer State. sorted in either ascending or descending order. each containing 6 elements (states). The number of elements in each bucket is user-defined. Size) 204 Rank and NTile functions © 2011 MicroStrategy. Inc. . BreakBy> (Argument. NTileSize NTileSize distributes the values in the specified metric.2 Standard Functions MicroStrategy Functions Reference The resulting report divides the 48 states into 8 NTiles. Syntax NTileSize <Ascending. A portion of the report is displayed as follows. with the same number of elements in each bucket.

Example 2: This example shows a report where the customer states are sorted by revenue and then placed in buckets based on the number of elements that can fit in a bucket. The syntax for the NTileSize metric is as follows: NTileSize ([Total Revenue]. Rank and NTile functions 205 . values three and four go in bucket 2.MicroStrategy Functions Reference Standard Functions 2 Where: • • • • Ascending is a TRUE/FALSE parameter that designates the organization of data within the Ntiles. The report includes the attributes Customer State and the metrics Total Revenue and NTileSize.8) © 2011 MicroStrategy. values one and two go in bucket 1. If there are six values. and values five and six go in bucket 3. BreakBy is the parameter that sets the attribute determining where the calculation restarts. the function returns buckets containing two values each. The number of elements per bucket size is defined as 8. Example Example 1: If you define the Size as 2. Inc. Size is a positive integer that designates the number of elements per bucket. Argument is a metric representing a list of values to be distributed in buckets.

Inc.2 Standard Functions MicroStrategy Functions Reference The resulting report divides the 48 states into 6 buckets each containing 8 elements (states). A portion of the resulting report displays as follows. Syntax NTileValue <Ascending. NTileValue NTileValue distributes the values in the metric by value ranges over a user-defined number of buckets. This is an OLAP function. BreakBy> (Argument) 206 Rank and NTile functions © 2011 MicroStrategy. Each bucket is the same size in terms of the range of values contained in the bucket. sorted in either ascending or descending order. . but the number of elements per bucket is not equal. Segments.

BreakBy is the parameter that sets the attribute determining where the calculation restarts. The range of values is divided by the number of buckets and the result used to define four value ranges into which all the values fall. Segments is a positive integer designating the number of buckets in which the values are distributed. Argument is a metric representing a list of values to be distributed into buckets. and the minimum value in the range is 5 and the maximum is 105. The report includes the attribute Customer State and the metrics Total Revenue and NTileValue. The syntax for the NTileValue metric is as follows: NTileValue<Segments=4>([Total Revenue]) The resulting report displays the 48 states distributed across 4 buckets. Rank and NTile functions 207 .MicroStrategy Functions Reference Standard Functions 2 Where: • • • • Ascending is a TRUE/FALSE parameter that designates the organization of data within the Ntiles. Example Example 1: If you define the Segments= 4. Inc. The number of buckets (segments) is defined as 4. where x is the value: • • • • 5 ≤ x < 30 in bucket 1 30 ≤ x < 55 in bucket 2 55 ≤ x < 80 in bucket 3 80 ≤ x ≤ 105 in bucket 4 Example 2: This example shows a report where the customer states are sorted based on revenue and then placed in buckets based on the value range to which they belong. the bucket distribution is as follows. Notice that the number of elements in each bucket is not equal as more © 2011 MicroStrategy.

the first segment includes the customers who spend in the lowest 10% of the sales. A portion of the resulting report is displayed as follows. This example segments customers into 10 separate groups. This example uses the following concepts: • Analytical functions: NTileValue 208 Rank and NTile functions © 2011 MicroStrategy. . Example 3: Histogram The reports and components used in this example are available in the MicroStrategy Tutorial under the following folder: MicroStrategy Tutorial\Public Objects\Reports\TechnicalReports\ Reports by Feature\Analytics\Statistics and Forecasting\Histogram How are my customers distributed (classified) based on sales data? You are interested in finding out how your customers are distributed based on their contributions to sales data. with each group representing the customers within a 10% increment of sales. while the final. tenth segment includes the customers who spend in the top 10% of the sales. Inc. For example.2 Standard Functions MicroStrategy Functions Reference values fall into one range than another.

Rank and NTile functions 209 . The metric using NTileValue is then used to create a dynamic classification of Customers using a custom group. To create a general solution that can be used by different users. These tiles are assigned an integer and the contents of each bucket denoted accordingly. or Units Sold. For example. all customers in the second bucket are assigned a 2. Inc. This object prompt asks the user to select a fact: Revenue. Create the following object prompts: • Choose a base fact. Profit. and so on. This function is computed by Intelligence Server. © 2011 MicroStrategy. use object prompts (see instructions below). all customers that fall in the first bucket are assigned a 1.MicroStrategy Functions Reference Standard Functions 2 • Custom group NTileValue distributes values into buckets based on minimum and maximum values.

. Once you have identified the basic fact and attribute to analyze. Item. you can start building other objects. or Day) by building a custom group using banding. or Day. create another metric defined as: Decile By Value = NTileValue<Segments=10> ([Sample Set Metric]) 3 Create a dynamic classification of the subject attribute (Customers. Inc. Take the following steps: 1 Create a metric defined as follows: Sample Set Metric = Sum(?[Choose a base fact]){~. This object prompt asks the user to select an attribute: Customer. Use the metric Decile 210 Rank and NTile functions © 2011 MicroStrategy. Item. ?[Choose a sample set level]} 2 To put the value in the proper buckets (tiles).2 Standard Functions MicroStrategy Functions Reference • Choose a sample set level.

starting at 1 and stopping at 10. the banding type “band count” and set the band count to 10. Inc. © 2011 MicroStrategy. 4 Choose to show only individual items within this element since the objective is to build a graph (histogram) for this custom group.MicroStrategy Functions Reference Standard Functions 2 By Value. Rank and NTile functions 211 .

7 Add the Decile by Value custom group to the row axis. displays as follows: 212 Rank and NTile functions © 2011 MicroStrategy.2 Standard Functions MicroStrategy Functions Reference 5 Count the number of elements in the new classification to display a histogram. 8 Execute the report with attribute Customer and fact Revenue. and the Decile Histogram. Inc. To do this. and the Count of Samples metric to the column axis. create a dummy metric defined as follows: Count of Samples = Count(1){~} 6 Since there is no column to perform the count. define the metric so that the database can calculate how many attribute elements are in each custom group element. in Grid mode. .

appears as follows: The SQL generated for the Decile by Histogram is as follows: Pass0 .Duration: 0:00:00.Duration: 0:00:00.MicroStrategy Functions Reference Standard Functions 2 The same report. Inc. a11.[CUSTOMER_ID] AS CUSTOMER_ID.00 [An Analytical SQL] © 2011 MicroStrategy. in graph mode.09 create table ZZT1Y02011CMQ000 ( CUSTOMER_ID SHORT.Duration: 0:00:00.[TOT_DOLLAR_SALES] AS WJXBFS1 from [CUSTOMER_SLS] a11 Pass1 . DA56 LONG) Pass2 .25 select a11. Rank and NTile functions 213 .

This is an OLAP function. sorted in either ascending or descending order. Pass5 drops the temporary table.Duration: 0:00:00.2 Standard Functions MicroStrategy Functions Reference Pass3 . . The Intelligence Server computes the NTileValue function. into the dynamic lookup table for the custom group.03 drop table ZZT1Y02011CMQ000 • • Pass0 computes the revenue for each Customer using the Sample Set Metric. Pass2.[DA56] Pass5 . and Pass3) prepare the dynamic classification of Customer for the custom group. The next three passes (Pass1. This series of SQL passes essentially builds a dynamic lookup table for the classification that is requested. Pass4 calculates the number of customers that belong to each custom group element. Syntax NTileValueSize <Ascending. 1) Pass4 . • • NTileValueSize NTileValueSize distributes the values in the metric across buckets based on a user-specified value range.Duration: 0:01:13. count(1.Duration: 0:00:00.64 insert into ZZT1Y02011CMQ000 values (1499.32 select a11. Size) 214 Rank and NTile functions © 2011 MicroStrategy. with the new classification. The value is then inserted.0) AS WJXBFS1 from [ZZT1Y02011CMQ000] a11 group by a11. The column DA stands for Dynamic Attribute. This is indicated by [An Analytical SQL] in Pass3. BreakBy> (Argument.[DA56] AS DA56. Inc.

It does not matter how many values are in each bucket.653. Example 2: This example shows a report where the customer states were sorted based upon revenue and then placed in buckets based upon the value range to which they belong. 654. Rank and NTile functions 215 . The report includes the attribute Customer State and the metrics Total Revenue and NTileValueSize. BreakBy is the parameter that sets the attribute determining where the calculation restarts. the second bucket contains values 2200 through 3199. the next bucket ranges from 118654 to 218. Size is a real number designating the size of the range of values for each bucket. it only matters that their value is within the bucket range. and so on until all values are in buckets.MicroStrategy Functions Reference Standard Functions 2 Where: • • • • Ascending is a TRUE/FALSE parameter that designates the organization of data within the Ntiles. The value range is defined as 100.839. Beginning at the lowest metric value.653. The syntax for the NTileValueSize metric is as follows: NTileValueSize ([Total Revenue]. Inc. Argument is a metric representing the list of values to be distributed across buckets.000. in this case 18. the first bucket contains values from 18. and so on until every value is in a bucket. The highest value in the report is 1. Example Example 1: If you define size as 1000 and your range of values begins at 1200.654 to 118.238. 100000) © 2011 MicroStrategy. the first bucket contains values 1200 through 2199. which falls into bucket 19 and is the only value in that range.

Percent is the decimal value of the percent for which you want to use as a threshold. . fact or metric representing a list of numbers. Inc. Percent) Where: • • • Ascending is a TRUE/FALSE parameter that indicates the organization of the data. Percentile Returns the nth percentile of values in a given range. for example. This is a group-value function. which states have revenue above the 75th percentile for their region. FactID> (Argument. Argument is an attribute.2 Standard Functions MicroStrategy Functions Reference A portion of the resulting report is displayed as follows. This function can be used to establish thresholds indicating. 216 Rank and NTile functions © 2011 MicroStrategy. Syntax Percentile <Ascending.

and the rank is an integer. Example 2: This example shows a report where only states with Total Revenue greater than the threshold for the 75th percentile in its region are displayed.9 are greater than the 30th percentile. 0. Unless the defaults are changed. All values above 1. The report contains the attributes Customer Region and Customer State.75){[Customer Region]} Rank This function is used to display the ranking of values in a list relative to the other values. A view filter is then applied to the report so that it only displays states where Total Revenue is greater than Percentile. 3. 2. Inc. The syntax for the Percentile metric is as follows: Percentile([Total Revenue]. and the metrics Total Revenue and Percentile.MicroStrategy Functions Reference Standard Functions 2 Example Example 1: If you have an argument containing the values 1. . the function ranks the values in ascending order by the value of the metric. This is an OLAP function. Rank and NTile functions 217 . the syntax is as follows: Percentile ({1. © 2011 MicroStrategy.9 is the level of the 30th percentile. and 4 and you want to find the threshold of the 3oth percentile.3) = 1. 3.9 1. 4}. The calculation can restart based on attributes identified in the parameter settings. 2.

The NullInclude parameter only affects the rank of NULL values if the Rank function is performed by the MicroStrategy Analytical Engine. To determine whether the Rank function for a metric is performed by the Analytical Engine. 3. derived metrics. view the SQL statement for the report. If the Rank function is performed on a database. For example. BreakBy is the parameter that designates where the calculation should restart. 50%. and other metric scenarios. ByValue is a TRUE/FALSE parameter that indicates whether the ranking is done by integer values (1. 2. Inc. the rank of the Profit metric in the report below ranks four separate profit values. this verifies that the Rank function is performed by the Analytical Engine. plus one. BreakBy.2 Standard Functions MicroStrategy Functions Reference Syntax Rank <ASC. the NullInclude parameter is ignored and NULL values are included in the rank calculation based on the database standards. 75%. The Rank function is performed by the Analytical Engine for smart metrics. NullInclude is a parameter that determines how NULL values are included in the rank calculation. you have the following options for this parameter: 1: If you define NullInclude=1. NULL values are given a rank value equal to the number of other rank values. • • 218 Rank and NTile functions © 2011 MicroStrategy. NullInclude> (Argument) Where: • • • Argument is a fact or metric representing a list numbers. ByValue. ASC is a TRUE/FALSE parameter that indicates the order of ranking (1 is the lowest or highest value). . If the metric is listed in the Analytical Engine calculation steps. 4) or by percentage (10%. 100%). For Rank functions that are performed by the Analytical Engine.

-1: If you define NullInclude=-1. Inc. 0 (default): If you define NullInclude=0. while the report on the right uses a descending rank. which is given the rank of 4. For information on VLDB properties. Rank and NTile functions 219 . This is shown in the report below. the NULL values for both reports are ranked with the value of one. The Rank (Profit) metric in this example uses an ascending rank. As shown in the reports above.MicroStrategy Functions Reference Standard Functions 2 There is one NULL value. refer to the Supplemental Reference for System Administration: © 2011 MicroStrategy. NULL values are included in the rank calculation based on the NULL value handling defined using the Null checking for Analytical Engine VLDB property. If you define the metric with a descending rank. including steps to access and modify them for various MicroStrategy objects. NULL values are given the rank value of one. the other rank values change but the rank value for any NULL values remains the same. The report on the left uses an ascending rank. For example. the reports shown below both define the Rank (Profit) metric with NullInclude=-1.

NULL values are treated as NULL values. For example. – If you define the Null checking for Analytical Engine property as False. Customer State. In order to have the state with the highest revenue in each region ranked as 1 in the Rank by Value metric. the report shown below ranks the NULL values with a rank of two. the ranking is ascending (default). the Rank by Value ranking is descending. one that ranks by value (default) and the other that ranks using a percentage. The report includes the attributes Customer Region. . There are two metrics. and the two ranking metrics. Example This example report displays customer states ranked by revenue within their regions. For example. the metric Total Revenue (defined as Sum(Revenue)).2 Standard Functions MicroStrategy Functions Reference – If you define the Null checking for Analytical Engine property as True. Inc. because zero is greater than -10 and less than 40. The syntax for the metrics is as follows: 220 Rank and NTile functions © 2011 MicroStrategy. which means NULL values are also displayed for the rank values. the report shown below displays the NULL values as NULL in the rank. NULL values are treated as zero values in the rank calculation. In order to have the largest number ranked at 100% in the Rank by Percent metric.

While string functions can be used to create metrics. String functions 221 . removing or returning select characters of a column. String functions String functions perform various actions that modify the characters returned for a string of characters. MicroStrategy and Database Support for Functions. a more common use case for these functions is in the creation of attribute forms. For information on which string functions are supported for your specific database. and search in the © 2011 MicroStrategy. For example. and so on. Inc. they are processed by the database. For information on creating attributes and attribute forms. BreakBy={[Customer Region]}>([Total Revenue]) Rank by Percent: Rank<ASC=True. The MicroStrategy Analytical Engine does not calculate string functions.MicroStrategy Functions Reference Standard Functions 2 Rank by Value: Rank<ASC=False. these functions can aid in the creation of attribute forms by combining multiple columns of information. refer to Appendix A. capitalizing the first letter of a column.ByValue=True. see the Project Design Guide.ByValue=False BreakBy={[Customer Region]}>([Total Revenue]) The resulting report is displayed as follows.

You can create a single attribute form that combines these two columns as described below. [CUST_LAST_NAME]) The input from the first column is concatenated with the input from the second column. MicroStrategy and Database Support for Functions. For scenarios such as the one described above.. String functions for which your database does not include SQL syntax support cannot be calculated in your environment. you can use the ConcatBlank function (see ConcatBlank (concatenate plus blank space) below) to concatenate the strings and include a space between 222 String functions © 2011 MicroStrategy. ArgumentN) Where: • Argument1..2 Standard Functions MicroStrategy Functions Reference section corresponding to your database. ArgumentN are facts. columns... Concat([CUST_FIRST_NAME]. an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME. .. Concat is often used to combine related values. Inc. to display information such as JohnDoe and JaneDoe for the attribute form. metrics. Example The Concat function can help to create attribute forms that are a combination of multiple columns in database tables. or string values. Concat (concatenate) The Concat function combines two or more input strings into one continuous string and returns the result. For information on the syntax used in your specific database. Syntax Concat(Argument1.. such as a first and last name. Argument2. For example. and search in the section that corresponds to your database. concatenating the two strings “Micro” and “Strategy” would result in the single string “MicroStrategy”... This section of the document includes information and examples on the data returned by the function. For example. refer to Appendix A.

. For example.. and search in the section that corresponds to your database. ConcatBlank([CUST_FIRST_NAME]. This function can be used to combine related values that are logically separated by spaces. or string values.. This can result in attribute forms that are easier to read. and an additional space is included between the two inputs. For example.MicroStrategy Functions Reference Standard Functions 2 the two strings. page 224. For an additional example of using the Concat function. ArgumentN are facts.. String functions 223 .. ConcatBlank (concatenate plus blank space) The ConcatBlank function concatenates two or more input strings into one continuous string. an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME. the attribute form would display John Doe. [CUST_LAST_NAME]) The input from the first column is concatenated with the input from the second column. Inc. rather than displaying JohnDoe. refer to Appendix A. You can create a single attribute form that combines these two columns as described below. columns. Argument2. For example. For information on the syntax used in your specific database... concatenating the two strings “Business” and “Intelligence” would result in the single string “Business Intelligence”. inserting a blank space between each string. MicroStrategy and Database Support for Functions. metrics. ArgumentN) Where: • Argument1. This displays information such as John Doe and Jane Doe for the attribute form. Syntax ConcatBlank (Argument1. Example The ConcatBlank function can help to create attribute forms that are a combination of multiple columns in database tables.. © 2011 MicroStrategy. refer to the example section for the function InitCap (initial capitalization).

sMITh. Be aware that this function could potentially return undesired results in certain scenarios. column. refer to Appendix A. page 224. and search in the section that corresponds to your database. . Using the InitCap function. Syntax InitCap(Argument) Where: • Argument is a metric. All other letters appear in lower case. Example The InitCap function can be used to fix capitalization errors for information that is displayed for attribute forms. refer to the example section for the function InitCap (initial capitalization). if the column included information such as jackson. For example. Using the scenario described above. For example. Smith. and other objects. this would be displayed as Mccoy. consider the name McCoy. these would be displayed as Jackson. 224 String functions © 2011 MicroStrategy. InitCap([CUST_LAST_NAME]) The input from the column is modified so that the first character is capitalized and all other characters are lowercase. This can help to fix capitalization errors in information that is displayed for attribute forms. and Hughes. To ensure that the first letter of the last name is capitalized you create an attribute form with the following definition. and Hughes respectively.2 Standard Functions MicroStrategy Functions Reference For an additional example of using the ConcatBlank function. or string value representing the text string. MicroStrategy and Database Support for Functions. Inc. an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME. InitCap (initial capitalization) The InitCap function returns a string in which the first letter of the input string is capitalized. For information on the syntax used in your specific database. metrics.

Concat. The InitCap function ensures that the first letter of the first name is capitalized. ConcatBlank. MicroStrategy and Database Support for Functions. This can help reduce the length for attribute forms that may have long descriptions. to be returned.MicroStrategy Functions Reference Standard Functions 2 Another way to use this function would be to create an attribute form that combined the first letter of someone’s first name with the person’s full last name. Example The LeftStr function can be used to create attribute forms that use abbreviations. refer to Appendix A. Smith. M. For example. starting from the far left position of the string. and search in the section that corresponds to your database. Length is an integer indicating the number of characters. 1). column. © 2011 MicroStrategy. LeftStr (left string selection) The LeftStr function returns a substring taken as a specified number of characters from the left of the input string. String functions 225 . Martinez. Inc."). and L. LeftStr would return the string “Micro” from the original string “MicroStrategy”. ". or string value representing the text string(s). Doe. The InitCap function could be used to ensure that the first letter of the first name was capitalized. [CUST_LAST_NAME]) An attribute form using a definition such as the one listed above would display names such as J. Length) Where: • • Argument is a metric. The definition of such an attribute form is shown below: ConcatBlank(Concat(LeftStr(InitCap([CUST_FIRST_NAME]). An attribute form of this type would require the use of the functions InitCap. Syntax LeftStr (Argument. LeftStr is useful for abbreviations or length reduction when the entire input string is not required. fact. if the specified length is five. For information on the syntax used in your specific database. and LeftStr.

. This attribute form can be used when the full first name does not need to be displayed. and search in the section that corresponds to your database. refer to Appendix A. For example. Length (length of string) The Length function returns the number of characters in an input string. you can abbreviate each 226 String functions © 2011 MicroStrategy. Example The Length function can be used in conjunction with other string functions to manipulate strings in various ways. column. Length is often used to manipulate strings with the help of other string functions. The definition of such an attribute form is shown below: LeftStr([CUST_FIRST_NAME]. You create attribute forms for the customer first and last names. For an additional example of using the LeftStr function. MicroStrategy and Database Support for Functions. or string representing the text string(s). refer to the example section for the function InitCap (initial capitalization). Inc. page 224. For information on the syntax used in your specific database. For example. 1) The integer value of 1 causes the LeftStr function to only display the first character at the far left position for all inputs from the CUST_FIRST_NAME column. fact. using the Length function on the string “MicroStrategy” would return a value of 13. an LU_CUSTOMER table includes two columns: CUST_FIRST_NAME and CUST_LAST_NAME.2 Standard Functions MicroStrategy Functions Reference For example. rather than abbreviating information to a specific number of characters. You also create an attribute form that displays only the first letter of the first name. Syntax Length(Argument) Where: • Argument is a metric.

using the Lower function on the string “MicroStrategy” would return the string “microstrategy”. you could also use functions such as Round. Ceiling. respectively. and search in the section that corresponds to your database. For information on the syntax used in your specific database. MicroStrategy and Database Support for Functions. page 313. refer to Appendix A. The definition of an attribute form that displays only half of the characters available for the first names of a customers is shown below: LeftStr([CUST_FIRST_NAME]. Lower may be used to help standardize the display of information and make the information more readable. Frederick. see Mathematical functions. For information on these types of functions. Fred. Lower (lower case) The Lower function returns a string in which all alphabetic characters in an input string are displayed as lower case. © 2011 MicroStrategy. column. For example. Inc. Depending on your database’s support for functions. or string value representing the text string(s). String functions 227 .MicroStrategy Functions Reference Standard Functions 2 string to only display half of the available characters. the function shown above would display Al. In the function used in this example. and Jennifer. the Int function is used to return only the integer part of the calculation Length([CUST_FIRST_NAME]) / 2. Int(Length([CUST_FIRST_NAME]) / 2)) For first names such as Alan. and Jenn. Syntax Lower(Argument) Where: • Argument is a metric. and Floor. This provides an abbreviated version of customers’ first names while providing additional characters to possibly distinguish each abbreviated name.

350 west elm avenue. Syntax LTrim(Argument) Where: • Argument is a metric. 228 String functions © 2011 MicroStrategy. The definition of such an attribute form is shown below: Lower([ADDRESS]) An attribute form using a definition such as the one listed above would take input addresses such as 10 Main Street. For example. respectively. and 4400 Spring Road and display them as 10 main street. fact. and search in the section that corresponds to your database. or string representing the text string(s). For information on the syntax used in your specific database. For example. The LTrim function helps to remove blank spaces that may have been caused by errors in data entry. Inc. MicroStrategy and Database Support for Functions. refer to Appendix A. using the LTrim function on the string “ MicroStrategy” would return the string “MicroStrategy”. LTrim (left trim) The LTrim function returns a string in which any leading blank spaces on the left side of the input string have been removed. an LU_CUSTOMER table includes an ADDRESS column. 350 West Elm Avenue. You can create an attribute form to display all characters for a customer’s address in lower case. Removing these spaces helps standardize the display of information and makes the information more readable. and 4400 spring road. column.2 Standard Functions MicroStrategy Functions Reference Example The Lower function can be used to display information in all lower case for attribute forms. .

For information on the syntax used in your specific database. In addition to locating the position of a substring. Syntax Position (Argument1. Position also can be used to test whether the substring is present. For example. To remove both leading and trailing blank spaces. Inc. use the Trim function (Trim. refer to Appendix A. Position (position of substring) The Position function returns the starting position of the first occurrence of a series of characters in the input string. String functions 229 . Argument2 is the substring to search for. MicroStrategy and Database Support for Functions.MicroStrategy Functions Reference Standard Functions 2 Example An LU_CUSTOMER table includes an ADDRESS column. © 2011 MicroStrategy. If a given substring is not found. 0 will be returned. Argument2) Where: • • Argument1 is the string in which to search for Argument2. You can create an attribute form to remove any leading blank spaces from the addresses. using the Position function to search for the string “Strategy” within the string “MicroStrategy” would return the value of 6. page 233). The definition of such an attribute form is shown below: LTrim([ADDRESS]) Any leading blank spaces included for addresses are removed from the display for the attribute form. and search in the section that corresponds to your database.

the first eight characters from the right of the string “MicroStrategy” would be “Strategy”. MicroStrategy and Database Support for Functions. the function listed above returns the value of 9. column. Inc. You use the Position function to find the word Street in the addresses as defined below. Syntax RightStr (Argument. For information on the syntax used in your specific database. For an example of how this function works. RightStr can be used to create attribute forms that display only part of the information available. fact. . or string representing the text string(s). 230 String functions © 2011 MicroStrategy. For addresses that do not include the word Street. a value of 0 would be returned. “Street”) For an address of 10 Main Street. refer to Appendix A. Length is an integer indicating the number of characters to be returned. consider an LU_CUSTOMER table that includes an ADDRESS column. This can be helpful when some information needs to be hidden for security purposes. RightStr (right string selection) The RightStr function returns a substring taken as a specified number of characters from the right of the input string. For example.2 Standard Functions MicroStrategy Functions Reference Example The Position function can be used in conjunction with other functions to perform various manipulations on strings. Position([ADDRESS]. as in the credit card example below. Length) Where: • • Argument is a metric. and search in the section that corresponds to your database.

Syntax RTrim(Argument) © 2011 MicroStrategy. RTrim (right trim) The RTrim function returns a string in which blank spaces on the right side of the input string have been removed. Removing these spaces helps standardize the display of information and makes the information more readable. which may have been caused by errors in data entry. You create attribute forms to display only the last four digits of the customers’ credit card numbers. For example. using the RTrim function on the string “MicroStrategy ” would return the string “MicroStrategy”. Concat(“XXXX-XXXX-XXXX-”. 4)) This definition would modify the display of a credit card number from 1111-2222-3333-4444 to be displayed as XXXX-XXXX-XXXX-4444. 4) The integer value of 4 causes the RightStr function to only display the last four characters from the CREDIT_CARD_NUMBER column. String functions 231 . Inc. RightStr([CREDIT_CARD_NUMBER]. You could also combine this functionality with the Concat function to display Xs or other characters to represent the digits for the credit card that are not displayed. RTrim helps to remove trailing blank spaces. The definition of such an attribute form is shown below: RightStr([CREDIT_CARD_NUMBER].MicroStrategy Functions Reference Standard Functions 2 Example An LU_CUSTOMER table includes a CREDIT_CARD_NUMBER column that contains credit card numbers for online customers.

refer to Appendix A. or string representing the text string(s). Position is an integer indicating the starting position inside the string. column. page 233). refer to Appendix A. Length) Where: • • • Argument is a metric. You can create an attribute form to remove any trailing blank spaces from the addresses. and search in the section that corresponds to your database. and search in the section that corresponds to your database. For information on the syntax used in your specific database. fact. . fact. use the Trim function (Trim. Position. 232 String functions © 2011 MicroStrategy. For information on the syntax used in your specific database. To remove both leading and trailing blank spaces. MicroStrategy and Database Support for Functions. column. or string representing the text string(s).2 Standard Functions MicroStrategy Functions Reference Where: • Argument is a metric. MicroStrategy and Database Support for Functions. Example An LU_CUSTOMER table includes an ADDRESS column. Inc. The definition of such an attribute form is shown below: RTrim([ADDRESS]) Any trailing blank spaces included in the addresses are removed from the display for the attribute form. SubStr is useful for isolating a specific section of a string that contains relevant information. Syntax SubStr(Argument. Length is an integer indicating the number of characters to be returned. SubStr (substring selection) The SubStr function returns a substring taken as a specified sequence of characters from the input string.

Trim The Trim function returns a string in which blank spaces on either side of the input string have been removed. This column stores a ten-digit number. 2) The substring retrieved starts at the fourth digit and retrieves two characters. This includes two digits which identify the location in which the item is sold.MicroStrategy Functions Reference Standard Functions 2 Example An LU_ITEM table includes an ITEM_ID column. this function returns 45. Inc. To retrieve these digits and determine the location of sale for an item. These two digits always start at the fourth digit from the left side of the ten-digit item ID number. The definition of such an attribute form is shown below: SubStr(ITEM_ID. or string representing the text string(s). © 2011 MicroStrategy. 4. using the Trim function on the string “ MicroStrategy ” would return the string “MicroStrategy”. For an item ID of 2334560897. which may have been caused by errors in data entry. fact. refer to Appendix A. which has been created to define various facts about the item. and search in the section that corresponds to your database. Syntax Trim(Argument) Where: • Argument is a metric. For example. Removing these spaces helps standardize the display of information and makes the information more readable. you can create an attribute form to return these two digits. column. The Trim function helps to remove leading and trailing blank spaces. For information on the syntax used in your specific database. String functions 233 . MicroStrategy and Database Support for Functions.

column. The definition of such an attribute form is shown below: Upper([ADDRESS]) An attribute form using a definition such as the one listed above would take input addresses such as 10 Main Street. refer to Appendix A. Inc.2 Standard Functions MicroStrategy Functions Reference Example An LU_CUSTOMER table includes an ADDRESS column. The definition of such an attribute form is shown below: RTrim([ADDRESS]) Any leading or trailing blank spaces included in the addresses are removed from the display for the attribute form. using the Upper function on the string “MicroStrategy” would return the string “MICROSTRATEGY”. You can create an attribute form to remove any leading and trailing blank spaces from the addresses. For information on the syntax used in your specific database. Upper (upper case) The Upper function returns a string in which all alphabetic characters in an input string are displayed as upper case. MicroStrategy and Database Support for Functions. respectively. and 4400 Spring Road and display them as 10 MAIN STREET. 234 String functions © 2011 MicroStrategy. The Upper function can be used to display information in all upper case for attribute forms. 350 WEST ELM AVENUE. Example An LU_CUSTOMER table includes an ADDRESS column. Syntax Upper(Argument) Where: • Argument is a metric. For example. and search in the section that corresponds to your database. . and 4400 SPRING ROAD. You can create an attribute form to display all characters for a customer’s address in upper case. 350 West Elm Avenue. or string representing the text string(s).

They provide the means to perform simple mathematical operations. page 254 © 2011 MicroStrategy. and evaluate logical conditions. OPERATORS Introduction The operators described in this chapter are building block functions. page 236 Comparison operators.3 3. page 249 Logical operators. 235 . The following categories of operators are covered in this chapter: • • • • Arithmetic operators. page 239 Comparison for rank operators. search strings. Inc. compare values.

such as Minus. or functions that return numbers or big decimals. facts. 236 Arithmetic operators © 2011 MicroStrategy. big decimals. In this case. big decimals. metrics representing a list of numbers. or functions that return numbers or big decimals.Freight This metric returns the difference between the revenue and freight charges. .Arg2 Where: Arg1 and Arg2 are attributes. Plus. Times. which are among the most commonly used operators. Syntax Arg1 * Arg2 Where: Arg1 and Arg2 are attributes. facts. Example A metric is defined as: Revenue . Inc. Divide. A brief description of each operator follows. and Unary Minus. Both Arg1 and Arg2 must be of the same data type. Times (*) Returns the product of two values. with the exception if Arg1 is a Date data type. metrics representing a list of numbers.3 Operators MicroStrategy Functions Reference Arithmetic operators The arithmetic operators are basic mathematical functions. Arg2 must be a number. Minus (-) Returns the difference between two values. Syntax Arg1 . date/time.

Arg2 must not be zero. In addition.MicroStrategy Functions Reference Operators 3 Example A metric is defined as: ([Unit Profit] * [Units Sold]) This metric returns the product of the unit profit and the units sold values. Inc. Example A metric is defined as: (Profit / [Units Sold]) This metric returns the quotient of the profit and number of units sold. Divide (/) Returns the quotient when one value is divided by another. Plus (+) Returns the sum of two values. Syntax Arg1 / Arg2 Where: Arg1 and Arg2 are attributes. big decimals. Arithmetic operators 237 . facts. or functions that return numbers or big decimals. Syntax Arg1 + Arg2 © 2011 MicroStrategy. metrics representing a list of numbers.

. Syntax U-(Arg) Where: Arg is an attribute. Unary minus (U-) Returns the absolute value of a negative value or the negative value of a positive value. Example A metric is defined as: Cost + Freight This metric returns the sum of the cost and the freight charges. the other argument must be a number. If the profit value is negative. In addition. big decimals. Example A metric is defined as: U-(Profit) This metric changes the sign of the profit value. If the profit value is positive. Inc. 238 Arithmetic operators © 2011 MicroStrategy. if either of the two arguments is date/time. or a function that returns numbers and big decimals. it returns a negative value. it returns a positive value. facts.3 Operators MicroStrategy Functions Reference Where: Arg1 and Arg2 are attributes. fact. metric representing a list of numbers. or functions that return numbers and big decimals. or metrics representing a list of numbers.

Comparison operators 239 . or functions that return any values of the mentioned data types. Arg1 and Arg2 must be of the same data type.MicroStrategy Functions Reference Operators 3 Comparison operators These functions are used to compare values. Example A condition is defined as: Profit < Cost This condition returns TRUE only if the profit is less than the cost. A brief description of each operator follows. which can be numbers. text strings. text strings. Inc. or metrics representing a list of numbers. expressions. Syntax Arg1 < Arg2 Where: Arg1 and Arg2 are attributes. Less than or equal (<=) Returns TRUE if the first value is less than or equal to the second value. or functions that return literal values. date and time. facts. The comparison patterns of text strings may or may not be case-sensitive depending on the database implementation. Syntax Arg1 <= Arg2 © 2011 MicroStrategy. date/time. Less than (<) Returns TRUE if the first value is less than the second value.

or functions that return literal values. text strings. Syntax Arg1 <> Arg2 Where: Arg1 and Arg2 are attributes. Arg1 and Arg2 must be of the same data type. Example A condition is defined as: Profit <> Cost This condition returns TRUE only if the profit is not equal to the cost. Inc. Example A condition is defined as: Profit <= Cost This condition returns TRUE only if the profit is less than or equal to the cost. Not equal (<>) Returns TRUE if two given values are not equal to each other. . facts.3 Operators MicroStrategy Functions Reference Where: Arg1 and Arg2 are attributes. 240 Comparison operators © 2011 MicroStrategy. or functions that return literal values. metrics representing a list of numbers. facts. text strings. or metrics representing a list of numbers. date/time. Arg1 and Arg2 must be of the same data type. date/time.

© 2011 MicroStrategy. text strings. or functions that return literal values. Inc. Comparison operators 241 . Syntax Arg1 > Arg2 Where: Arg1 and Arg2 are attributes. facts. Example A condition is defined as: Profit = Cost This condition returns TRUE if the profit is equal to the cost.MicroStrategy Functions Reference Operators 3 Equal (=) Returns TRUE if the two given values are equal to each other. facts. Example A condition is defined as: Profit > Cost This condition returns TRUE only if the profit is greater than the cost. Arg1 and Arg2 must be of the same data type. date/time. Syntax Arg1 = Arg2 Where: Arg1 and Arg2 are attributes. or functions that return literal values. date/time. Greater (>) Returns TRUE if the first value is greater than the second value. text strings. metrics representing a list of numbers. Arg1 and Arg2 must be of the same data type. metrics representing a list of numbers.

“Northeast”. Begins with Returns TRUE if a text string begins with a specified text pattern. “Northwest”. 242 Comparison operators © 2011 MicroStrategy. Syntax Arg1 Begins With Arg2 Where: Arg1 and Arg2 are text strings. Arg1 and Arg2 must be of the same data type. date/time. Example A condition is defined as: Profit >= Cost This condition returns TRUE only if the profit is greater than or equal to the cost. Example Region@DESC Begins with "North" Returns TRUE for Regions. Inc. . metrics representing a list of numbers. text strings. facts. such as. The text pattern comparison may or may not be case sensitive depending on the database implementation.3 Operators MicroStrategy Functions Reference Greater than or equal (>=) Returns TRUE if the first value is greater than or equal to the second value. Syntax Arg1 >= Arg2 Where: Arg1 and Arg2 are attributes. or functions that return literal values.

MicroStrategy Functions Reference Operators 3 Between Returns TRUE if the specified value is between the inclusive range of two boundaries. Inc. text. Boundary1 and Boundary2 must be of the same data type. Syntax Arg1 Contains Arg2 Where: Arg1 and Arg2 must be of data type Text. Example • • • M1 Between 1 and 1000 region@DESC Between "A" and "Z" date@DESC Between '1999-2-12' and '2005-2-23' Contains Returns TRUE if a text string contains a specified text pattern. and so on. “Smithson”. Value. Comparison operators 243 . date/time. Syntax Value Between Boundary1 and Boundary2 Where: • Value. or functions that return the mentioned data types. and Boundary2 can be numbers. Example Employee@[Last Name] Contains "Smith" Returns TRUE for Employees with a last name such as “Smith”. Boundary1. Between can be used to test if a value is within a valid data range. © 2011 MicroStrategy.

It can be of the data type numbers. Example Employee@[Last Name] Ends with "son" Returns TRUE for Employees with a last name such as “Smithson”. or functions that return these data types. 2001. Syntax Arg1 Ends With Arg2 Where: Arg1 and Arg2 must be of data type Text. Inc. text. Examples • • Employee@[Last Name] in {"Smith". . In Returns TRUE if a value is contained in a specified list of values. big decimals. “Johnson” etc.3 Operators MicroStrategy Functions Reference Ends with Returns TRUE if a text string ends with a specified text pattern. "Michael"} Year in {2000. 2002} 244 Comparison operators © 2011 MicroStrategy. date/time. "Cooper". Syntax Arg1 In Arg2 Where: Arg2 is a list of the literals with the same data type as Arg1.

Like is equal to “=”. Depending on the wildcards used in the pattern. If there is more than one wildcard. Like is equal to “Begin with”. and so on. This function is used to search for related strings. Comparison operators 245 . or =. “SouthEast”. returns FALSE. Syntax Arg1 Like Arg2 Where: Arg1 and Arg2 must be of data type Text. If the wildcard is in the end. Usage notes • • • • • Wildcards can be used in Arg2 to match any patterns. If the wildcard is in the beginning.MicroStrategy Functions Reference Operators 3 Like Returns TRUE if a text string matches a specified text pattern. Example • Region@DESC like 'South' Returns TRUE if region is “South”. Like is equal to “contain”. If there is no wildcard in Arg2. © 2011 MicroStrategy. and so on. otherwise. • Region@DESC like 'South%' Returns TRUE if region is “South”. Ends With. “SouthEast”. Like can be used in place of Begins With. “South”. Inc. Like is equal to “End with”. • Region@DESC like '%South%' Returns TRUE if region is “Mid Southern”. Contains.

They can be of any data type that Microstrategy supports. “North”.3 Operators MicroStrategy Functions Reference Not begins with Returns TRUE if a text string does not begin with a specified text pattern. Inc. and Boundary2 must be of the same data type. Syntax Arg1 Not Begins With Arg2 Where: Arg1 and Arg2 must be of data type Text. Boundary1. and so on. Example Year not between 2000 and 2005 Returns TRUE if Year = 1999 246 Comparison operators © 2011 MicroStrategy. Example Region@DESC Not Begins with "South" Returns TRUE if region is “Northeast”. Syntax Value Not Between Boundary1 and Boundary2 Where: Value. Not between Returns TRUE if a specified value does not lie in between two given boundaries. .

“West”. Syntax Arg1 Not Contains Arg2 Where: Arg1 and Arg2 must be of Text data type. Comparison operators 247 . Syntax Arg1 Not Ends With Arg2 Where: Arg1 and Arg2 must be of Text data type. Example Region@DESC Not Contains "South" Returns TRUE if region is “North”. and so on. Not ends with Returns TRUE if a text string does not end with the specified text pattern. © 2011 MicroStrategy.MicroStrategy Functions Reference Operators 3 Not contains Returns TRUE if a text string does not contain the specified text pattern. Inc. Example Region@DESC Not Ends With "East" Returns TRUE if region is “Northwest”. and so on. “West”.

“North”. and so on. 248 Comparison operators © 2011 MicroStrategy. “Mid South”. Syntax Arg1 not in Arg2 Where: Arg2 must be a list with one or more elements. 2003) Returns TRUE if year is 2000. Arg1 and Arg2 can be of any data type that MicroStrategy supports. Example Region@DESC not like “South%” Returns TRUE if region is “Northeast”. Not like Returns TRUE if a text string does not match the specified text pattern. and so on. returns FALSE. Inc. Arg1 must be of the same data type as the elements in Arg2.3 Operators MicroStrategy Functions Reference Not in Returns TRUE if a given value is not in the specified list of values. Syntax Arg1 Not Like Arg2 Where: Arg1 and Arg2 must be of data type Text. Example Year not in (2002. . otherwise. 2001.

Inc. Syntax ValueList *<= Condition Where: • • ValueList is the list of the rank values of a metric. page 250 Equal enhanced (*=). page 251 Greater than or equal enhanced (*>=). Example Build a Set Qualification filter with • • Metric: M1 Function: Rank © 2011 MicroStrategy.MicroStrategy Functions Reference Operators 3 Comparison for rank operators These functions compare rank values. Comparison for rank operators 249 . Condition is the value to be compared. page 252 Not between enhanced (Not *Between). The list values are generated from the Rank function. The Comparison for rank operators are: • • • • • • Less than or equal enhanced (*<=). page 251 Between enhanced (*Between). Usage notes Returns all values in the ValueList that satisfy the condition. page 253 Less than or equal enhanced (*<=) Returns TRUE for values in a list which are less than or equal to a specified condition. page 249 Not equal enhanced (*<>).

Inc. Usage notes Returns all values in ValueLists that satisfy the condition. Syntax ValueList *<> Condition Where: • • ValueList is the list of the rank values of a metric.3 Operators MicroStrategy Functions Reference • • Operator: *<= Value: 2 Returns TRUE for the values of M1 whose rank values are less than or equal to 2. Example Build a Set Qualification filter with • • • • Metric: M1 Function: Rank Operator: *<> Value: 2 Returns TRUE for the values of M1 whose rank values are not equal to 2. . Condition is the value to be compared. The list values are generated from the Rank function. 250 Comparison for rank operators © 2011 MicroStrategy. Not equal enhanced (*<>) Returns TRUE for values in a list which are not equal to a specified condition.

The list values are generated from the Rank function. Inc. Condition is the value to be compared. The list values are generated from the Rank function. Comparison for rank operators 251 . Syntax ValueList *>= Condition Where: • • ValueList is the list of the rank values of a metric.MicroStrategy Functions Reference Operators 3 Equal enhanced (*=) Returns TRUE for values in a list which are equal to a specified condition. Example Build a Set Qualification filter with • • • • Metric: M1 Function: Rank Operator: *= Value: 2 Returns TRUE for the values of M1 whose rank values are equal to 2. Greater than or equal enhanced (*>=) Returns TRUE for values in a list which are greater than or equal to a specified condition. Syntax ValueList *= Condition Where: • • ValueList is the list of the rank values of a metric. Condition is the value to be compared. © 2011 MicroStrategy.

. Usage notes *Between is inclusive which means any value greater than or equal to Condition1 and less than or equal to Condition2 will return TRUE. Example Build a Set Qualification filter with • • • Metric: M1 Function: Rank Operator: *between 252 Comparison for rank operators © 2011 MicroStrategy. Between enhanced (*Between) Returns TRUE for the values in a list of values that are in a specified range. The values are generated from the Rank function. Inc.3 Operators MicroStrategy Functions Reference Example Build a Set Qualification filter with • • • • Metric: M1 Function: Rank Operator: *>= Value: 2 Return TRUE for the values of M1 whose rank values are greater than or equal to 2. Condition1 and Condition2 set the range of values to be compared. Syntax ValueList *Between Condition1 and Condition2 Where: • • ValueList is the list of the rank values of a metric.

Example Build a Set Qualification filter with • • • • • Metric: M1 Function: Rank Operator: *Not between Value: 2 and Value: 8 Return TRUE for the values of M1 whose rank values are less than 2 or greater than 8. Syntax ValueList Not *Between Condition1 and Condition2 Where: • • ValueList is the list of the rank values of a metric. Not between enhanced (Not *Between) Returns TRUE if a list of rank values is not within a specified range. Condition1 and Condition 2 set the range of values to be compared.MicroStrategy Functions Reference Operators 3 • • Value: 2 and Value: 8 Returns TRUE for the values of M1 whose rank values are between 2 and 8. Inc. Usage notes Values equal to Condition1 and Condition2 are not satisfied with the condition. The values are generated from the Rank function. Comparison for rank operators 253 . © 2011 MicroStrategy.

The condition can contain metrics. The condition must be evaluated as TRUE or FALSE. and the Freight is less than 500. Syntax IF (Condition. IF Returns a value if the specified condition is TRUE. the Cost is less than 1000. and constants. otherwise. functions. comparison and logical operations. Inc. Example A condition is defined as: (Cost < 1000) And (Freight < 500) This condition will return TRUE only if both. . Syntax Arg1 And Arg2 Where: Arg1 and Arg2 are conditional expressions.3 Operators MicroStrategy Functions Reference Logical operators The logical operators allow certain conditions to be applied to two sets of filter expressions simultaneously. otherwise. FalseBranch) 254 Logical operators © 2011 MicroStrategy. TrueBranch. a default value is returned. This is a single value function. And Returns TRUE if both the specified conditions are TRUE. returns FALSE.

Not Returns TRUE if the specified condition is FALSE. FalseBranch is a constant or metric value to return if the condition is FALSE. Syntax Not(Arg1) Where: Arg1 is the conditional expression. otherwise the return value is undefined. comparison and logical operations. and constants. Logical operators 255 . Example A metric is defined as: IF ((Total Revenue < 300000).000. The condition can contain metrics. otherwise. and FALSE if the condition is TRUE. comparison and logical operations. The condition can contain metrics. and constants. Inc. Example A condition is defined as: Not ((Profit <= 0)) © 2011 MicroStrategy. TrueBranch is a constant or metric value to return if the condition is TRUE. 1) This metric returns 0 if the Total Revenue is less than 300.MicroStrategy Functions Reference Operators 3 Where: • Condition is the conditional expression. The condition must be evaluated to be TRUE or FALSE. 0. it returns 1. The condition must be evaluated as TRUE or FALSE. • • Usage notes FalseBranch must be provided.

and constants.3 Operators MicroStrategy Functions Reference This condition returns TRUE only if the profit is greater than zero. comparison and logical operations. . and the Freight is greater than 500. 256 Logical operators © 2011 MicroStrategy. The condition can contain metrics. Syntax Arg1 Or Arg2 Where: Arg1 and Arg2 are conditional expressions. Example A condition is defined as: (Cost <= 1000) Or (Freight <= 500) This condition returns FALSE only if the Cost is greater than 1000. else returns TRUE. Inc. The condition must be evaluated as TRUE or FALSE. Or Returns FALSE if both the specified conditions are FALSE.

financial. including data mining.4 4. and statistical functions. Each section briefly describes the category of function and then lists each function along with information designed to provide data necessary for understanding and implementing an individual function. . see Using custom plug-in functions. mathematical. Inc. invalid data types. or key items to know before using the function (if applicable) 257 • • © 2011 MicroStrategy. PLUG-IN PACKAGE FUNCTIONS Introduction The functions in this chapter represent the more advanced functions available in MicroStrategy. the parameter setting defaults. For more information on the plug-in functions and how to install the Function Plug-in Wizard. page 62. The information provided for each function includes: • • An explanation of the data returned by the function The syntax of the function including function name. and the types of data possible for use with the function The mathematical expression illustrating exactly how the calculation is defined in MicroStrategy (if applicable) Usage notes describing any error conditions. the available parameters.

. 258 Data mining functions © 2011 MicroStrategy. which includes these features: • • • • Using MicroStrategy to create multi-variable regression predictive models Support for importing third-party predictive models using the PMML industry standard A Predictive Model Viewer that visualizes the predictive model A set of sample predictive metrics and reports incorporated into Customer Analysis Module (CAM) In addition. MicroStrategy and Database Support for Functions for a list of the databases and the functions they support. page 259 Mathematical functions. page 334 Data mining functions Data mining generally refers to examining a large amount of data to extract valuable information. The Data Mining Services chapter introduces MicroStrategy Data Mining Services. The data mining process involves using the predictive models based on existing and historical data to project potential outcome for business activities and transactions. this can be either a report example or a simple text description of the data returned based on the specified input See Appendix A. Inc. page 258 Financial functions. page 313 Statistical functions. Data mining is covered in the Data Mining Services chapter of the MicroStrategy Advanced Reporting Guide. The following categories of functions are covered: • • • • Data mining functions. MicroStrategy Data Mining Services facilitates the development and deployment of these predictive models. the Data Mining Services chapter of the Advanced Reporting Guide describes the process of how to create and use predictive models with MicroStrategy and provides a business case for illustration.4 Plug-In Package Functions MicroStrategy Functions Reference • An example of the function in use.

© 2011 MicroStrategy. Rate is the annual coupon rate. and 4 where annual payments =1. The valid values are. This is the date. Syntax Accrint <Par = 1000. Financial functions 259 . FirstInterest is the first date on which interest is accrued. Accrint (accrued interest) Accrued interest is interest that has accumulated over a period of time. on which the security is traded. This function returns the amount of accrued interest on a security that pays periodic interest. regardless of the database environment. FirstInterest. Settlement is the settlement date. Frequency) Where: • • • • • • Issue is the issue date. Basis> (Issue. and only valid value is 1000. Par is a parameter that indicates the par value. Inc. 1. Frequency is the number of coupon payments per year. 2. The default. but has not yet been paid. after issue. All finance-related calculations are performed by the MicroStrategy Analytical Engine. Settlement.MicroStrategy Functions Reference Plug-In Package Functions 4 Financial functions The financial functions plug-in package in MicroStrategy provides access to many standard financial calculations. semiannual payments =2. and quarterly payments =4. Rate.

actual number of days in each year. in days. Expression rate ACCRINT = par × ---------------------------------. or Settlement is not a valid date Par ≠ 1000 Issue ≥ Settlement Frequency is a value other than 1. 360 days in each year. 2. or Frequency is not an integer. that fraction is rounded up to the nearest integer) NLi is the normal length. Used by European agencies. . Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month.4 Plug-In Package Functions MicroStrategy Functions Reference • Basis is a parameter that indicates the time-count basis to be used. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Application Assumes 30 days in each month. FirstInterest.× frequency Where: • • Ai is the number of accrued days for the ith quasi-coupon period within an odd period NC is the number of quasi-coupon periods that fit an odd period (if this period contains a fraction. The default value for Basis is 0. FirstInterest. Inc. Assumes actual number of days in each month. assumes the same values as “0” for American institutions. 360 days in each year. 365 days in each year. Possible values for this parameter are listed in the following table. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. of the ith quasi-coupon period within an odd period NC ∑ i=1 Ai ---NL i • Usage notes • • If Issue. it is truncated The engine returns an empty cell if: Issue. or 4 260 Financial functions © 2011 MicroStrategy. Settlement.

Basis=0> (‘3/22/2003’. Syntax Accrintm <Par = 1000.000 par value Frequency is semiannual Basis is 30/360 The accrued interest is defined as: Accrint <Par=1000. This is the date on which the coupon expires. Rate) Where: • • • Issue is the issue date. Maturity is the maturity date. © 2011 MicroStrategy. Maturity. This function returns the accrued interest amount on a security that pays periodic interest at maturity.0. the FirstInterest date and the Settlement date should be included within single quotations in the expression for the expression to be considered as a valid expression Example This example displays the expression built using Accrint for a treasury bond with the following terms: • • • • • • • March 22. issue date June 20. Inc. Basis> (Issue.1. Rate is the annual coupon rate.0 percent coupon $1.MicroStrategy Functions Reference Plug-In Package Functions 4 • The Issue date.’9/16/2003’. 2003. but has not yet been paid. 2003. first interest date September 16. settlement date 10. 2003.’6/20/2003’. Financial functions 261 .2) {~+} Accrintm (accrued interest at maturity) Accrued interest is interest that has accumulated over a period of time.

Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. and only valid. value is 1000. Application Assumes 30 days in each month. actual number of days in each year. Used by European agencies. Inc. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. Basis is a parameter that indicates the time-count basis to be used. The default. the value used is the number of days from issue to maturity) D is the annual-yield basis Usage notes • • If Issue or Maturity is not an integer. it is truncated. 360 days in each year.4 Plug-In Package Functions MicroStrategy Functions Reference • • Par is a constant that indicates the par value. 360 days in each year. Possible values for this parameter are listed in the following table. Expression A ACCRINTM = par × rate × D Where: • • A is the accrued time (for interest-at-maturity items. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). . assumes the same values as “0” for American institutions. 262 Financial functions © 2011 MicroStrategy. Assumes actual number of days in each month. 365 days in each year. The engine returns an empty cell if Issue or Maturity is not a valid date Rate ≤ 0 Par ≠ 1000 • The Issue date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. The default value for Basis is 0.

This is the date. and quarterly payments =4. Inc.2 and 4 where annual payments =1.0.1){~+} Coupdaybs (coupon period. semiannual payments =2. maturity date 10.’6/20/2001’. on which the security is traded. Frequency is the number of coupon payments per year.0 percent coupon $1. Financial functions 263 . Basis=3> (‘3/22/2001’.MicroStrategy Functions Reference Plug-In Package Functions 4 Example This example displays the expression built using the Accrintm function for a note with the following terms: • • • • • • March 22. The valid values are 1. © 2011 MicroStrategy.000 par value Frequency is semiannual Basis is Actual/365 The accrued interest at maturity is defined as: Accrintm <Par=1000. This is the date on which the security expires. after issue. Maturity. 2001. issue date June 20. Maturity is the maturity date. Frequency) Where: • • • Settlement is the settlement date. 2003. beginning to settlement) Returns the number of days from the beginning of a coupon period to the settlement date. Syntax Coupdaybs <Basis> (Settlement.

and 4 where annual payments =1. Syntax Coupdays <Basis> (Settlement. Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. . number of days with settlement) Returns the number of days in the coupon period that contains the settlement date. semiannual payments =2. on which the security is traded. This is the date. This is the date on which the security expires. Coupdays (coupon period. Frequency) Where: • • • Settlement is the settlement date. Application Assumes 30 days in each month. The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. actual number of days in each year. and quarterly payments =4. 264 Financial functions © 2011 MicroStrategy. it is truncated. Assumes actual number of days in each month. assumes the same values as “0” for American institutions.4 Plug-In Package Functions MicroStrategy Functions Reference • Basis is a parameter that indicates the time-count basis to be used. Maturity is the maturity date. Maturity. Possible values for this parameter are listed in the following table. Inc. after issue. The valid values are 1. 365 days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). The default value for Basis is 0. 360 days in each year. 360 days in each year. Frequency is the number of coupon payments per year. Usage notes • • If an argument is not an integer. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. Used by European agencies. 2.

assumes the same values as “0” for American institutions. Usage notes • • • The number of days between milestones is computed depending on the chosen day basis Coupon functions are defined against the maturity day. 365 days in each year. Frequency) Where: • • Settlement is the settlement date. Assumes actual number of days in each month. This is the date on which the security expires. actual number of days in each year. Application Assumes 30 days in each month. Maturity. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. Inc. This is the date. Financial functions 265 . 360 days in each year. Maturity is the maturity date. Syntax Coupdaysnc <Basis = 0> (Settlement. 360 days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). on which the security is traded. Possible values for this parameter are listed in the following table. Used by European agencies. © 2011 MicroStrategy. The default value for Basis is 0. depending on frequency The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression Coupdaysnc (coupon period.MicroStrategy Functions Reference Plug-In Package Functions 4 • Basis is a parameter that indicates the time-count basis to be used. Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. after issue. settlement to next coupon) Returns the number of days from the settlement date to the next coupon date.

it is truncated. Coupncd (next date after settlement) Returns a number that represents the next coupon date after settlement. Used by European agencies. 2. semiannual payments =2. Usage notes • • If an argument is not an integer. Maturity. Frequency is a number other than 1. actual number of days in each year. Frequency) 266 Financial functions © 2011 MicroStrategy. Syntax Coupncd <Basis> (Settlement. The default value for Basis is 0. 365 days in each year. Basis is a parameter that indicates the time-count basis to be used. and quarterly payments =4.4 Plug-In Package Functions MicroStrategy Functions Reference • Frequency is the number of coupon payments per year. 360 days in each year. • Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. or 4. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. 2. Possible values for this parameter are listed in the following table. Settlement ≥ Maturity. . assumes the same values as “0” for American institutions. Inc. Assumes actual number of days in each month. Application Assumes 30 days in each month. The valid values are 1. The engine returns an empty cell if Settlement or Maturity is not a valid date. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. 360 days in each year. and 4 where annual payments =1. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360).

Maturity is the maturity date. Financial functions 267 . which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). assumes the same values as “0” for American institutions. The default value for Basis is 0. actual number of days in each year. it is truncated. Inc. 2. Application Assumes 30 days in each month. 2. Usage notes • • If an argument is not an integer. semiannual payments =2. 365 days in each year. Assumes actual number of days in each month. Possible values for this parameter are listed in the following table. The valid values are 1. This is the date on which the security expires. or 4. • Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. Used by European agencies. Frequency is a number other than 1. Basis is a parameter that indicates the time-count basis to be used. and quarterly payments =4. Settlement ≥ Maturity. Frequency is the number of coupon payments per year. after issue. and 4 where annual payments =1. This is the date. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. 360 days in each year. 360 days in each year. © 2011 MicroStrategy. The engine returns an empty cell if: Settlement or Maturity is not a valid date. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. on which the security is traded.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • Settlement is the settlement date.

360 days in each year. 1. Usage notes • • The number of days between milestones is computed depending on the chosen day basis. • Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. semiannual payments =2. This is the date. . Application Assumes 30 days in each month. Frequency) Where: • • • Settlement is the settlement date. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. The valid values are. Assumes actual number of days in each month. Used by European agencies. Coupon functions are defined against the maturity day. 2. and 4 where annual payments =1. 268 Financial functions © 2011 MicroStrategy. Possible values for this parameter are listed in the following table. actual number of days in each year. Maturity is the maturity date. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). 360 days in each year. assumes the same values as “0” for American institutions. Frequency is the number of coupon payments per year. Syntax Coupnum <Basis> (Settlement. depending on frequency. The default value for Basis is 0. number payable between settlement and maturity) Returns the number of coupons payable between the settlement date and maturity date. after issue. on which the security is traded. Inc. Basis is a parameter that indicates the time-count basis to be used. Maturity. 365 days in each year. rounded up to the nearest whole coupon.4 Plug-In Package Functions MicroStrategy Functions Reference Coupnum (coupon. This is the date on which the security expires. and quarterly payments =4.

and 4 where annual payments =1. Application Assumes 30 days in each month. The default value for Basis is 0. 360 days in each year. and quarterly payments =4. semiannual payments =2. on which the security is traded. Maturity. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). after issue. • Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. Maturity is the maturity date. This is the date. Frequency is the number of payments per year. Frequency) Where: • • • Settlement is the settlement date. Inc. assumes the same values as “0” for American institutions. 2. Couppcd (coupon date.MicroStrategy Functions Reference Plug-In Package Functions 4 • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. 365 days in each year. it is truncated. The valid values are 1. Syntax Couppcd <Basis> (Settlement. Usage notes • If an argument is not an integer. Possible values for this parameter are listed in the following table. previous) Returns a number that represents the coupon date before settlement date. Financial functions 269 . Basis is a parameter that indicates the time-count basis to be used. Assumes actual number of days in each month. actual number of days in each year. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. This is the date on which the security expires. 360 days in each year. Used by European agencies. © 2011 MicroStrategy.

4 Plug-In Package Functions MicroStrategy Functions Reference • The engine returns an empty cell if: Settlement or Maturity is not a valid date. For annual payments on a four-year loan at an annual interest rate of 12%. Start. . • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Cumipmt (cumulative interest paid) Returns the cumulative interest paid on a loan over a specified period of time. 2. Rate = 12%. End) Where: • • • • • • Rate is the interest rate. Settlement ≥ Maturity. Payment period counting begins at 1. Type is the timing of the payment. 270 Financial functions © 2011 MicroStrategy. Nper = 4 × 12. Inc. Nper is the total number of payment periods. Nper = 4. Syntax Cumipmt <Type = 0> (Rate. it is truncated. Start is the first period in the calculation. • If Nper. or 4. Nper. Pv is the present loan value. Start. End is the last period in the calculation. or Type is not an integer. End. Rate = 12%/12. Frequency has a value other than 1. Pv. Usage notes • Consistency is important when specifying Rate and Nper: For monthly payments on a four-year loan at an annual interest rate of 12%.

End) Where: • • • Rate is the interest rate.0075.125000.MicroStrategy Functions Reference Plug-In Package Functions 4 • The engine returns an empty cell if: Rate ≤ 0.0075. Financial functions 271 .24) equals -11135.00% ÷ 12 = 0. Nper.125000.1.000 The total interest paid in the second year of payments (periods 13 through 24) is defined as follows: CUMIPMT(0.1) equals -937. Inc. or Pv ≤ 0 Start < 1 or End < 1 Start > End Type ≠ 0 Example A home mortgage loan has the following terms: • • • Interest rate: 9.360.50 Cumprinc (cumulative principal paid) Returns the cumulative principal paid on a loan over a specified period of time. Syntax Cumprinc <Type = 0> (Rate.13.23 The interest paid in a single payment in the first month is defined as follows: CUMIPMT(0. Pv. Pv is the present loan value. Start. © 2011 MicroStrategy. Nper ≤ 0.0075) Term: 30 years (nper = 30 × 12 = 360) Present value: $125.00 percent per annum (rate = 9.360. Nper is the total number of payment periods.

00 percent per annum (rate = 9.125000.27827 272 Financial functions © 2011 MicroStrategy.1) equals -68. End.1.360.0075. Usage notes • Consistency is important when specifying Rate and Nper: For monthly payments on a four-year loan at an annual interest rate of 12%. End is the last period in the calculation. Start. it is truncated.00% ÷ 12 = 0. For annual payments on a four-year loan at an annual interest rate of 12%.125000.0075. Rate = 12%.360. Rate = 12%/12. .13. • • If Nper. Nper = 4. Nper ≤ 0. Type is a parameter that indicates the timing of the payment. Nper = 4 × 12. Payment period counting begins at 1.000 The total principal paid in the second year of payments (periods 13 through 24) is defined as follows: CUMPRINC(0. The engine returns an empty cell if Rate ≤ 0. or Type is not an integer.4 Plug-In Package Functions MicroStrategy Functions Reference • • • Start is the first period in the calculation. Inc. or Pv ≤ 0 Start< 1 or End < 1 Start > End Type ≠ 0 Example A home mortgage loan has the following terms: • • • Interest rate: 9.1071 The principal paid in a single payment in the first month is defined as follows: CUMPRINC(0.24) equals -934.0075) Term: 30 years (nper = 30 × 12 = 360) Present value: $125.

Double declining balance is a method of accelerated depreciation that is twice as fast as the straight line depreciation method. Inc. Month is an integer indicating the number of months in the first year. Period) Where: • • • • • Cost is the initial cost of the asset. This is a method of accelerated depreciation which is faster than straight line depreciation early in the life of the asset. Financial functions 273 . Expression • To calculate depreciation over any given period: ( Cost – depreciation from previous periods ) × Rate Where: Rate = 1 – [ salvage ⁄ ( Cost ) • 1 ⁄ ( life ) ] To calculate depreciation for the first period: Cost × Rate × Month ⁄ 12 • To calculate depreciation for the last period: [ ( Cost – total depreciation from previous periods ) × R ate × ( 12 – M onth ) ] ⁄ 12 Ddb (double-declining balance (asset depreciation)) Returns the depreciation of an asset for a specified period. Period is the period of time over which depreciation is calculated. Life is the number of periods over which the asset is depreciated.MicroStrategy Functions Reference Plug-In Package Functions 4 Db (fixed-declining balance (asset depreciation)) Returns the depreciation of an asset for a specified period. Salvage. Salvage is the value of the asset at the end of the depreciation period. © 2011 MicroStrategy. using the double-declining-balance method. Life. This is sometimes referred to as the useful life of an asset. using the fixed-declining-balance method. Syntax Db <Month> (Cost.

Maturity is the maturity date. The double-declining balance method computes depreciation at an accelerated rate: depreciation is highest during the first period and decreases with each succeeding period. The discount rate is used to calculate the present value of expected or future benefits and costs. This is the date. Salvage is the cost at the end of depreciation.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax Ddb <Factor> (Cost. This is the date on which the security expires. 274 Financial functions © 2011 MicroStrategy. after issue. Price is the price per $100 of face value. Maturity. Redemption) Where: • • • • Settlement is the settlement date. Price. Factor is the rate at which the balance declines. Inc. Syntax Disc <Basis> (Settlement. Disc (discount rate for a security) Returns the discount rate on a security. Period is the period for which depreciation is calculated. Life is the number of periods over which depreciation occurs. Expression ( Cost – Salvage ) × Factor ⁄ Life Usage notes • • All arguments must be positive values. . Period) Where: • • • • • Cost is the initial cost. Life. on which the security is traded. Redemption is the redemption value per $100 of face value. Salvage.

Price ≤ 0 or Redemption ≤ 0. assumes the same values as “0” for American institutions. The default value for Basis is 0. Possible values for this parameter are listed in the following table. 365 days in each year. Settlement ≥ Maturity. Used by European agencies. Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. The engine returns an empty cell if Settlement or Maturity is not a valid date. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Application Assumes 30 days in each month.MicroStrategy Functions Reference Plug-In Package Functions 4 • Basis is a parameter that indicates the time-count basis to be used. Expression redemption – --B-----------. 360 days in each year. 360 days in each year. converted from fraction to decimal) Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number. Financial functions . Inc. Assumes actual number of days in each month. it is truncated. 275 © 2011 MicroStrategy.× ---------par DSM Where: • • B is the number of days in a year (see Basis) DSM is the number of days between settlement and maturity Usage notes • • If Settlement or Maturity is not an integer.par DISC = ---------------. actual number of days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Dollarde (dollar price. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month.

Maturity. CouponRate. YieldRate. Bonds with higher durations face higher risk from changes in interest rates. Syntax Duration <Basis> (Settlement. Fraction) Where: • • DecimalDollar is the dollar value to be converted Fraction is the fraction denominator value as an integer Duration Returns the Macauley duration for an assumed par value of $100. Duration is the weighted average of the present value of the cash flows and is used as a measure of a bond price’s response to changes in yield.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax Dollarde (FractionalDollar. Decimal) Expression 100 -------Dollarde = INT ( price ) + price – INT ( price ) × ⎛ ---------⎞ ⎝ fraction⎠ Where: • • price is the dollar value to be converted fraction is the fraction denominator value as an integer Dollarfr (dollar price. converted from decimal to fraction) Converts a dollar price expressed as a decimal into a dollar price expressed as a fraction. Frequency) 276 Financial functions © 2011 MicroStrategy. . Inc. Syntax Dollarfr (DecimalDollar.

2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. YieldRate is the annual yield.⎞ --⎜ ⎝ 1 + ----------⎠ ⎠ ⎝ ⎝ frequency × ⎝ 1 + ----------⎠ ⎠⎟ frequency frequency 1 -----------------------------------------------------------------------------------------= ⎜ ---------------------------------------------------------------------------------.⎠ --⎜ ⎟ ⎝ ⎝ k = 1⎜ E ⎠ E ⎜ ⎟ ⎜ ⎟ yld--yld--⎛ 1 + ----------⎞ ⎛ 1 + ----------⎞ frequency × ⎝ -----⎜ ⎟ -----⎝ ⎠ ⎝ frequency⎠ frequency⎠ ⎝ ⎠ ∑ ∑ © 2011 MicroStrategy.× 100 --⎜ ⎟ ⎛ ⎜⎜ 100 × coupon DSC⎞ ⎟ ⎟ E-----------------------------------------------------------⎜ ------------------------. semiannual payments =2.⎟ ----. Maturity is the maturity date. The valid values are 1. • Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month.⎞ -----yld--.⎠ ⎟ ------⎜ ⎟⎟ ⎝ ⎝ E E ⎠ k = 1⎜⎜ ⎜⎛ ⎟ ⎜⎜ ⎟⎟ ⎛ ---yld--. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Inc. Possible values for this parameter are listed in the following table.⎟ × ---------⎜ ⎟ frequency ⎛ ⎞ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ N ⎜ ⎟ ⎜ ⎟ ⎜ 100---------------------⎟ × coupon ⎜ ⎟ -----------------------------------. assumes the same values as “0” for American institutions.⎟ × ⎝ k – 1 + --. This is the date on which the security expires.+ ⎜ ⎜ -----------------------------------.+ -------------------------⎜ ⎜ ⎟ ⎜ ⎛ k – 1 + DSC⎞ ⎟ ⎛ N – 1 + DSC⎞ --. 365 days in each year. 360 days in each year.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • • • Settlement is the settlement date. This is the date. Frequency is the number of coupon payments per year. CouponRate is the annual interest rate of the coupon. on which the security is traded. and 4 where annual payments =1. Expression ⎞ ⎛⎛ ⎞⎞ ⎛ ⎜ ⎟ ⎜⎜ ⎟⎟ DSC ⎜ ⎟ ⎟⎟ N ⎜⎜ --. actual number of days in each year. Assumes actual number of days in each month.⎟ -------------------------100 ----------. 2. Used by European agencies.⎠ ⎟ ⎟ E ⎟⎟ ⎜ ⎜⎜ ⎛ k – 1 + DSC⎞ ⎟ ⎛ N – 1 + DSC⎞ --. Application Assumes 30 days in each month. after issue. and quarterly payments =4. The default value for Basis is 0. Basis is a parameter that indicates the time-count basis to be used. Financial functions 277 . 360 days in each year.

Npery Expression Effect = 1 + NominalRate ---------------------Npery Usage notes • • If Npery is not an integer. Npery is the number of compounding periods per year. it is truncated. . Syntax Effect(NominalRate. Npery <= 1. NominalRate ≤ 0. The engine returns an empty cell if Either argument is nonnumeric. Effect (effective annual interest rate) Returns the effective annual interest rate on a given amount. Npery) Where: • • NominalRate is the nominal interest rate.4 Plug-In Package Functions MicroStrategy Functions Reference Where: • • • DSC is the number of days from settlement to next coupon date E is the number of days in settlement’s coupon period N is the number of coupons from settlement to maturity Usage notes The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. This is the actual annual rate or yield on a loan. Inc. –1 278 Financial functions © 2011 MicroStrategy.

such as dividends. This typically includes principal and interest. Nper. it is assumed to be 0 (zero).MicroStrategy Functions Reference Plug-In Package Functions 4 Fv (future value) Returns the future value of an investment based on periodic. such as deposits. Pv is the present value (lump-sum amount) of future payments. Use this function to calculate the future value of an investment that has a variable or adjustable rate. are represented by positive numbers. If no value is provided. Usage notes • In all cases. funds received. Syntax Fv <Type> (Rate. but no other fees or taxes. Pmt is the (fixed) amount paid each period. Syntax Fvschedule <Basis> (Argument. The future value is equal to the present value plus the amount of accumulated interest that would be earned. Type is a parameter that indicates when payments are due. Inc. • Fvschedule (future value schedule) Returns the future value of an initial principal after a series of compound-interest rates are applied. Pmt. This can be applied to future payments. Pv) Where: • • • • • Rate is the interest rate per period. constant payments and a constant interest rate. Use the Fvschedule function for payments made with a variable or adjustable interest rate. are represented by negative numbers. Nper is the total number of payment periods. Financial functions 279 . with interest calculated for each payment. PV) © 2011 MicroStrategy. disbursements.

365 days in each year. Basis is a parameter that indicates the time-count basis to be used. The default value for Basis is 0. assumes the same values as “0” for American institutions. Assumes actual number of days in each month. This is the date. actual number of days in each year. Application Assumes 30 days in each month. Investment. Assumes actual number of days in each month. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Usage notes • • If Argument is nonnumeric. Maturity. Redemption) Where: • • Settlement is the settlement date. Possible values for this parameter are listed in the following table. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). PV is the present value of the investment. Assumes actual number of days in each month. after issue. the engine returns an empty cell. The interest rate is the percentage value that is multiplied by the principal to determine the amount of interest due or paid in a given period of time. Intrate (interest rate) Returns the interest rate for a fully invested security. Maturity is the maturity date. 280 Financial functions . 360 days in each year. © 2011 MicroStrategy. Inc. This is the date on which the security expires. on which the security is traded. Used by European agencies.4 Plug-In Package Functions MicroStrategy Functions Reference Where: • • • Argument is a set of applicable interest rates. 360 days in each year. Use the Fv function for payments made with a constant interest rate. Syntax Intrate <Basis> (Settlement.

Assumes actual number of days in each month. Basis is a parameter that indicates the time-count basis to be used.⎞ ⎝ ⎠ ⎝ DIM⎠ investment Where: • • • • Redemption is the amount actually received for the security Investment is the amount invested in the security B is the number of days in a year. Application Assumes 30 days in each month. depending on year basis DIM is the number of days from settlement to maturity Usage notes The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. constant payments and a constant interest rate.MicroStrategy Functions Reference Plug-In Package Functions 4 • • • Investment is the amount invested in the security. Expression redemption – ----------. The default value for Basis is 0. Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. Ipmt (interest payment) Returns the interest payment for a given period.investment Intrate = ⎛ ----------------------.⎞ ⎛ --. 360 days in each year. Inc.--B -----------. Financial functions 281 . which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). 360 days in each year. actual number of days in each year. Possible values for this parameter are listed in the following table. © 2011 MicroStrategy. Redemption is the amount actually received for the security. based on periodic. assumes the same values as “0” for American institutions. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. 365 days in each year. Used by European agencies.

METHOD. The internal rate of return is the interest rate received for an investment consisting of payments that occur periodically. expected after the last payment is made. PV) Where: • • • • • • Rate is the interest rate per period. but they must occur at regular intervals. The valid range is from 1 to Nperiod. Syntax IRR <FactID.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax Ipmt < FV. Period. SortBy> (Argument) 282 Financial functions © 2011 MicroStrategy. Guess. PV is the present value. quarterly. Usage notes • For this function. FV is a parameter that indicates the future value. Type is a parameter that indicates when payments are due. These payments do not need to be equal in value. Inc. Nperiod should be 4 × 12. . disbursements (such as deposits to savings) are represented by negative numbers. • For this function. funds received (such as dividend checks) are represented by positive numbers. Assuming annual payments on a four-year loan at 12% annual interest. Type> (Rate. Nperiod should be 4. Precision. Nperiod is the total number of payment periods. This is the total value that a series of future payments has today. Nperiod. also called the cash balance. IRR (internal rate of return) Returns the internal rate of return on a set of payments. such as monthly. consistency in the units used is necessary: Assuming monthly payments on a four-year loan at 12% annual interest. or annually. Period is the period for which the interest payment is sought.

The default value is 0. Mduration (modified duration) Returns the modified Macauley duration. Guess is a parameter that indicates an estimate assumed to be close to the result sought. • • • Precision is a parameter that determines how close the evaluation of a potential solution must be to zero to be considered valid. You can use the following values: 0 (default): The IRR function uses the secant method to determine the internal rate of return. Payments. page 19. for a security with an assumed par value of $100. Argument is a fact or metric representing a list of numbers for which the internal rate of return is sought. which can be thought of as representing an expected internal rate of return of 10 percent. as this is the order in which entries are interpreted for calculation. 1: The IRR function uses Newton’s method to determine the internal rate of return. Inc. This function is used as a measure of bond-price response to variations in yield. © 2011 MicroStrategy. Method is a parameter that determines the algorithm used to calculate the IRR function. This method can return results similar to those returned for internal rate of return functions that are supplied with Microsoft Excel. For more information see BreakBy and SortBy parameters. which is the weighted average of present payments. must be entered in the desired sequence.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Financial functions 283 . SortBy is a parameter that defines the order of calculation. • Usage notes • • The list of values must contain at least one positive entry and one negative entry. This is the recommended method as it can adjust the initial guess as required to return a result. whether positive or negative.1.

semiannual payments =2. Possible values for this parameter are listed in the following table. Maturity. 360 days in each year. after issue. The default value for Basis is 0. 360 days in each year. CouponRate. Basis is a parameter that indicates the time-count basis used. Frequency is the number of coupon payments per year. Application Assumes 30 days in each month. CouponRate is the annual interest rate of the coupon. This is the date. YieldRate. Assumes actual number of days in each month.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax Mduration <Basis> (Settlement. 365 days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). This is the date on which the security expires. Frequency) Where: • • • • • Settlement is the settlement date. • Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression Mduration = ---duration------------. on which the security is traded. Assumes actual number of days in each month. 2.---------yld ⎛ ----------⎞ 1 + --------⎝ frequency⎠ Where: • • yld is the security annual yield frequency is the number of coupon payments per year 284 Financial functions © 2011 MicroStrategy. . assumes the same values as “0” for American institutions. Maturity is the date of maturity. Inc. and quarterly payments =4. actual number of days in each year. The valid values are 1. Assumes actual number of days in each month. and 4 where annual payments =1. Used by European agencies. YieldRate is the annual yield.

YieldRate < 0.MicroStrategy Functions Reference Plug-In Package Functions 4 Usage notes • • If Settlement. Maturity. or Frequency is not an integer. Syntax MIRR <FactID> (Argument. FinancialRate. FinancialRate is the interest rate paid. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Inc. MIRR (modified internal rate of return) Returns the modified internal rate of return on a set of periodic payments. Settlement ≥ Maturity. 2. ReinvestRate is the interest rate received on reinvested funds. CouponRate < 0. The engine returns an empty cell if either Settlement or Maturity is not a valid date. Entries in this list can represent payments (negative values) or income (positive values) occurring at regular intervals. Frequency is a number other than 1. or 4. ReinvestRate) Where: • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. • • © 2011 MicroStrategy. Financial functions 285 . This function takes into consideration both the cost of investment and the interest received on investment. Argument is a list of values containing a set of numbers. it is truncated.

. based on the effective rate and the number of compounding periods per year.) × -1 .values [---------]-----+------. that payments and income be entered in the correct sequence.positive --. This is the interest rate that is not adjusted for actual or expected inflation. it is important. Npery < 1. Npery Expression Nominal = 1 + EffectiveRate --------------------------Npery Usage notes • • If Npery is not an integer. –1 286 Financial functions © 2011 MicroStrategy. the order in which entries are provided is assumed to be the order in which funds flow..----. In calculating the return for this function. Inc. The engine returns an empty cell if Either argument is nonnumeric. Npery) Where: • • EffectiveRate is the effective interest rate. ---1 n n–1 –1 Nominal (nominal annual interest rate) Returns the nominal annual interest rate on an investment. Npery is the number of compounding periods per year.-------. the engine returns an empty cell. therefore.4 Plug-In Package Functions MicroStrategy Functions Reference Expression ⎛ –----(------. EffectiveRate ≤ 0.rrate ) ⎝ NPV ( frate . Syntax Nominal(EffectiveRate.--------. it is truncated.values [ negative ] ) × ( 1 + frate ) ⎠ Usage notes • • If Argument does not contain at least one positive entry (income) and one negative entry (payments).( .⎞ -NPV-rrate-----------------.

Rate) Where: • • • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. constant payments and a constant interest rate. FV is the value that remains after the last payment is made. Typically it includes principal and interest. SortBy> (Argument. If this value is omitted. PV is the present value of a series of future payments. but no other fees or taxes. Argument is a fact or metric representing a list of values containing either payment or income figures. page 19. is assumed to be 0 (zero). NPV (net present value of an investment) Returns the net present value of an investment based on a discount rate and a set of future payments (negative values) and income (positive values). Pmt is the amount paid each period. Syntax Nper <Type> (Rate. Type is a number that indicates when payments are due. FV) Where: • • • • • Rate is the internal rate for each period. PV. SortBy is a parameter that defines the order of calculation. For more information see BreakBy and SortBy parameters. Financial functions 287 . based on periodic.MicroStrategy Functions Reference Plug-In Package Functions 4 Nper (number of investment periods) Returns the number of periods for an investment. Syntax NPV <FactID. Pmt. Inc. © 2011 MicroStrategy. Rate is the discount rate for the length of a period.

Investment begins one period before the date on which the first entry in Values occurs. . • • • Oddfprice (odd-first-period price) Returns the price per $100 face value of a security having an odd (short or long) first period. Frequency) 288 Financial functions © 2011 MicroStrategy. If the first entry in Values occurs at the beginning of a period. The primary differences between this function and the Present Value (PV) function are that PV allows fund flow to occur either at the beginning or at the end of a period. it must be added to the result of the function. Syntax Oddfprice <Basis> (Settlement. YieldRate. CouponRate. PV fund-flow occurrences must be constant across the life of the investment. Maturity. be provided in the correct sequence. and ends with the last entry in that array. payment and income entries must. Redemption. Issue. therefore. FirstCoupon. The order of the entries in Values is assumed to be the order in which funds flow.4 Plug-In Package Functions MicroStrategy Functions Reference Expression NPV = values i ----------------∑ ( 1 + rate )i i=1 n Where: • n is the number of entries in Values Usage notes • • All entries in Values must be equally spaced in time. Inc. and occur at the end of each period.

360 days in each year. FirstCoupon is the first-coupon date. Issue is the issue date. assumes the same values as “0” for American institutions. actual number of days in each year. Financial functions 289 . and 4 where annual payments =1. • Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression There are two expressions for this function: • • Odd Short First Coupon: for securities with a short first period Odd Long First Coupon: for securities with a long first period © 2011 MicroStrategy. 365 days in each year. The default value for Basis is 0. 360 days in each year. Redemption is the redemption value per $100 of face value. semiannual payments =2. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Frequency is the number of coupon payments per year. The valid values are 1. This is the date on which the security expires. and quarterly payments =4. Maturity is the date of maturity. Inc. Assumes actual number of days in each month. Basis is a parameter that indicates the time-count basis used. Assumes actual number of days in each month. Possible values for this parameter are listed in the following table. after issue. on which the security is traded.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • • • • • • Settlement is the settlement date. YieldRate is the annual yield. This is the date. Assumes actual number of days in each month. Used by European agencies. 2. Application Assumes 30 days in each month. CouponRate is the annual interest rate of the coupon.

4 Plug-In Package Functions MicroStrategy Functions Reference Odd Short First Coupon rate --------. . Inc..⎠ ⎝ q --.+ DSC ⎛ N – 1 + DSC⎞ --------⎝ ⎠ E E ⎛ 1 + ----------⎞ ⎛ 1 + ----------⎞ ---yld-------yld----⎝ frequency⎠ ⎝ frequency⎠ ∑ rate --------100 × ---------N rate frequency --------. i=NC) DSC is the Number of days from settlement to next coupon date E is the Number of days in coupon period N is the Number of coupons payable between the first real coupon date and redemption date. it is raised to the next whole number NC is the Number of quasi-coupon periods that fit in odd period.. if this number contains a fraction. it is raised to the next whole number Odd Long First Coupon NC N NC rate --------100 × ---------Ai rate ---------------redemption---------------------------------i --1 ----------------------------------.⎠ ⎝ q --.– 100 × ---------.– 100 × ---------.× ----------frequency -------------= -------------------------.× -----------------------frequency E k=2 ⎛ k – 1 + DSC⎞ --.+ frequency NL i ⎛ N + N + DSC⎞ ⎛ N + DSC⎞ ⎛ k – N + DSC⎞ ------⎝ q --.× frequency ∑ ----NL i DC i ∑ ∑ Where: • • • • • Ai is the number of days from beginning of the ith quasi-coupon period within odd period DCi is the Number of days from date to first quasi-coupon (i=1) or number of days in quasi-coupons (i=2.A ------------------------.. if this number contains a fraction.⎠ E E E k=2 i=1 ⎛ 1 + ----------⎞ ⎛ 1 + ----------⎞ ⎛ 1 + ----------⎞ ---yld-------yld-------yld----⎝ ⎠ ⎝ ⎠ ⎝ ⎠ frequency frequency frequency rate --------100 × ---------.DFC --100 × ---------. if this number contains a fraction it is raised to the next whole number • 290 Financial functions © 2011 MicroStrategy.+ -------------------= ----.+ ------------------..⎠ --⎝ E ⎛ 1 + ----------⎞ ---yld----⎝ frequency⎠ Where: • • • • • A is the number of days from beginning of coupon period to settlement date (accrued days) DSC is the number of days from settlement to next coupon date DFC is the number of days from the beginning of odd first coupon to first coupon date E is the number of days in coupon period N is the number of coupons payable between settlement date and redemption date.× --frequency redemption ----------------------------------------E = ------------------------.

after issue. FirstCoupon is the first coupon date. Price is the price. and 4 where annual payments =1. Frequency is the number of payments per year. Maturity. This is the date on which the security expires. CouponRate.MicroStrategy Functions Reference Plug-In Package Functions 4 • • NLi is the Normal length in days of the full ith quasi-coupon period within odd period Nq is the Number of whole quasi-coupon periods between settlement date and first coupon Usage notes The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. and quarterly payments =4. CouponRate is the annual interest rate of the coupon. The valid values are 1. FirstCoupon. Frequency) Where: • • • • • • • • Settlement is the settlement date. Issue is the issue date. on which the security is traded. Issue. Financial functions 291 . © 2011 MicroStrategy. This is the date. Redemption. Redemption is the redemption value per $100 of face value. Price. Syntax Oddfyield <Basis> (Settlement. Oddfyield (odd-first-period yield) Returns the yield of a security that has an odd (short or long) first period. semiannual payments =2. Inc. 2. Maturity is the maturity date.

actual number of days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Frequency) 292 Financial functions © 2011 MicroStrategy. assumes the same values as “0” for American institutions. Oddlprice (odd-last-period price) Returns the price per $100 face value of a security having an odd (short or long) last period. Used by European agencies. 360 days in each year. Assumes actual number of days in each month. or FirstCoupon is not a valid date CouponRate < 0 Price ≤ 0 The following date-related condition is not satisfied: Maturity > FirstCoupon > Settlement > Issue • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. or FirstCoupon is not an integer. Maturity. . LastInterest. Inc. Maturity. The engine returns an empty cell if: Settlement. Possible values for this parameter are listed in the following table. Issue. The default value for Basis is 0. YieldRate. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Usage notes • • If Settlement. Assumes actual number of days in each month. Redemption. Syntax Oddlprice <Basis> (Settlement. CouponRate. 365 days in each year. Maturity. Application Assumes 30 days in each month. it is truncated. Issue.4 Plug-In Package Functions MicroStrategy Functions Reference • Basis is a parameter that indicates the time-count basis to be used. 360 days in each year. Assumes actual number of days in each month.

Frequency is the number of payments per year. 360 days in each year. assumes the same values as “0” for American institutions.– ⎜ NL i⎟ frequency ⎜ ⎛ ⎛ NC ⎞ ⎞ DSC i⎟ ⎝i = 1 ⎠ ⎜⎜ ⎟ yld ---. YieldRate is the annual yield. after issue. 360 days in each year. 2. Assumes actual number of days in each month. 365 days in each year. Basis is a parameter that indicates the time-count basis to be used. • Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression NC ⎛⎛ ⎞ ⎞ DC i⎟ 100 × rate ⎟ ⎜⎜ --. on which the security is traded. Assumes actual number of days in each month. This is the date on which the security expires. Financial functions 293 . actual number of days in each year. Possible values for this parameter are listed in the following table. The valid values are 1. Used by European agencies. CouponRate is the annual interest rate of the coupon. Redemption is the redemption value per $100 of face value.⎟ × -----------------------------------⎟ --redemption + ⎜ ⎜ NL i⎟ frequency⎟ ⎜⎜ ⎛ NC ⎞ A i ⎟ 100 × rate ⎝⎝i = 1 ⎠ ⎠ ⎜ --. The default value for Basis is 0. This is the date. Application Assumes 30 days in each month. Assumes actual number of days in each month. and 4 where annual payments =1.⎟ × ------------------------------------= -----------------------------------------------------------------------------------------------------------------------------. Inc.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • • • • • Settlement is the settlement date. and quarterly payments =4. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). LastInterest is the last date on which interest is accrued. semiannual payments =2. Maturity is the maturity date.⎟ × -----------------------------------⎟ ---1 + ⎜⎜ NL i ⎟ frequency⎟ ⎜⎜ ⎝⎝i = 1 ⎠ ⎠ ∑ ∑ ∑ Where: • Ai is the Number of accrued days for the ith quasi-coupon period within odd period counting forward from last interest date before redemption © 2011 MicroStrategy.

Price is the price. Inc. and 4 where annual payments =1. Maturity is the maturity date. LastInterest.4 Plug-In Package Functions MicroStrategy Functions Reference • • • • DCi is the Number of days counted in each ith quasi-coupon period as delimited by the length of the actual coupon period NC is the Number of quasi-coupon periods that fit in odd period. The valid values are 1. CouponRate is the interest rate. after issue. Maturity. Redemption is the redemption value per $100 of face value. Frequency is the number of payments per year. Frequency) Where: • • • • • • • Settlement is the settlement date. Price. 294 Financial functions © 2011 MicroStrategy. CouponRate. 2. Usage notes The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. This is the date on which the security expires. This is the date. on which the security is traded. Oddlyield (odd-last-period yield) Returns the yield of a security that has an odd (short or long) last period. LastInterest is the security’s last coupon date. . if this number contains a fraction. and quarterly payments =4. it is raised to the next whole number NLi is the Normal length in days of the ith quasi-coupon period within odd coupon period DSCi is the Number of days from settlement (or beginning of quasi-coupon period) to next quasi coupon within odd period (or to maturity date) for each ith quasi-coupon period. Redemption. Syntax Oddlyield <Basis> (Settlement. semiannual payments =2.

Used by European agencies. quasi-coupon period within odd period counting forward from last interest date before redemption. Assumes actual number of days in each month. DCi is the number of days counted in the ith. Assumes actual number of days in each month. quasi-coupon period within odd coupon period.. Possible values for this parameter are listed in the following table. NLi is the normal length in days of the ith.⎟ × ----------⎟ ⎟ – ⎜ par + ⎜ ⎜ ----. NC is the number of quasi-coupon periods that fit in odd period. if this number contains a fraction.⎟ ---par + ⎜ ⎜ ⎜ NL i⎟ frequency ⎟ NL i ⎟ ⎜⎜ ⎜ ⎝⎝i = 1 ⎠ ⎠ ⎝i = 1 ⎠ ∑ ∑ ∑ ∑ Where: • Ai is the number of accrued days for the ith.× -------------. Assumes actual number of days in each month. or last. The default value for Basis is 0. • • • Usage notes The date arguments should be included within single quotations for the expression to be considered as a valid expression. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression NC ⎛ ⎛⎛ ⎞ ⎞⎞ ⎛ ⎛ ⎛ NC ⎞ ⎞⎞ DC i⎟ A i ⎟ 100 × rate ⎟ ⎟ ⎜ ⎜⎜ ⎜⎜ 100 --rate ⎟ ⎟ ⎜ --.× ---------⎛ ⎛ NC ⎞ ⎞ ⎛ NC ⎞ A i ⎟ 100 × rate ⎟ DSC i⎟ ⎜⎜ ⎜ ----------.⎟ × ---------. Financial functions 295 .⎟ × ---------. Inc.MicroStrategy Functions Reference Plug-In Package Functions 4 • Basis is a parameter that indicates the time-count basis to be used. actual number of days in each year. it is raised to the next whole number. © 2011 MicroStrategy.----------------------------. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). or last. or last. Application Assumes 30 days in each month. 360 days in each year.. quasi-coupon period as delimited by the length of the actual coupon period.⎟ -----. assumes the same values as “0” for American institutions. 365 days in each year.⎟ ⎟ --⎜ redemption + ⎜ ⎜ NL i⎟ frequency⎟ ⎟ ⎜ NL i⎟ frequency ⎟ ⎟ ⎜ ⎜⎜ ⎜⎜ ⎝ ⎝⎝ ⎠ ⎠⎠ ⎝ ⎝⎝ ⎠ ⎠⎠ frequency ---------------i .------------------------------ODDLYIELD = -----------------=-1 ---------------------------i-=-1-----------------. 360 days in each year.

Rate is the interest rate. Nper should be 4 × 12. For example: To calculate monthly payments on a four-year loan at 12% annual interest. PV) Where: • • • • • FV a parameter that indicates the future value of the loan. Per. Syntax Ppmt <Type = 0> (Rate. Type> (Rate. Rate should be 12%. FV) 296 Financial functions © 2011 MicroStrategy. Usage notes • • Values returned by this function include principal and interest. . Nper is the number of payments. reserve payments. Nper should be 4. This is the current value of a set of future payments. Type is parameter that indicates when payment is due. Ppmt (principal payment) Returns the payment on the principal for an investment for one given period. Units must be used consistently when calculating payment. based on constant payments and a constant interest rate. or ancillary fees. Rate should be 12%/12. PV. It is the balance to be attained once all payments are made. PV is the present value of the loan. also referred to as principal. they do not include taxes. Syntax Pmt <FV. Inc.4 Plug-In Package Functions MicroStrategy Functions Reference Pmt (payment) Returns the payment cost on a loan. Nper. Nper. To calculate annual payments on the same loan. • This function can also be used to determine payments on annuities other than loans.

Frequency) Where: • • • • • Settlement is the settlement date. YieldRate. Rate is the interest rate. Per is the period desired. CouponRate is the annual interest rate. CouponRate. Syntax Price <Basis> (Settlement. This is the date. Financial functions 297 . after issue. Redemption is the redemption value per $100 of face value. This is the date on which the security expires. Expression PPMT i = PMT – IPMT i Where: • i is the period desired Price (price per $100 face value) Returns the price. per $100 face value.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • • • • Type is a parameter that indicates when payment is due. PV is the present value of the loan. on a security that pays periodic interest. FV is the future value of the loan. Maturity. on which the security is traded. © 2011 MicroStrategy. Inc. Nper is the number of payments. Redemption. YieldRate is the annual yield. Maturity is the maturity date.

assumes the same values as “0” for American institutions.⎠ ------⎝ ⎝ E k=1 E ⎠ ⎛ 1 + ----------⎞ ⎛ 1 + ----------⎞ ---yld-------yld----⎝ ⎝ frequency⎠ frequency⎠ ∑ Where: • • • • DSC is the number of days from settlement to next coupon date E is the number of days in the coupon period in which the settlement date falls N is the number of coupons payable between the settlement date and the redemption date A is the number of days from the beginning of the coupon period to settlement date Usage notes • • If Settlement.× -⎞ -----------------------⎝ frequency E⎠ ⎛ N – 1 + DSC⎞ ⎛ k – 1 + DSC⎞ --. The valid values are 1. Used by European agencies. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). semiannual payments =2. Application Assumes 30 days in each month. it is truncated. .A PRICE = ------------------------. 360 days in each year.4 Plug-In Package Functions MicroStrategy Functions Reference • Frequency is the number of payments per year. • Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression N rate --------100 × ---------redemption rate frequency -------------------------------. actual number of days in each year.– ⎛ 100 × ---------. Assumes actual number of days in each month. The engine returns an empty cell if: Settlement or Maturity is not a valid date 298 Financial functions © 2011 MicroStrategy. 360 days in each year. or Frequency is not an integer. Assumes actual number of days in each month. and quarterly payments =4 Basis is a parameter that indicates the time-count basis to be used. 2. Inc. Possible values for this parameter are listed in the following table.+ ------------------------. 365 days in each year. The default value for Basis is 0. Assumes actual number of days in each month. Maturity. and 4 where annual payments =1.

This is the date on which the security expires. DiscRate is the discount rate. Redemption) Where: • • • • • Settlement is the settlement date. actual number of days in each year.MicroStrategy Functions Reference Plug-In Package Functions 4 CouponRate < 0 or YieldRate < 0 Redemption ≤ 0 Frequency has a value other than 1. Maturity is the maturity date. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) © 2011 MicroStrategy. DiscRate. Pricedisc (price. on which the security is traded. after issue. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). on a discounted security. Financial functions 299 . or 4 Settlement ≥ Maturity • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. This is the date. The default value for Basis is 0. Inc. discounted) Returns the price. Assumes actual number of days in each month. Assumes actual number of days in each month. 360 days in each year. 2. Syntax Pricedisc <Basis> (Settlement. Maturity. Possible values for this parameter are listed in the following table. Basis is a parameter that indicates the time-count basis to be used. Application Assumes 30 days in each month. Redemption is the redemption value per $100 of face value. per $100 face value. 360 days in each year.

it is truncated. Expression DSM --PRICEDISC = redemption – discount × redemption × --B Where: • • B is the number of days in a year (see Basis) DSM is the number of days from settlement to maturity Usage notes • • If Settlement or Maturity is not an integer. CouponRate. . DiscRate ≤ 0 or Redemption ≤ 0. YieldRate) 300 Financial functions © 2011 MicroStrategy. per $100 of face value. Issue. assumes the same values as “0” for American institutions. on a security that pays interest at maturity. Maturity. The engine returns an empty cell if: Settlement or Maturity is not a valid date. Inc. Syntax Pricemat <Basis> (Settlement. Pricemat (price at maturity) Returns the price. 365 days in each year.4 Plug-In Package Functions MicroStrategy Functions Reference Basis value 3 (actual/365) 4 (30/60) Application Assumes actual number of days in each month. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Settlement ≥ Maturity. Used by European agencies.

This is the date. 365 days in each year.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • • • • • Settlement is the settlement date. YieldRate is the annual yield. Assumes actual number of days in each month. CouponRate is the interest rate on the date of issue.× yld⎞ ⎝ B ⎠ Where: • • • • B is the number of days in a year (see Basis) DSM is the number of days from settlement to maturity DIM is the number of days from issue to maturity A is the number of days from issue to settlement © 2011 MicroStrategy.× rate × 100⎞ . Issue is the issue date. Maturity is the maturity date. Assumes actual number of days in each month.– ⎛ . This is the date on which the security expires. 360 days in each year. Application Assumes 30 days in each month. on which the security is traded. 360 days in each year.⎝ ⎠ B DSM --1 + ⎛ --. Used by European agencies. actual number of days in each year.× rate × 100⎞ ⎝ B ⎠ A PRICEMAT = -----------------------------------------------------------------------. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). The default value for Basis is 0. Possible values for this parameter are listed in the following table. assumes the same values as “0” for American institutions. Assumes actual number of days in each month. Basis is a parameter that indicates the time-count basis to be used. It is expressed as a serial date. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression DIM --100 + ⎛ --. Inc. Financial functions 301 . after issue.

• The Settlement date. FV is the future value of the loan. Expression If rate = 0 pv + pmt × nper + fv = 0 Else pv 1 + rate ) 1 -× ( 1 + rate )nper + pmt × ( 1 + rate × t yp e ) × (---------------------------–-. Maturity. . Pv (present value) Returns the present value of an investment. it is truncated. Pmt is the periodic payment for an annuity. Maturity. the Maturity date.4 Plug-In Package Functions MicroStrategy Functions Reference Usage notes • • If Settlement. Settlement ≥ Maturity. Inc. Nper. and the Issue date should be included within single quotations in the expression for the expression to be considered as a valid expression. or Issue is not an integer. FV) Where: • • • • • Type is a value that indicates when payment is due. or Issue is not a valid date. The engine returns an empty cell if Settlement. Pmt. Syntax Pv <Type> (Rate. Nper is the number of payments. Rate < 0 or Yield < 0.+ fv = 0 rate nper 302 Financial functions © 2011 MicroStrategy. Rate is the interest rate.

Investment.MicroStrategy Functions Reference Plug-In Package Functions 4 Rate (interest rate per period) Returns the interest rate per period on a given annuity. Syntax Received <Basis> (Settlement. Syntax Rate <FV. Type. Payment. Nperiod should be 4 × 12. Guess is an estimate assumed to be close to the result sought. Inc. Nperiod should be 4. Received (amount received at maturity) Returns the amount received at maturity on a fully invested security. includes principal and interest. Nperiod is the total number of payment periods. Payment is the payment made for each period. • Usage notes • For this function. Type indicates when payments are due. Typically. Guess> (Nperiod. Financial functions 303 . Cannot change over the life of the annuity. It is the total amount that a series of future payments is worth today. PV) Where: • • • • • FV is the future value (also called cash balance) expected after the last payment. but no other fees or taxes. Maturity. consistency in the units used is necessary: Assuming monthly payments on a four-year loan at 12% annual interest. Discount) © 2011 MicroStrategy. PV is the present value of the annuity. Assuming annual payments on a four-year loan at 12% annual interest.

actual number of days in each year. Used by European agencies. The engine returns an empty cell if Settlement or Maturity is not a valid date. 2 (actual/360) 3 (actual/365) 4 (30/60) Assumes actual number of days in each month. 360 days in each year. The default value for Basis is 0.4 Plug-In Package Functions MicroStrategy Functions Reference Where: • • • • • Settlement is the settlement date. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). This is the date. Assumes actual number of days in each month. it is truncated. Investment ≤ 0. Maturity is the date of maturity. Application Assumes 30 days in each month. Investment is the amount invested. Basis is a parameter that indicates the time-count basis to be used. This is the date on which the security expires. Discount is the discount rate. Basis value 0 (30/360) 1 (actual/actual) Assumes actual number of days in each month. on which the security is traded. 304 Financial functions © 2011 MicroStrategy. 365 days in each year.⎞ ⎝ B ⎠ Where: • • B is the number of days in a year (see Basis) DIM is the number of days between settlement to maturity Usage notes • • If Settlement or Maturity is not an integer. Expression RECEIVED = --------------------investment ------------DIM 1 – ⎛ discount × ---------. after issue. Inc. assumes the same values as “0” for American institutions. Possible values for this parameter are listed in the following table. . 360 days in each year.

Syntax Sln(Cost. Syntax Syd < > (Cost. This is the simplest method of depreciation and represents an equal amount charged for each period during the useful life of the asset after allowing for a salvage value. Sln (straight-line depreciation) Returns the straight-line depreciation of an asset over a given period. Salvage. is the residual value at the end of the estimated life span. Inc. Life. Maturity ≤ Settlement. Life) Where: • • • Cost is the initial cost of the asset. Syd (sum of year’s digits depreciation) Returns the sum of year’s digits depreciation of an asset over a specified period. Salvage. This method of accelerated depreciation results in higher depreciation early in the life of an asset. Life. Period) Where: • Cost is the initial cost.MicroStrategy Functions Reference Plug-In Package Functions 4 Discount ≤ 0. 305 . also called the useful life of an asset. Financial functions © 2011 MicroStrategy. Salvage. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. It calculates the depreciation for each year on an inverted scale in proportion to the total of all the digits for the asset’s useful life. also called the salvaged value of an asset. is the number of periods over which the asset is being depreciated.

Expression Tbilleq = ( 360 × rate ) – rate ( DSM ) -----------------------------------360 Where: • DSM is the number of days between settlement and maturity on 360-day basis. Discount is the discount rate.4 Plug-In Package Functions MicroStrategy Functions Reference • • • Salvage. is the residual value at the end of the estimated life span. Discount) Where: • • • Settlement is the settlement date. is the number of periods over which the asset is being depreciated. Maturity is the maturity date. Life. Syntax Tbilleq(Settlement. . also called the salvaged value of an asset. 306 Financial functions © 2011 MicroStrategy. Period is the depreciation period. This must have the same number of units as Life. Usage notes The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. also called the useful life of an asset. Maturity. This is the date on which the treasury bill expires. This is the date on which the security is traded. Expression ( cos t – salvage ) × ( life – per + 1 ) × 2 SYD = --------------------------------------------------------------------------------------------------------------------( life ) ( life + 1 ) Tbilleq (T-bill equity) Returns the bond-equivalent yield of a Treasury bill. Inc.

© 2011 MicroStrategy. Maturity is the maturity date. Maturity is more than one year after Settlement. This excludes any maturity date that is more than one calendar year past Settlement. Discount ≤ 0. The engine returns an empty cell if: Either Settlement or Maturity is not a valid date. Syntax Tbillprice(Settlement. This is the date on which the treasury bill expires. Financial functions 307 . This is the date on which the treasury bill is purchased. Discount) Where: • • • Settlement is the settlement date. Maturity. Discount is the discount rate. it is truncated. Settlement > Maturity. Usage notes • • If Settlement or Maturity is not an integer. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Inc.MicroStrategy Functions Reference Plug-In Package Functions 4 Tbillprice (T-bill price) Returns the price of a treasury bill per $100 of face value. Expression TBILLPRICE = 100 × ⎛ 1 – discount × DSM⎞ ------------------------------------------------⎠ ⎝ 360 Where: • DSM is the number of days from settlement to maturity.

• The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Maturity. This excludes any maturity date that is more than one calendar year past Settlement. This is the date on which the treasury bill expires. Price) Where: • • • Settlement is the settlement date.× ---------par DSM Where: • DSM is the number of days from settlement to maturity. Price ≤ 0. The engine returns an empty cell if: Either Settlement or Maturity is not a valid date. This is the date on which the treasury bill is purchased. Price is the price per $100 of face value Expression 100 – par 360 TBILLYIELD = --------------------------. . Maturity is the maturity date. Maturity is more than one year after Settlement. it is truncated. Settlement > Maturity. Usage notes • • If Settlement or Maturity is not an integer. 308 Financial functions © 2011 MicroStrategy. Syntax Tbillyield < > (Settlement. Inc.4 Plug-In Package Functions MicroStrategy Functions Reference Tbillyield (T-bill yield) Returns the yield of a treasury bill.

309 © 2011 MicroStrategy. Price is the price per $100 of face value. including partial periods. Cost is the initial cost of the asset. Salvage. Life is the number of periods over which depreciation is calculated. Period) Where: • • • • • Factor is the rate at which balance declines. Life. Syntax Vdb <Factor> (Cost. Price. This is the date on which the security is purchased. Syntax Yield <Basis> (Settlement. Usage notes All values must be positive. Maturity is the maturity date. CouponRate is the annual interest rate. CouponRate. Inc. Period is the first period for which depreciation is calculated. Frequency) Where: • • • • Settlement is the settlement date. This must use the same number of units as Life. Financial functions . This is the date on which the security expires. Yield Returns the yield on a security that pays periodic interest.MicroStrategy Functions Reference Plug-In Package Functions 4 Vdb (variable declining balance) Returns the depreciation of an asset over a specified period. Salvage is the value at the end of the depreciation period. Redemption. Maturity.

The valid values are 1. semiannual payments =2. Basis is a parameter that indicates the time-count basis to be used. See also Appendix 4. Other possible values for this parameter are as follows. or Frequency is not an integer. and is based on the calculation for the PRICE function. 360 days in each year.4 Plug-In Package Functions MicroStrategy Functions Reference • • Redemption is the redemption value per $100 of face value. Frequency is the number of payments per year. Price (price per $100 face value). Assumes actual number of days in each month. assumes the same values as “0” for American institutions. rate ⎛ redemption + ---rate---⎞ – ⎛ par + ⎛ A × ----------------------------------. 2. and 4 where annual payments =1. this function is calculated through iteration.⎞ ⎞ ---------------------. Used by European agencies. The default value for Basis is 0. actual number of days in each year. . it is truncated. Assumes actual number of days in each month. Assumes actual number of days in each month. 360 days in each year. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). and quarterly payments =4. 365 days in each year.--------------------⎝ 100 frequency⎠ ⎝ 100 ⎝ E frequency ⎠ ⎠ frequency × E YIELD = --------------------------------------------------------------------------------------------------------------------------------------------------------------------------. • Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Expression • If there is one period (or less) until Redemption. Inc. Usage notes • • If Settlement. The engine returns an empty cell if 310 Financial functions © 2011 MicroStrategy. Maturity.⎞ ---------100 ⎝ E frequency ⎠ Where: A is the number of days from the beginning of the period to Settlement DSR is the number of days from Settlement to Redemption E is the number of days in a period • If there is more than one period until Redemption.× --------------------------------------------DSR rate par + ⎛ A × ----------------------------------. this function is calculated as follows. Application Assumes 30 days in each month.

which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). Syntax Yielddisc <Basis> (Settlement. actual number of days in each year. Possible values for this parameter are listed in the following table. Redemption is the redemption value per $100 of face value. Settlement > Maturity. This is the date on which the security expires. Application Assumes 30 days in each month. Price. Redemption) Where: • • • • • Settlement is the settlement date. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. or 4. The default value for Basis is 0. Maturity. Price is the price per $100 of face value. after issue. on which the security is traded. 2. Maturity is the maturity date. Assumes actual number of days in each month. Financial functions 311 . This is the date. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) © 2011 MicroStrategy. Yielddisc (yield on a discounted security) Returns the annual yield on a discounted security. Price ≤ 0 or Redemption ≤ 0. Frequency is a number other than 1. Inc. Basis is a parameter that indicates the time-count basis to be used. Assumes actual number of days in each month. 360 days in each year. 360 days in each year.MicroStrategy Functions Reference Plug-In Package Functions 4 Either Settlement or Maturity is not a valid date.

Issue. Used by European agencies. Inc. Maturity ≤ Settlement. 365 days in each year. Rate is the annual coupon rate. after issue. Price) Where: • • • • • Settlement is the settlement date. Yieldmat (yield at maturity) Returns the annual yield on a security that pays interest at maturity. Issue is the issue date. The engine returns an empty cell if: Either Settlement or Maturity is not a valid date. This is the date. Usage notes • • If Settlement or Maturity is not an integer. Price is the price per $100 of face value. Maturity. Syntax Yieldmat < Basis> (Settlement. • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. it is truncated. on which the security is traded. 312 Financial functions © 2011 MicroStrategy. This is the date on which the security expires. assumes the same values as “0” for American institutions. Price ≤ 0 or Redemption ≤ 0. Maturity is the date of maturity.4 Plug-In Package Functions MicroStrategy Functions Reference Basis value 3 (actual/365) 4 (30/60) Application Assumes actual number of days in each month. Rate. .

Application Assumes 30 days in each month. The engine returns an empty cell if: Rate < 0 Price ≤ 0 Settlement ≥ Maturity • The Settlement date and the Maturity date should be included within single quotations in the expression for the expression to be considered as a valid expression. Assumes actual number of days in each month. actual number of days in each year. Inc. Basis value 0 (30/360) 1 (actual/actual) 2 (actual/360) 3 (actual/365) 4 (30/60) Usage notes • • If Settlement. Mathematical functions 313 . Possible values for this parameter are listed in the following table. and trigonometric functions. which is typically used by American agencies and assumes 30-day months and 360-day years (30/360). or Issue is not an integer. This category includes exponential. © 2011 MicroStrategy. 360 days in each year. Those not supported by the database are automatically computed by the Analytical Engine. Mathematical functions The category of Mathematical functions contains more complex math functions than the simple operators found in the Basic functions chapter. 365 days in each year. The default value for Basis is 0. Assumes actual number of days in each month. These functions are calculated by either the MicroStrategy Analytical Engine or the database. logarithmic. it is truncated.MicroStrategy Functions Reference Plug-In Package Functions 4 • Basis is a parameter that indicates the time-count basis to be used. Used by European agencies. Maturity. assumes the same values as “0” for American institutions. Assumes actual number of days in each month. 360 days in each year.

314 Mathematical functions © 2011 MicroStrategy.35.25. For another example of using the Abs function. The resulting value list is 756. . To convert radians to degrees.4 Plug-In Package Functions MicroStrategy Functions Reference Abs (absolute value) Returns the absolute value of a given number. This is a single-value function. 145. 560. -980. 980. Syntax Abs(Argument) Where: Argument is a metric representing a list of real numbers. see Example 1: Transformed fact. +145.25. -315. Acos (arc cosine) Returns the arc cosine of a given number as an angle. -75. the function operates as follows: Abs(Deposit_Withdrawal) where Deposit_Withdrawal is the following list of values: +756. Inc. +560. multiply by 180/π. The absolute value of a number is the number without a sign.35.78. Example This simple example show the results of executing the Abs function on a list of values. The values are the values of the cosine for the angles sought. +1250. page 7. 75. This is a single-value function. This angle is calculated in radians and falls between 0 and π. 315.78. Syntax Acos(Argument) Where: Argument is a metric representing a list of real numbers. 1250. Assuming you have a metric that represents deposit and withdrawal amounts. This value must be between -1 and 1.

This is a single-value function. Inc. Acosh is a single-value function. © 2011 MicroStrategy. hyperbolic) Acosh returns the inverse hyperbolic cosine of a number. For more information on the hyperbolic sine function. see Cosh (cosine. hyperbolic) Returns the inverse hyperbolic sine of a number. Asinh (arc sine. hyperbolic). Syntax Acosh(Argument) Where: Argument is a metric representing a list of real numbers with values greater than or equal to 1. Syntax Asin(Argument) Where: Argument is a metric representing a list of real numbers. page 331.MicroStrategy Functions Reference Plug-In Package Functions 4 Acosh (arc cosine. Mathematical functions 315 . multiply by 180/π. see Sinh (sine. This function is the inverse of Cosh. This angle is calculated in radians and falls between -π/2 and π/2. This is a single-value function. The values are the values of the sine of the angles sought. Asinh is the inverse of the Sinh function. hyperbolic). These values must be between -1 and 1. For more information on the hyperbolic cosine function. To convert radians to degrees. Asin (arc sine) Returns the arc sine of a given number as an angle. page 319.

Atan (arc tangent) Returns the arc tangent of a given number as an angle. y_num is the y-coordinate of the point. Atan2 (arc tangent 2) Returns the arc tangent of the specified x. Syntax Atan(Number) Where: Number is the tangent of the angle you want. y_num) Where: • • x_num is the x-coordinate of the point.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax Asinh(Argument) Where: Argument is a metric representing a list of real numbers. multiply by 180/π. To convert the result from radians to degrees. 316 Mathematical functions © 2011 MicroStrategy. The arc tangent is the angle from the x-axis to a line containing the origin (0.and y-coordinates. The angle is given in radians between -π and π. . 0) and a point with coordinates (x_num. This is a single-value function. Inc. Syntax Atan2(x_num. multiply by 180/π. To convert from radians to degrees. y_num). This angle is specified in radians and falls between π/2 and-π/2.

Ceiling (ceiling value) Returns the closest integer greater than or equal to a given number. © 2011 MicroStrategy. to avoid returns at the cent level. This is a single-value function. Example Use ceiling calculations in situations where results are expressed as specified units of measurement. hyperbolic). Inc. see Tanh (tangent. Ceiling could be used on a product price to round up the figures to the nearest dollar. Syntax Ceiling(Argument) Where: Argument is a metric representing a list of real numbers. For example. For more information on the hyperbolic tangent function.MicroStrategy Functions Reference Plug-In Package Functions 4 Atanh (arc tangent. This is a single-value function. Syntax Atanh(Number) Where: Number is any real number between 1 and -1. hyperbolic) Returns the inverse hyperbolic tangent of a given number. Atanh is the inverse of the Tanh function. Ceiling is often used as a rounding function. page 333. Mathematical functions 317 .

00 -948.--⎝ k⎠ k! k! ( n – k )! Where: n! P k . and how the results compare to the use of the Floor function.33 -947.00 -947.67 463. Argument values 947. ..4 Plug-In Package Functions MicroStrategy Functions Reference This simple example illustrates how the Ceiling function acts on positive and negative numbers. in which the order of the items selected does affect the return.00 Ceiling 948.00 464.n = --------( n – k )! Usage notes • In combination calculations. 318 Mathematical functions © 2011 MicroStrategy.67 -463.33 Floor 947. Number = n. Number_Chosen) Where: • • Number is the number of items in a set.00 -463. Permutation is a statistical function.00 463. the internal order of the items selected does not affect the return. This differs from the case of a permutation. Number_Chosen = k. Inc.00 -464.k. ⎛ n⎞ = P-. Expression In the expression that follows.00 Combine (combination) The number of possible combinations for a given number of items selected as a group from a set. Syntax Combine(Number.n ----.= ---n! --. Number_Chosen is the number of items to be included in each combination.

there are three sides: the side opposite to A.MicroStrategy Functions Reference Plug-In Package Functions 4 • • If an argument is not an integer. Syntax Cos(Argument) Where: Argument is a metric representing a list of real numbers. for which the value of the cosine is sought. Mathematical functions 319 . multiply by 180/π. it is truncated. and the side opposite to the right angle (hypotenuse). multiply by π/180. To convert the result from radians to degrees. To convert degrees to radians. hyperbolic) Returns the hyperbolic cosine of a number. The values are the angles. This function returns an error value if: Either argument is nonnumeric n< 0 k<0 n≤k Cos (cosine) This function takes the value of an angle in radians and returns the cosine of the angle as a number between -1 and 1. This is a single-value function. This is a single-value function. Cosh (cosine. In a given right triangle containing an angle A. Inc. the side adjacent to A. Syntax Cosh(Argument) © 2011 MicroStrategy. in radians. The cosine of A is the ratio of the lengths of the adjacent side over the hypotenuse.

4

Plug-In Package Functions

MicroStrategy Functions Reference

Where: Argument is a metric representing a list of real numbers. The values are the angles, in radians, for which the value of the hyperbolic cosine is sought. To convert radians to degrees, multiply by 180/π. Expression e +e COSH ( z ) = --------------------2
2 –2

Degrees (conversion to)
Returns the value of an angle converted from radians to degrees. This is a single-value function. Syntax Degrees(Argument) Where: Argument is a metric representing a list of values to be converted from radians to degrees. Example These simple examples illustrate how the Degrees function converts an angle entered in radians into degrees.
Function/Result Degrees(2.27) = 130 Degrees(π/2) = 90 Calculation
2.27 180 ------------- × ---------- = 130° 1 π

π ⁄ 2 180 ---------- × ---------- = 90° 1 π

320 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Exp (exponent)
Returns the value e raised to the power of the number given. e is a mathematical constant equal to 2.71828182845904. Exp is the inverse of Ln, the natural logarithm of a number. This is a single-value function. For more information on the natural logarithm function, see Ln (logarithm, natural), page 324. Syntax Exp(Argument) Where: Argument is a metric representing a list of real numbers. The values are the power to which e is raised Example This simple example illustrates the results of using the Exp function. The variable e=2.71828182845904
Function/Result Exp (2) = 7.38905609893062 Calculation X = e2 ; 2.71828182845904 × 2.71828182845904 = 7.38905609893062

Factorial (factorial)
Returns the factorial of a positive integer. The factorial of an integer N is equal to the product of all integers from 1 to N. For example, the factorial of 5 is 1 × 2 × 3 × 4 × 5, or 120. This is a single-value function. Syntax Factorial(Argument)

© 2011 MicroStrategy, Inc.

Mathematical functions

321

4

Plug-In Package Functions

MicroStrategy Functions Reference

Where: Argument is a metric representing a list of positive integers. Usage notes If a number is not an integer or is negative, the function returns a NULL. Example These simple examples illustrate the results of using the Factorial function.
Function/Result Factorial(5) = 120 Factorial(Argument) = 6, 5040, 362880 where Argument contains the values 3,7,9 Calculation 5 × 4 × 3 × 2 × 1=120 1 × 2 × 3 = 6; 1 × 2 × 3 × 4 × 5 × 6 × 7 = 5040; 1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 × 9 = 362880

Floor (floor value)
Returns the closest integer less than or equal to a given number. Floor is often used as a rounding function. This is a single-value function. Syntax Floor(Argument) Where: Argument is a metric representing a list of real numbers. Example These simple examples illustrate how the Floor function acts on positive and negative numbers, and how the results compare to the use of the Ceiling function.
Argument Values 947.67 463.33 Floor 947.00 463.00 Ceiling 948.00 464.00

322 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Argument Values -947.67 -463.33

Floor -948.00 -464.00

Ceiling -947.00 -463.00

Int (integer)
Returns the integer part of a number rounded down to the nearest integer. This is a single-value function. Syntax Int(Argument) Where: Argument is a metric representing a list of real numbers. Usage notes • • The expression [Argument - INT(Argument)] can be used to return the decimal part of a non-integer. Results from Int and Trunc differ only when the values are less than 0.

Example These simple examples illustrate how the Int function acts on positive and negative numbers, and how the results differ from the Trunc function when the numbers are negative.
Argument Values 947.67 463.33 -947.67 -463.33 Int 947.00 463.00 -948.00 -464.00 Trunc 947.00 463.00 -947.00 -463.00

© 2011 MicroStrategy, Inc.

Mathematical functions

323

4

Plug-In Package Functions

MicroStrategy Functions Reference

Ln (logarithm, natural)
Returns the natural logarithm of a given number. This is a single-value function. Ln is the inverse of the Exp function. For more information on the Exponent function, see Exp (exponent), page 321. Syntax Ln(Argument) Where: Argument is a metric representing a list of positive real numbers. Example This simple example illustrates the results of the Ln function. The variable e=2.71828182845904.
Function/Result Ln (20) = 2.99573227355399 Calculation 20 = ex where x is the natural logarithm; 20= e2.99573227355399

Log (logarithm)
Returns the logarithm of a given number in a specified base. This is a single-value function. Syntax Log(Argument, Base) Where: • • Argument is a metric representing a list of positive real numbers. Base is the base of the logarithm.

324 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Example This simple example illustrates the results of the Log function.
Function/Result Log(9, 3) = 2 Log(4, 4) = 1 Log (7776, 6) = 5 Calculation 9 = 3x where x is the base-3 logarithm; 9 = 32 4 = 4x where x is the base-4 logarithm; 4 = 41 7776 = 6x where x is the base-6 logarithm; 7776 = 65

Log10 (logarithm, base 10)
Returns the base-10 logarithm of a given number. This is a single-value function. Syntax Log10(Argument) Where: Argument is a metric representing a list of positive real numbers. Example This simple example illustrates the results of the Log10 function.
Function/Result Log10(10000) = 4 Calculation 10000 = 10x where x is the base-10 logarithm; 10000 = 104

Mod (modulus)
Returns the remainder of a number when divided by a another number. The result has the same sign as the divisor. This is a single-value function. Syntax Mod (Argument, Divisor)

© 2011 MicroStrategy, Inc.

Mathematical functions

325

4

Plug-In Package Functions

MicroStrategy Functions Reference

Where: • • Argument is a metric representing a list of real numbers. Divisor is the number used to divide the value(s) of Argument.

Usage notes • • The function returns a NULL if Divisor = 0. Use the Quotient function to return only the integral part of the result.

Example These simple examples illustrate the results of using the Mod function.
Function/Result Mod(5, 2) = 1 Mod(5, -2) = -1 Mod(-5, 2) = 1 Mod(140, 2) = 0 Mod(83, 9) = 2 Mod(-5, -2) = -1 Calculation 5/2 = 2 remainder 1 5/-2 = 2 remainder 1 and takes the sign of the divisor -5/2 = 2 remainder 1 and takes the sign of the divisor 140/2 = 70 remainder 0 83/9 = 9 remainder 2 -5/-2 = 2 remainder 1 and takes the sign of the divisor

Power
Returns the value of an input number raised to a given power. This is a single-value function. Syntax Power(Argument, Power) Where: • • Argument is a metric representing a list of base numbers. All real numbers are valid. Power is the exponent to which Argument is raised.

326 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Usage notes If Argument is a negative number and Power is an even number, the result is positive; however, if Argument is negative and Power is an odd number, the result is negative. Example These simple examples illustrate the results of using the Power function.
Function/Result Power(5, 2) = 25 Power(-5, 2) = 25 Power(-5, 3) = -125 Power(4, 3) = 64 Calculation 5 × 5 = 25 -5 × -5 = 25 -5 × -5 × -5 = -125 4 × 4 × 4 = 64

Power(20,4) = 160000 20 × 20 × 20 × 20 = 160000

Quotient
Returns the integer result of dividing two numbers. This function discards the remainder. This is a single-value function. Syntax Quotient(numerator, denominator) Where: • • Numerator is a metric representing a list of real numbers to be used as the dividend. Denominator is a metric representing a list of real numbers to be used as the divisor.

Usage notes Use the Mod function (Mod (modulus), page 325) to retrieve only the remainder.

© 2011 MicroStrategy, Inc.

Mathematical functions

327

4

Plug-In Package Functions

MicroStrategy Functions Reference

Example These simple examples illustrate the results of using the Quotient function.
Function/Result Quotient(5, 2) = 2 Quotient(83, 9) = 9 Calculation 5/2 = 2 remainder 1 83/9 = 9 remainder 2

Radians (conversion to)
Returns the value of an angle converted from degrees to radians. This is a single-value function. Syntax Radians(Argument) Where: Argument is a metric representing a list of values to convert from degrees to radians. Example This simple example illustrates how the Radians function converts an angle entered in degrees into radians.
Function/Result Radians(130) = 2.27 Calculation
130 ------------------- × π = 2.27 1 180

Randbetween (random number between two values)
Returns a random number that falls between two specified values. A different number is returned each time the function is run. Syntax Randbetween(Bottom, Top)

328 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Where: • Bottom is a real number or metric representing a list of real numbers that are the lowest value(s) the function can return; the bottom of the range. Top is a real number or metric representing a list of real numbers which are the highest value(s) the function can return; the top of the range.

Round (round to nearest integer)
Returns the input values rounded to the nearest integer. This is a single-value function. Syntax Round(Argument) Where: Argument is a metric representing a list of real numbers. Example These simple examples illustrate the result of using the Round function, and compare them to the Int function results for the same values.
Argument Values 947.67 463.33 -947.67 -463.33 Round 948.00 463.00 -948.00 -463.00 Int 947.00 463.00 -948.00 -464.00

Round2 (round to specified precision)
Returns the input values rounded to a specified number of digits. This is a single-value function.

© 2011 MicroStrategy, Inc.

Mathematical functions

329

4

Plug-In Package Functions

MicroStrategy Functions Reference

Syntax Round2(Argument, Precision) Where: • • Argument is a metric representing a list of real numbers Precision is an integer value specifying the placement of the digits to which the Argument value(s) are rounded. If Precision = 0, then the values are rounded to the nearest integer. This has the same results as using the Round function. If Precision is greater than 0, then the values are rounded to the decimal place indicated. If Precision is less than 0, then the values are rounded to the specified digits to the left of the decimal and starting to the left of the integer in the ones place. Example This simple example illustrates how the Precision value affects the results of the Round2 function.
Argument values 947.67 811.00 463.33 Round2(argument, 0) 948.00 811.00 463.00 Round2(argument, 1) 947.70 811.00 463.30 Round2(argument, -1) 950.00 810.00 460.00

Sin (sine)
This function takes the value of an angle in radians and returns the sine of the angle as a number between -1 and 1. In a given right triangle containing an angle A, there are three sides: the side opposite to A, the side adjacent to A, and the side opposite to the right angle (hypotenuse). The sine of A is the ratio of the lengths of the opposite side over the hypotenuse. To convert degrees to radians, multiply by π/180. This is a single-value function.

330 Mathematical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference Plug-In Package Functions 4 Syntax Sin(Argument) Where: Argument is a metric representing a list of values. Syntax Sinh(Argument) Where: Argument is a metric representing a list of values. Mathematical functions 331 . Multiplying the argument by π/180 converts an angle from degrees to radians. Multiplying the argument by π/180 converts an angle from degrees to radians. Sinh (sine. The values are angles. Syntax Sqrt(Argument) © 2011 MicroStrategy. for which the hyperbolic sine is sought. in radians. This is a single-value function. in radians. The values are angles. for which the sine is sought. The value of the hyperbolic sine is used to approximate a cumulative probability distribution. Expression SINH ( z ) = e – e -------------------2 2 –2 Sqrt (square root) Returns the square root of a given positive number. hyperbolic) Returns the hyperbolic sine of a given angle. Inc. This is a single-value function.

4 Plug-In Package Functions MicroStrategy Functions Reference Where: Argument is a metric representing a list of positive real numbers. To convert degrees to radians. there are three sides: the side opposite to A. Inc. This is a single-value function. 332 Mathematical functions © 2011 MicroStrategy. Syntax Tan(Argument) Where: Argument is a metric representing a list of real numbers. In a given right triangle containing an angle A. Usage notes A NULL is returned if an argument value is less than 0. the side adjacent to A. The tangent of A is the ratio of the lengths of the opposite side over the adjacent side. Example This simple example illustrates the results of using the Sqrt function. multiply by π/180. . and the side opposite to the right angle (hypotenuse). Sqrt(25) = 5 Sqrt(169) = 13 Tan (tangent) This function takes the value of an angle in radians and returns the tangent of the angle.

The function removes the fractional part of a real number so that only the integer part remains. Syntax Tanh(Argument) Where: Argument is a metric representing a list of real numbers. This is a single-value function. This is a single-value function. hyperbolic) Returns the value of the hyperbolic tangent of a given number. Mathematical functions 333 . Inc. Expression ---.( z ) -----TANH ( z ) = SINH--COSH ( z ) Trunc (truncate) Returns the integer component of a given number. © 2011 MicroStrategy.MicroStrategy Functions Reference Plug-In Package Functions 4 Tanh (tangent. The fractional part is removed without rounding the number up or down. Usage notes Results from Trunc and Int differ only when the values are less than 0. Syntax Trunc(Argument) Where: Argument is a metric representing a list of real numbers.

Inc. and how it differs from the Int function. x is a value in a fact table.00 Trunc 947. Argument Values 947.00 -948.00 -464.00 463. Syntax AvgDev <FactID> (Argument) Where: • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. 334 Statistical functions © 2011 MicroStrategy. average deviation is a measure of the variability in a data set. AvgDev (average deviation) Returns the average of the absolute deviations of a set of data points from the mean.00 Statistical functions The statistical functions include a wide range of functions designed to provide you with the tools to perform statistical analysis on your data.33 -947. Argument is a fact or metric representing a list of numbers.00 463.33 Int 947.00 -463.67 -463. .67 463. Similar to standard deviation. Expression In this expression.4 Plug-In Package Functions MicroStrategy Functions Reference Example This simple example illustrates how the Trunc function acts on positive and negative numbers.00 -947.

how much of a day people spend watching television). Syntax BetaDistribution < Lower Bound. © 2011 MicroStrategy.β ) ( b – a ) Where: • a≤x≤b a = lower bound • α . beta) Where: • x is the value between Lower Bound and Upper Bound at which the function is evaluated. alpha.β ≥ 0 α = lower bound β = upper bound • α B ( α .– -----(. Statistical functions 335 . Upper Bound > (x.a --α+β–1 B ( α .β ) = ∫ t – 1 ( 1 – τ ) 0 1 β–1 dt This function is used to study percentage variations for an item across population samples (for example.x ) ----.MicroStrategy Functions Reference Plug-In Package Functions 4 1 n n ∑ i=1 xi – x Where: • x is the average of all xi BetaDistribution Returns the cumulative Beta distribution of the variables alpha and beta. where the probability density function is given by α–1 β–1 f ( x ) = -( x---)----–-----. Inc.

This function is used in cases in which: • • • • There is a fixed number of tests Each test can only result in either success or failure (binary) Tests are independent of all other tests The probability of success is constant. Inc. n is the number of tests. BinomialDistribution Returns either the binomial probability or the cumulative binomial probability of variables n and p. Lower Bound = Upper Bound. Usage notes The following are invalid conditions: • • • • x.4 Plug-In Package Functions MicroStrategy Functions Reference • alpha and beta are distribution parameters. alpha = α beta = β • • Lower Bound is an optional lower bound of the interval of x. x < Lower Bound or x > Upper Bound. for example. alpha ≤ 0 or beta ≤ 0. alpha. to calculate the probability that two out of the next three babies will be male Syntax BinomialDistribution <Cumulative> (x. p) Where: • • • x is the number of successes. p is the number indicating the probability of a success in each trial. . 336 Statistical functions © 2011 MicroStrategy. n. Upper Bound is an optional upper bound of the interval of x. or beta is nonnumeric.

it computes the Cumulative Binomial probability. Expression For the binomial probability: n N n–N b ( x . Statistical functions 337 . If Cumulative=1.n . If Cumulative=0. ⎝ x⎠ © 2011 MicroStrategy. Inc. it computes the Binomial probability.MicroStrategy Functions Reference Plug-In Package Functions 4 • Cumulative is a logical value that determines the form of the function.p ) = ⎛ ⎞ p ( 1 – p ) ⎝ x⎠ Where: n • ⎛ ⎞ is Combine(n. x).

p < 0 or p > 1. where the pdf is given by x – exp ⎛ – x⎞ ⎝ 2⎠ f ( x ) = ----------------------n . x< 0. Inc. x > n. .n . It determines the validity of a hypothesis.p ) Usage notes • • If x or n is not an integer.4 Plug-In Package Functions MicroStrategy Functions Reference The cumulative binomial distribution is: B ( x . Syntax ChiSquareDistribution(x.⎛ n⎞ 2 2 ϒ⎝ 2⎠ Where: • • n is the degree of freedom ϒ is the gamma function n–1 2 The chi-squared distribution is associated with a chi-squared test.p ) = ∑ y=0 N b ( y . such as the prediction that the next generation of a certain plant hybrid will exhibit a specific combination of colors. it is truncated. df) 338 Statistical functions © 2011 MicroStrategy. A chi-squared test is used to compare observed values against expected ones.n . ChiSquareDistribution Returns the cumulated chi-squared distribution of the degrees of freedom. The following are invalid conditions: One of the arguments is nonnumeric.

for example. Statistical functions 339 . it is truncated The following are invalid conditions: Either argument is nonnumeric x < 0 df < 1 ChiSquareTest (chi-square test for goodness of fit) Returns the result of a test for goodness of fit. to what extent an experiment verifies hypothesized results. Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem Definition P-value = Pr[Reject H0| H0 is correct] P-value is a probability of making a Type 2 error. ChiSquareTest returns the p-value for the hypothesis test in the following form: • • H0: Argument1 and argument2 come from the same distribution. © 2011 MicroStrategy. This function returns the chi-squared distribution for a statistical value and its associated degrees of freedom to determine. Inc. Usage notes • • If df is not an integer. df is an integer greater than or equal to one (>=1) indicating the number of degrees of freedom for the distribution.MicroStrategy Functions Reference Plug-In Package Functions 4 Where: • • x is a non-negative decimal value at which the distribution is evaluated. H1: Argument1 and argument2 come from different distributions.

which are compared against the observed values provided by Argument1. within a given level of confidence. Confidence (confidence interval) Returns the confidence interval for a population mean. For example. Syntax Confidence(Alpha. Usage notes • • This function returns the probability for a chi-squared (x2) statistic and its associated degrees of freedom (df). Inc. Stdev. This function results in an invalid value if Argument1 and Argument2 have a different number of data points. if you order a product through the mail. which are to be tested against expected values. Meaning. each observed value must have an expected value to be compared to. Size) Where: • • • Alpha is the level of significance at which confidence is computed. 340 Statistical functions © 2011 MicroStrategy. . Stdev is the standard deviation of the population for the given data range.4 Plug-In Package Functions MicroStrategy Functions Reference Syntax ChiSquareTest(Argument1. Argument2 is a fact or metric representing a list of expected values. you can determine. Argument2) Where: • • Argument1 is a fact or metric representing a list of values that contains observed values. the earliest and latest date of expected arrival. The confidence interval is a range of values on either side of a mean. Size is a positive integer indicating the size of the sample.

96 The confidence interval is σ x ± 1. page 72.96 ⎛ -.05.⎞ ⎝ n⎠ Usage notes • • If size is not an integer. If alpha = 0. Syntax Correlation <FactID> (Argument1. Inc. This function is the same as the Pearson (Pearson product moment correlation coefficient). alpha < 0 or alpha >1 stdev < 0 size < 1 Example For an example of the Confidence function in use. page 371. Correlation indicates association between two quantitative variables and the degree to which the values are related or associated. see Confidence Level example. The following are invalid conditions: One of the arguments is nonnumeric. Statistical functions 341 . it is truncated. Argument2) © 2011 MicroStrategy.MicroStrategy Functions Reference Plug-In Package Functions 4 Expression The confidence level is expressed as [100(1-alpha)%]. Correlation Returns the correlation coefficient between two data sets. then: • • • Confidence = 95% The area equivalent to 95% of the population = 1.

logical values. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. however. cells with the value zero are included. . If Argument1 and Argument2 have a different number of data points. Correlation returns an error. • • • Covariance Covariance is used to examine the relationship between two data sets. the correlation is positive.1. Argument1 and Argument2 are lists of values represented by facts or metrics. Inc. Complete correlation between two variables is expressed by either + 1 or -1. Correlation returns an error. A covariance greater or less than zero indicate a relationship. while a value of zero indicates no relationship. If an array or reference argument contains text. If either Argument1 or Argument2 is empty. or empty cells. Syntax Covariance <FactID> (Argument1. 342 Statistical functions © 2011 MicroStrategy. or if the standard deviation of their values equals zero. Usage notes • • The correlation coefficient is measured on a scale that varies from + 1 through 0 to . those values are ignored. when one decreases as the other increases. When one variable increases as the other increases. the correlation is negative. Argument2) Where: • • Argument1 and Argument2 are facts or metrics representing lists of values. Complete absence of correlation is represented by 0. the covariance could be used to examine whether an increase in income is related to higher education levels.4 Plug-In Package Functions MicroStrategy Functions Reference Where: • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. For instance. So only a value between -1 and 1 is returned.

Y ) = ---1 n–1 Where: • • n ∑ i=1 ( xi – μx ) ( yi – μy ) μx = average value of x μ y = average value of y Usage notes The following are invalid conditions: • • Argument1 and Argument2 do not contain the same number of data points. Alpha is the criterion value. to determine the maximum number of defective items that can come off an assembly line run before rejecting an entire lot. Statistical functions 343 . Syntax CritBinomial(Trials. CritBinomial (criterion binomial) Returns the smallest value for which the cumulative binomial distribution is less than or equal to a criterion value. © 2011 MicroStrategy. Probability_s. Probability_s is the probability of a success on each trial. Alpha) Where: • • • Trials is the number of Bernoulli trials. for example. Inc. Either value set is empty.MicroStrategy Functions Reference Plug-In Package Functions 4 Expression In the expression that follows: • • Argument1 = X Argument2 = Y Cov ( X. Use this function for quality control.

lambda is the value of the parameter. it returns the probability density.4 Plug-In Package Functions MicroStrategy Functions Reference Usage notes The following are invalid conditions: Where: • • • • • Any argument is nonnumeric. For example. If Cumulative=1. Probability_s is < 0 or probability_s > 1. This function is used to model the time between events. it can be used to estimate the probability that an automatic-teller machine will take no more than one minute to deliver requested cash. Trials is not an integer. Syntax ExponentialDistribution <Cumulative> (x. Inc. alpha < 0 or alpha > 1. • • x is the value of the function. Trials < 0. lambda) Where: • Cumulative is a logical value that determines the form of the function: If Cumulative=0 (default). . ExponentialDistribution Returns either the probability density or the cumulative distribution of a random variable. it returns the cumulative distribution. Expression • For probability density: f ( x .λ ) = 1 – e – λx 344 Statistical functions © 2011 MicroStrategy.λ ) = λe • – λx For cumulative distribution: F ( x .

Expression 1+x z' = 1 ⎛ ----⎞ -ln ⎝ --. lambda ≤ 0. The Fisher transformation yields a normally-distributed function. FDistribution (f-probability distribution) Returns the cumulative distribution (F-probability) of a random variable.⎠ 1–x 2 Usage notes The following are invalid conditions: • • x is nonnumeric. as opposed to a skewed one. x<0.MicroStrategy Functions Reference Plug-In Package Functions 4 Usage notes The following are invalid conditions: • • • Either x or lambda is nonnumeric. This function is used to determine the difference. x ≤ -1 or x ≥ 1. For example. Syntax Fisher (x) Where: x is the number for which the transformation is sought. Statistical functions 345 . between two data sets. Inc. in degrees of diversity. test scores administered to males and females entering high school can be examined using this function to © 2011 MicroStrategy. It is used to perform hypothesis-testing on the correlation coefficient. Fisher (fisher transformation) Returns the Fisher transformation at x.

This is most commonly used to predict future metric values based on historical data. 346 Statistical functions © 2011 MicroStrategy. you want to predict what your Revenue will be for the coming year. Expression P = (F < X) Where: F is a random variable that has a F distribution. df1 represents the degrees of freedom of numerator values. .4 Plug-In Package Functions MicroStrategy Functions Reference determine whether the variability in females is different from that found in males. Usage notes • • If df1 or df2 is not an integer. df1 < 1 df2 < 1 Forecast The Forecast function uses data recorded for certain time periods to calculate and display the expected value of data for an unknown time period. For example. Inc. The following are invalid conditions: An argument is non-numeric. it is truncated. df2) Where: • • • x is the value at which the function is evaluated. based on revenue data for three years. Syntax FDistribution(x. x<0. df1. df2 represents the degrees of freedom of denominator values.

Syntax Forecast <FactID>(FutureTime.. page 348.. KnownTimeIntervals1. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. you can use Forecast to enter values and time intervals manually. it is more common to use ForecastV to use metrics and attributes to enter this information. KnownData1. © 2011 MicroStrategy.. as described in ForecastV (forecast. page 352. However. For example. see Growth.. • • • Example As described in the syntax requirements... KnownTimeIntervals1.. as described in ForecastV (forecast. you would enter the value 2009 for FutureTime (this assumes your year data is defined with IDs that match the year).. it is more common to use ForecastV which can use an attribute to enter a list of time intervals.. as described in ForecastV (forecast. if your profits are increasing by $10. vector input).KnownDataN are separate scalar values that provide the data to use to predict a future value for... KnownData1.KnownTimeIntervalN are separate scalar values that provide the time intervals for which data is known.. Therefore. While you can use Forecast to enter these values manually. While you can use Forecast to enter these values manually. Statistical functions 347 .. For example. Inc. vector input).. it is best suited to predict values that increase or decrease in a linear trend. it is more common to use ForecastV which can use a metric to enter a list of values. page 348.KnownDataN. to predict values for the year 2009.. For a function that predicts values in a similar way for data that is increasing or decreasing exponentially.000 each year.. page 348. this is a scenario that is well suited for a prediction based on a linear equation. This is commonly defined as an integer. vector input).MicroStrategy Functions Reference Plug-In Package Functions 4 This function uses a linear equation to predict future values.KnownTimeIntervalN) Where: • FutureTime is the point in time for which to predict the data.

This list of values is the known data to use to predict a future value for. page 353. to predict values for the year 2009. Syntax ForecastV <FactID>(FutureTime. Since this function allows you to enter a list of time intervals. This is commonly defined as an integer. This list of values provide the time intervals for which data is known. including dates that have known data. However. vector input) The ForecastV function uses data recorded for certain time periods to calculate and display the expected value of data for an unknown time period. . KnownData. Inc. unknown values. This is most commonly used to predict future metric values based on historical data. For example. • • 348 Statistical functions © 2011 MicroStrategy. This function uses a linear equation to predict future values. Therefore. this is a scenario that is well suited for a prediction based on a linear equation. KnownData is an object representing a list of values. you would enter the value 2009 for FutureTime (this assumes your year data is defined with IDs that match the year). and so on. this type of function is meant for predicting future. KnownTimeIntervals) Where: • FutureTime is the point in time for which to predict the data.4 Plug-In Package Functions MicroStrategy Functions Reference ForecastV (forecast. if your profits are increasing by $10. vector input). You can use ForecastV to predict values for any point in time. For example. it can account for missing time intervals more accurately than the TrendV function (see TrendV (trend. vector input). it is best suited to predict values that are increasing or decreasing in a linear trend. For a function that predicts values in a similar way for data that is increasing or decreasing exponentially. For example. you can predict what your Revenue will be for the coming year. see GrowthV (growth. KnownTimeIntervals is commonly used for attributes that represent intervals of time such as year. quarter. page 380). month. For an example. see the examples described below. profit.000 each year. KnownData is commonly used for metrics that represent data such as revenue. KnownTimeIntervals is an object representing a list of values. and so on. based on revenue data for three years.

When the 2008 Forecast is displayed on the report. it can account for time intervals that you have no data for. Inc. the x is a placeholder for a metric. Also. Example The ForecastV function is useful to display predicted future values of a metric as a subtotal of the metric on a report. For example. Statistical functions 349 . in the MicroStrategy Tutorial project a new subtotal named 2008 Forecast can be created with the following definition: ForecastV(2008. as shown below: Since the ForecastV function allows you to enter a list of time intervals.MicroStrategy Functions Reference Plug-In Package Functions 4 • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. consider the same report in a scenario in which there was no data available for the year 2006. the placeholder inputs that metric’s values. Year) Since this is in a subtotal. it displays the predicted value for 2008 Revenue. For example. When a subtotal is applied to a metric on a report. © 2011 MicroStrategy. After making the new custom subtotal available for the Revenue metric (see the Advanced Reporting Guide for steps to make custom subtotals available for metrics) a report with the attribute Year and the metric Revenue is created. 2008 is used for the period in time to predict metric data for because the Year attribute uses ID values that match the year. The ForecastV function can still use the two available years to predict the revenue for 2008. x.

For example. given the test scores from public and private schools.4 Plug-In Package Functions MicroStrategy Functions Reference FTest Returns the P-value of an F-test on the variances of two sets of data. . It tests that the variances in the two sets are not significantly different. Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem Definition P-value = Pr[Reject H0| H0 is correct] P-value is basically a probability of making a Type 2 error. FTest returns the p-value for the hypothesis test in the following form: • H0: σ 22 (Argument1) / σ 22 (Argument2) = Ratio ϑ ϑ • H1: Ratio (Type = -1) 2 σ 22 (Argument1) / σ 2 (Argument2) < ϑ ϑ Ratio (Type = 0: two-sided test) Ratio (Type = 1) 2 σ 22 (Argument1) / σ 2 (Argument2) ≠ ϑ ϑ 2 σ 22 (Argument1) / σ 2 (Argument2) > ϑ ϑ Ratio (Type = 2: one-sided test) Syntax 2 σ 22 (Argument1) / σ 2 (Argument2) ≠ ϑ ϑ FTest <Hypothesis type. Argument2) 350 Statistical functions © 2011 MicroStrategy. Inc. Ratio> (Argument1. this function enables you to determine whether diversity levels between the two school types are significantly different.

Statistical functions 351 . Beta is a distribution parameter. Expression α–1 β --1 --x f ( x . Beta) Where: • • • • x is the value at which you want to evaluate the distribution. Inc.α ) = x---e .α . Cumulative is a logical value that determines the form of the function: If Cumulative=0 (default). Syntax GammaDistribution <Cumulative> (x.MicroStrategy Functions Reference Plug-In Package Functions 4 Usage notes The following are invalid conditions: • • Argument1 and Argument2 contain a different number of data points. The variance of either data set is zero. This function is used in queueing analysis to study variables that may have a skewed distribution. If Cumulative=1. Alpha.----Γ(α) If alpha = 1. it returns the probability density. this function returns the exponential distribution as: λ = 1 β α – 1 –N © 2011 MicroStrategy. it returns the cumulative distribution. GammaDistribution Returns either the cumulative Gamma distribution or the probability density of a random variable.β ) = ----e α β Γ(α) N - The expression for the standard gamma distribution is: f ( x . Alpha is a distribution parameter.

For example. SortBy> (KnownData1. .. you can predict what your Revenue will be for the coming year. page 379. it is best suited to predict values that increase or decrease in an exponential trend. x < 0. based on revenue data for three years.. The following are invalid conditions: Either alpha or beta is nonnumeric.. Inc. this function is also known as the Erlang distribution.. page 346 or Trend. vector input). While you can use Growth to enter these values manually.KnownDataN. it is more common to use GrowthV which can use a metric to enter a list of values. this is a scenario that is well suited for a prediction based on an exponential equation.KnownDataN are separate scalar values that provide the data to use to predict a future value for... FutureTimeOffset) Where: • KnownData1. For a function that predicts values in a similar way for data that is increasing or decreasing with a linear trend. as described in GrowthV (growth. see Forecast. 352 Statistical functions © 2011 MicroStrategy. if your profits are increasing by 4 percent each year.. Syntax Growth <FactID. Either alpha ≤ 0 or beta ≤ 0. page 353. This is most commonly used to predict future metric values based on historical data. This function uses an exponential equation to predict future values.. Therefore.4 Plug-In Package Functions MicroStrategy Functions Reference Usage notes • • When alpha > 0. Growth The Growth function uses data recorded for certain time intervals to calculate and display the expected value of data for an unknown time period. For example.

Syntax GrowthV <FactID. you would enter the value of 2 for FutureTimeOffset. this type of function is meant for predicting future. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. vector input) The GrowthV function uses data recorded for certain time intervals to calculate and display the expected value of data for an unknown time period. page 353. vector input). Therefore. For example. For a function that predicts values in a similar way for data that is increasing or decreasing with a linear trend. For example. SortBy>(KnownData. This is most commonly used to predict future metric values based on historical data. Inc. However. vector input). vector input). GrowthV (growth. you want to predict what your Revenue will be for the coming year. FutureTimeOffset) © 2011 MicroStrategy. see BreakBy and SortBy parameters. page 380. including dates that have known data. it is more common to use GrowthV to use metrics and attributes to enter this information. based on revenue data for three years. this is a scenario that is well suited for a prediction based on a linear equation. you can use Growth to enter values manually. This function uses an exponential equation to predict future values. as described in GrowthV (growth. to predict values for the year 2009 when the last available data you have is for 2007. • • Example As described in the syntax requirements. page 348 or TrendV (trend. Statistical functions 353 . This is commonly defined as an integer. However. For example. unknown values.MicroStrategy Functions Reference Plug-In Package Functions 4 • FutureTimeOffset is the point in time after the final time interval available for which to predict the data. page 19. it is best suited to predict values that increase or decrease in an exponential trend. SortBy is a parameter that defines the order of calculation. For more information. if your profits are increasing by 15 percent each year. You can use GrowthV to predict values for any point in time. see ForecastV (forecast.

When a subtotal is applied to a metric on a report. 1) Since this is in a subtotal. For example. For example. 1 is used as the offset in the time interval to predict data for the first time interval that is not known. Also. This list of values is the known data to use to predict a future value for. • • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. to predict values for the year 2009 when the last available data you have is for 2007. this allows you to use a single expression to use on reports with varying time intervals such as year. month. see the examples described below. quarter. FutureTimeOffset is the point in time after the final time interval available for which to predict the data. the placeholder inputs that metric’s values. profit. . see BreakBy and SortBy parameters. If your data meets these requirements. • Example The GrowthV function is useful to display predicted future values of a metric as a subtotal of the metric on a report. Inc. 354 Statistical functions © 2011 MicroStrategy. The GrowthV function assumes that data is available for sequential time intervals with no missing data. For more information. SortBy is a parameter that defines the order of calculation.4 Plug-In Package Functions MicroStrategy Functions Reference Where: • KnownData is an object representing a list of values. KnownData is commonly used for metrics that represent data such as revenue. This is commonly defined as an integer. and so on. and so on. in the MicroStrategy Tutorial project a new subtotal named 2008 Growth can be created with the following definition: GrowthV(x. you would enter the value of 2 for FutureTimeOffset. the x is a placeholder for a metric. page 19. For an example.

vector input). Inc. and as such should be used with data that reflects such a trend. Statistical functions 355 . This difference is due to GrowthV predicting values based on an exponential trend. vector input). as shown below: This predicted value is different than the values predicted by the functions ForecastV and TrendV.MicroStrategy Functions Reference Plug-In Package Functions 4 After making the new custom subtotal available for the Revenue metric (see the Advanced Reporting Guide for steps to make custom subtotals available for metrics) a report with the attribute Year and the metric Revenue is created. they may be used when a given group is to be tested before and after an experiment. it displays the predicted value for 2008 Revenue. Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem Definition P-value = Pr[Reject H0| H0 is correct] P-value is a probability of making a Type 2 error. These two functions are used to determine the level of variance between the means of paired samples. HeteroscedasticTTest and HomoscedasticTTest Return the P-value for the hypothesis test.μ (Argument2) = offset © 2011 MicroStrategy. page 380. page 348 and TrendV (trend. For example. When the 2008 Growth is displayed on the report. HeteroscedasticTTest or HomoscedasticTTest returns the p-value for the hypothesis test in the following form: • For H0: μ (Argument1) . as described in ForecastV (forecast. assuming both samples have different arguments.

offset> (Argument1.4 Plug-In Package Functions MicroStrategy Functions Reference • For H1: μ (Argument1) .μ (Argument2) < offset (Type = -1) μ (Argument1) . page 66. see Hypothesis Testing example.μ (Argument2) ≠ offset (Type = 0: two-sided test) μ (Argument1) . Example For an example using both Heteroscedastic T-test and Homoscedastic T-test. Offset or Hypothesis type is nonnumeric. .μ (Argument2) ≠ offset (Type = 2: one-sided test) Syntax HeteroscedasticTTest or HomoscedasticTTest <Hypothesis type. Argument2) Usage notes • Heteroscedastic t-tests are based on the assumption that variances 2 between two sample data ranges are unequal [ σ 2 (Argument1) ≠ ϑ 2 σ 2 (Argument2)]. Offset is any value other than 1 or 2. and Hypothesis type = 1 (paired).μ (Argument2) > offset (Type = 1) μ (Argument1) . Inc. • • 356 Statistical functions © 2011 MicroStrategy. ϑ Homoscedastic t-tests are based on the assumption that variances 2 between two sample data ranges are equal [ σ 2 (Argument1) = ϑ 2 σ 2 (Argument2)]. ϑ The following are invalid conditions: Argument1 and Argument2 have a different number of data points.

given the sample size.M . n. x < 0 or x is greater than the lesser of n or M. M < 0 or M > N.N ) = -------------⎛ N⎞ ⎝ n⎠ Usage notes • • All arguments are truncated to integers. where each observation is either a success or a failure.n . n is the size of the sample. © 2011 MicroStrategy.N + M). N < 0. and where each subset of a given size is chosen with equal likelihood. M. x is less than the larger of 0 or (n . The following are invalid conditions: Any argument is nonnumeric. Inc. N) Where: • • • • x is the number of successes in the sample. Syntax HypergeometricDistribution(x. N is the population size. Statistical functions 357 .MicroStrategy Functions Reference Plug-In Package Functions 4 HypergeometricDistribution Returns the probability of a given number of sample successes. and population size. M is the number of successes in the population. n < 0 or n > N. Expression ⎛ M⎞ ⎛ N – M⎞ ⎝ x⎠ ⎝ n – x⎠ P ( X = x ) = h ( x . Use this function for problems with a finite population. population successes.

Argument2) Where: • • • Argument1 is the dependent set of observation data represented by a fact or metric. Argument1 = Y. This function is used to determine the value of a dependent variable Y when the value of its associated independent variable X is 0. Argument2 is the independent set of observation data represented by a fact or metric.4 Plug-In Package Functions MicroStrategy Functions Reference Intercept Returns the point at which a line intersects the y-axis in a graph. Argument2 = X. Expression In the expressions that follow. page 86. . see Forecasting example. The point of intersection is based on a best-fit regression line plotted through available values of X and Y. Syntax Intercept <FactID> (Argument1. Inc. 358 Statistical functions © 2011 MicroStrategy. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. The equation for the intercept of the regression line is a = Y – bX The slope of the regression line is calculated as: n ∑ xy – ( ∑ x ) ( ∑ y ) b = ----------------------------2 2 n∑ x – (∑ x) Usage notes This function results in an invalid value if Argument1 and Argument2 contain a different number of data points. Example For an example using the Intercept function.

or beta is nonnumeric. Usage notes The following are invalid conditions: • • • • • x. Alpha and Beta are distribution parameters. This function is used to compare observed results against expected ones to assess the validity of a hypothesis. Lower Bound is an optional lower bound of the interval of x. x. Lower Bound = Upper Bound. For information on the Beta distribution function. © 2011 MicroStrategy. alpha. Alpha. Beta) Where: • • • • • Probability is a probability associated with the beta distribution. x is the value between Lower Bound and Upper Bound at which the function is evaluated. Inc. Probability ≤ 0 or probability > 1. page 335. InverseChiDistribution (inverse of chi-squared distribution) Returns the inverse of the given cumulative Chi-squared distribution greater than or equal to a pre-specified value. Upper Bound> (Probability. see BetaDistribution.MicroStrategy Functions Reference Plug-In Package Functions 4 InverseBetaDistribution (inverse of the beta distribution) Returns the inverse of the cumulative Beta distribution. alpha ≤ 0 or beta ≤ 0. Syntax InverseBetaDistribution < Lower Bound. Statistical functions 359 . Upper Bound is an optional upper bound of the interval of x. x < Lower Bound or x > Upper Bound.

page 338. it is truncated The following are invalid conditions: Either argument is nonnumeric x < 0 or x >1 df< 1 InverseFisher (inverse of the Fisher transformation) Returns the inverse of the Fisher transformation. df) Where: • • x is the probability associated with a given chi-squared distribution. 2y Expression e ---1 . Inc. For information on the Fisher transformation function. Syntax InverseChiDistribution(x. page 345. df is the number of degrees of freedom for the distribution. Usage notes • • If df is not an integer. This function is used to analyze correlations between data arrays. Syntax InverseFisher(x) Where: • x is the value for which the inverse of the Fisher transformation is performed. . see Fisher (fisher transformation).4 Plug-In Package Functions MicroStrategy Functions Reference For information on the Chi-squared function.–x = ----2y e +1 360 Statistical functions © 2011 MicroStrategy. see ChiSquareDistribution.

df2 represents the degrees of freedom of denominator values. For example.05 level of significance. InverseFDistribution (inverse of F-probability distribution) Returns the inverse of the F probability distribution. In such cases. Statistical functions 361 . the significance level can be used as the probability argument for FINV to return the critical value of F. df2) Where: • • • x is the probability associated with the F cumulative distribution. see FDistribution (f-probability distribution).MicroStrategy Functions Reference Plug-In Package Functions 4 Usage notes This function results in an invalid value if x is nonnumeric. page 345. df1 < 1 df2 < 1 © 2011 MicroStrategy. The following are invalid conditions: An argument is nonnumeric. and F-critical values at the 0. For information on the F probability distribution function. Usage notes • • If df1 or df2 is not an integer. F-probability. df1. x< 0 or x > 1. This function is used to return critical values from the F distribution. df1 represents the degrees of freedom of numerator values. Inc. the output of an analysis-of-variation (anova) calculation may include data for F-statistic. it is truncated. Syntax InverseFDistribution (x.

Either alpha ≤ 0 or beta ≤ 0. Stdev) Where: • x is the probability associated with the lognormal distribution. Ln(x) is normally distributed using mean and standard deviation as parameters. 362 Statistical functions . For more information on the cumulative Gamma distribution function. Syntax InverseGammaDistribution (x. Syntax InverseLognormalDistribution(x. InverseLognormalDistribution (inverse of lognormal distribution) Returns the inverse of the lognormal cumulative distribution. Inc. For more information on the lognormal cumulative distribution function. see GammaDistribution. page 351. Mean. x < 0 or x > 1. © 2011 MicroStrategy. Beta) Where: • • • x is the value at which you want to evaluate the distribution. Usage notes The following are invalid conditions: • • • Either alpha or beta is nonnumeric. page 366. Alpha is a distribution parameter.4 Plug-In Package Functions MicroStrategy Functions Reference InverseGammaDistribution (inverse of gamma distribution) Returns the inverse of the cumulative Gamma distribution. see LognormalDistribution. Alpha. Beta is a distribution parameter.

Statistical functions 363 . LOGINV ( p . Expression In the expression that follows. Stdev) Where: • • • x is the probability corresponding to a given normal distribution. x > 1. mean = μ.σ ) = e Usage notes The following are invalid conditions: • • • • One of the arguments is nonnumeric. see NormalDistribution (normal cumulative distribution). Stdev is the standard deviation of the distribution. page 369. Inc. stdev = σ. this function returns the standard normal distribution © 2011 MicroStrategy. x < 0. Mean is the arithmetic mean of the distribution. stdev < 0. For more information on the normal cumulative distribution function. Stdev is the standard deviation of ln(x). Usage notes • If mean = 0 and stdev = 1. [ μ + σ × ( NORMSINV ( p ) ) ] InverseNormDistribution (inverse of normal cumulative distribution) Returns the inverse of the normal cumulative distribution for a given mean and standard deviation. Syntax InverseNormDistribution(x.MicroStrategy Functions Reference Plug-In Package Functions 4 • • Mean is the mean of ln(x).μ . Mean.

4

Plug-In Package Functions

MicroStrategy Functions Reference

The following are invalid conditions: One of the arguments is nonnumeric. stdev ≤ 0.

InverseNormSDistribution (inverse of standard normal cumulative distribution)
Returns the inverse, or critical value, of the cumulative standard normal distribution. This function computes the critical value so that the cumulative distribution is greater than or equal to a pre-specified value. For more information on the cumulative standard normal distribution function, see StandardNormalDistribution (standard normal cumulative distribution), page 377. Syntax InverseNormSDistribution(x) Where: x is the probability corresponding to the normal distribution. Usage notes The following are invalid conditions: • • x is nonnumeric. x < 0 or x > 1.

InverseTDistribution (inverse of T-distribution)
Returns the inverse of the cumulative T-distribution. For more information on the cumulative T-distribution function, see TDistribution, page 378.

364 Statistical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Syntax InverseTDistribution(Probability, df) Where: • • Probability is the probability associated with the t-distribution. df is a value that indicates the degrees of freedom of the distribution.

Expression p( t < X) Where: X is a random value that follows the t-distribution. Usage notes • • If df is not an integer, it is truncated. The following are invalid conditions: Either probability or df is nonnumeric. Probability < 0 or probability > 1. df < 1.

Kurtosis
Returns the kurtosis, or relative flatness, of the values in a given set of data. Kurtosis characterizes the relative “peakedness” or “flatness” of a distribution when compared to a normal distribution. A positive kurtosis indicates a relatively peaked distribution, while a negative one signifies a relatively flat distribution. Syntax Kurtosis <FactID> (Argument) Where: • Argument is a set of values represented by a fact or metric.

© 2011 MicroStrategy, Inc.

Statistical functions

365

4

Plug-In Package Functions

MicroStrategy Functions Reference

FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

Expression In the expression that follows, s is the sample standard deviation.
2 xi – x 4 ⎫ ⎧ 3 - -1 ) ------n - ------------------ ∑ ⎛ ---- ⎞ ⎬ – ---(--–-------n-n ---)-----( - + 1 ⎨ ⎝ s ⎠ ⎩ (n – 1)(n – 2 )(n – 3) ⎭ (n – 2 )(n – 3)

LognormalDistribution
Returns the lognormal cumulative distribution of a random variable X, where the logarithm of X is normally distributed. LognormalDistribution takes mean and standard deviation as parameters. This function is used to analyze data that has been logarithmically transformed. Syntax LognormalDistribution(x, Mean, Stdev) Where: • • • x is the value at which the function is evaluated. Mean is the mean of ln(x). Stdev is the standard deviation of ln(x).

Expression In the expression that follows, mean = μ, stdev = σ. ln (------ x ) – μ LOGNORMDIST ( x ,μ ,σ ) = NORMSDIST ⎛ ------- ⎞ ⎝ ⎠ σ Usage notes The following are invalid conditions: • • • One of the arguments is nonnumeric. x ≤ 0. stdev≤ 0.

366 Statistical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

MeanTTest (mean T-test)
Calculates the P-value of a T-test that tests the mean of the data against a particular value. This function is used to determine the closeness in the value of the means of two samples coming from the same population.
Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem

Definition P-value = Pr[Reject H0| H0 is correct] P-value is basically a probability of making a Type 2 error. MeanTTest returns the p-value for the hypothesis test in the following form: • For H0:

μ (Argument) = μ 0
• For H1:

μ (Argument) < μ 0 (Type = -1) μ (Argument) ≠ μ 0 (Type = 0: two-sided test) μ (Argument) > μ 0 (Type = 1) μ (Argument) ≠ μ 0 (Type = 2: one-sided test)
Syntax MeanTTest <Hypothesis type> (Argument, Hypothesis mean) Where: • • • Argument is the value or list of values, represented by a fact or metric, that contains sample data. Hypothesis mean specifies the number of distribution tails (1 denotes a one-tailed distribution; 2 denotes a two-tailed distribution). Hypothesis type denotes the type of t-test to be performed.

© 2011 MicroStrategy, Inc.

Statistical functions

367

4

Plug-In Package Functions

MicroStrategy Functions Reference

Usage notes • • If Hypothesis mean or Hypothesis type is not an integer, it is truncated. The following are invalid conditions: Either Hypothesis mean or Hypothesis type is nonnumeric. Hypothesis mean is a value other than 1 or 2. Hypothesis type ≠ 0.

NegativeBinomialDistribution
This function determines the probability that there will be N failures before the Nth success with a constant probability of success P. 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: • • • f is the number of failures. s is the threshold number of successes. p is the probability of a success.

Expression In the expression that follows, f = x, s = r. x + r – 1⎞ N nb ( x ;r ,p ) = ⎛ ⎝ r – 1 ⎠ p' ( 1 – p ) Usage notes • If either f or s is not an integer, it is truncated.

368 Statistical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

The following are invalid conditions: One of the arguments is nonnumeric. p < 0 or p > 1. f + (s - 1) ≤ 0.

NormalDistribution (normal cumulative distribution)
Calculates the normal distribution of the mean and standard deviation of a set of values. Returns either the cumulative distribution or the probability density. This function is widely applied in statistics, including in the area of hypothesis testing. Syntax NormalDistribution <Cumulative> (x, Mean, Stdev) Where: • • • • x is the value for which the distribution is sought. Mean is the arithmetic mean of the distribution. stdev is the standard deviation of the distribution. Cumulative is a logical value that determines the form of the function: If Cumulative=0 (default), it returns the cumulative distribution. If Cumulative=1 it returns the probability density. Expression In the expression that follows, z = x, mean = μ, stdev = σ. 1 f ( x ;μ ,σ ) = ----- e ---2 2πσ Usage notes The following are invalid conditions: • Either mean or stdev is nonnumeric.
(---μ ) x – -– ⎛ ------⎞ ⎝ 2σ 1 ⎠
1

© 2011 MicroStrategy, Inc.

Statistical functions

369

4

Plug-In Package Functions

MicroStrategy Functions Reference

• •

Stdev ≤ 0. If mean = 0 and stdev = 1, the function returns the standard normal distribution.

PairedTTest (paired T-test, two-sample for means)
Calculates the P-value of a T-test on the means of two paired sets of data. Two-sample analyses are used to determine the level of variance between the means of paired samples.
Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem

Definition P-value = Pr[Reject H0| H0 is correct] P-value is basically a probability of making a Type 2 PairedTTest returns the P-value for the hypothesis test in the following form: • H0:

μ ([Argument1 – Argument2]) = Offset
• H1:

μ ([Argument1– Argument2]) <
Offset [Type = –1]

μ ([Argument1– Argument2]) ≠
Offset [Type = 0: Two-sided test]

μ ([Argument1– Argument2]) >
Offset [Type = 1]

μ ([Argument1 – Argument2]) ≠
Offset [Type = 2: One-sided test]

370 Statistical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

Syntax PairedTTest <Type, Offset> (Argument1, Argument2) Where: • • • Argument1 is a fact or metric representing a set of sample values. Argument2 is a fact or metric representing a set of sample values. Type is a logical value that determines the form of the function.

Usage notes One of the results of this sample is pooled variance, an accumulated measure of spread data about the mean. Pooled variance is calculated as: n1 S + n2 S2 S = ---1-------- ----n1 + n2 – 2
2 2 2

Pearson (Pearson product moment correlation coefficient)
This function returns the Pearson product moment correlation coefficient of a set of values. The coefficient is a dimensionless index that ranges from -1.0 to 1.0 (inclusive). It is used to determine the extent of a relationship between two data sets. Syntax Pearson <FactID> (Argument1, Argument2) Where: • • • Argument1 is a list of independent values represented by a fact or metric. Argument2 is a list of dependent values represented by a fact or metric. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

© 2011 MicroStrategy, Inc.

Statistical functions

371

4

Plug-In Package Functions

MicroStrategy Functions Reference

Expression In the expression that follows, Argument1 = X, Argument2 = Y. r = -----n-----------ΣY )--------- ( ΣXY ) – -ΣX ) (--- ---------- ( --- --[ nΣX – ( ΣX ) ] [ nΣY – ( ΣY ) ] Usage notes The following are invalid conditions: • • Either Argument1 or Argument2 contains one or more null values. Argument1 and Argument2 contain a different number of data points.
2 2 2 2

Permut (permutation)
Returns the number of possible permutations for a given number of items selected as a group from a set. In permutation calculations, the internal order of the items selected affects the return. This differs from calculations of combinations, in which the order of the items selected does not affect the return. Combination (Combine) is categorized as a mathematical function. Syntax Permut(n, m) Where: • • n is the number of items in a set. m is the number of items selected for permutation.

Expression In the expression that follows, Number = n; Number_Chosen = k. n! P k, n = --------( n – k )! Usage notes • • If an argument is not an integer, it is truncated. This function returns an error value if: Either argument is nonnumeric.

372 Statistical functions

© 2011 MicroStrategy, Inc.

MicroStrategy Functions Reference

Plug-In Package Functions

4

n< 0. k < 0. n ≤ k.

PoissonDistribution
Returns the Poisson distribution of a random variable. This function predicts the number of identified events to take place over a specified period. For example, it can predict the number of cars to arrive at a toll plaza in a one-minute interval. Syntax PoissonDistribution <Cumulative> (x, lambda) Where: • • • x is the number of events in the prediction. lambda is the expected numeric value of the expression. Cumulative is a logical value that determines the form of the probability distribution returned: If Cumulative = 0 (default), the function returns the probability that the number of random events will be between 0 and x. If Cumulative = 1, the function returns the probability that the number of random events will be exactly x. Expression • For type = 1: e --POISSON = ---- λ x! For type = 0: x CUMPOISSON = Usage notes • •
–λ x


k=0

e--- --- λ k!

–λ x

If x is not an integer, it is truncated. The following are invalid conditions:

© 2011 MicroStrategy, Inc.

Statistical functions

373

4

Plug-In Package Functions

MicroStrategy Functions Reference

x or mean is nonnumeric. x ≤ 0. mean ≤ 0.

RSquare (square of pearson product moment correlation coefficient)
Returns the square of the Pearson product moment correlation coefficient for a set of values. RSquare gives the proportion of the variance in y that is attributable to the variance in x. Syntax RSquare <FactID> (Argument1, Argument2) Where: • • • Argument1 is a list of data-point coordinates. Argument2 is a list of data point coordinates. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

Usage notes The following are invalid conditions: • • Argument1 and Argument2 have a different number of values. Either Argument1 or Argument2 contains one or more NULL values.

Skew
Returns the skewness of a data set in a given list of values. Skewness is the degree of asymmetry of a distribution in relation to its mean. A positive skewness indicates asymmetry biased towards positive values, while a negative skewness indicates the opposite.

374 Statistical functions

© 2011 MicroStrategy, Inc.

Argument2) Where: • • • Argument1 is a fact or metric containing numerically dependent (y) data points. Statistical functions 375 . FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. Argument2 is a fact or metric containing numerically independent (x) data points.MicroStrategy Functions Reference Plug-In Package Functions 4 Syntax Skew <FactID> (Argument) Where: • • Argument is a fact or metric representing a list of values. Expression xi – x 3 n ------------. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. the slope is the vertical distance divided by the horizontal distance between any two points on the line. Inc. Syntax Slope <FactID> (Argument1. In a regression line passing through a set of data points in data sets Argument1 and Argument2.∑ ⎛ ---. Expression n ∑ xy – ( ∑ x ) ( ∑ y ) b = ----------------------------2 n∑ x – (∑ x) © 2011 MicroStrategy. This ratio is also known as the rate of change along the line.⎞ --------(n – 1 )(n – 2) ⎝ s ⎠ Slope (of a linear regression) Returns the slope of a linear regression line.

Argument1 and Argument2 have a different number of values. see Forecasting example. .4 Plug-In Package Functions MicroStrategy Functions Reference Usage notes The following are invalid conditions: • • Either Argument1 or Argument2 contains NULL values. Syntax Standardize(x. Stdev) Where: • • • x is the value you want to normalize. Example For an example using the Slope function. Expression Z = X--μ . Mean is the arithmetic mean of the distribution.–-σ Usage notes The following is an invalid condition: • standard_dev ≤ 0 376 Statistical functions © 2011 MicroStrategy. page 86. Mean. Standardize Returns a normalized value from a distribution characterized by a mean and standard deviation. Inc. Stdev is the standard deviation of the distribution.

[X]) Where: • • Y is an array or range of dependent data points.MicroStrategy Functions Reference Plug-In Package Functions 4 StandardNormalDistribution (standard normal cumulative distribution) Returns the cumulative distribution of a standard normal variable. –z 2 2 SteYX (standard error of estimates) Returns the standard error of estimates in linear regression with two variables (for example. Syntax SteYX([Y].1 ) = -----e 2π Usage notes This function results in an invalid value if Argument is nonnumeric. The mean is 0 and the standard deviation is 1. Statistical functions 377 .0 . Inc. Expression 1 f ( z . This function can be used in lieu of a table of standard normal curve areas. X = Slope + Intercept x Y). © 2011 MicroStrategy. Syntax StandardNormalDistribution (Argument) Where: Argument is a metric representing a list of numbers. X is an array or range of independent data points.

it is truncated. or empty cells.4 Plug-In Package Functions MicroStrategy Functions Reference Expression Sy – x = [ n ∑ xy – ( ∑ x ) ( ∑ y ) ] 1 -----. df < 1. Syntax TDistribution(x. those values are ignored. It is an invalid condition for Y and X to be empty or have a different number of data points. logical values. however. 378 Statistical functions © 2011 MicroStrategy. cells with the value zero are included. This function can be used in lieu of a table of critical values to test hypotheses on small sample sets. df) Where: • • x is the numeric value at which the distribution is evaluated. df is a value that indicates the degrees of freedom of the distribution. . Usage notes • • If df is not an integer.n ∑ y 2 – ( ∑ y ) – ------------------------------------2 n( n – 2) 2 n∑ x – (∑ x) 2 2 Usage notes • • If an argument value contains text. Inc. The following are invalid conditions: Either x or df is nonnumeric. Expression p( x < X) Where: • X is a random value that follows the t-distribution. TDistribution Returns the cumulative distribution of a random variable.

Inc. as described in TrendV (trend. For example.000 each year.. FutureTimeOffset is the point in time after the final time interval available for which to predict the data. SortBy> (KnownData1. Syntax Trend <FactID. page 19. it is best suited to predict values that increase or decrease in a linear trend. vector input). FutureTimeOffset) Where: • KnownData1. For example. This is commonly defined as an integer.. this is a scenario that is well suited for a prediction based on a linear equation. For more information. to predict values for the year 2009 when the last available data you have is for 2007.. you would enter the value of 2 for FutureTimeOffset. you want to predict what your Revenue will be for the coming year. While you can use Trend to enter these values manually.. page 353. FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. SortBy is a parameter that defines the order of calculation.. if your profits are increasing by $10. based on revenue data for three years.. see BreakBy and SortBy parameters. Statistical functions 379 .MicroStrategy Functions Reference Plug-In Package Functions 4 Trend The Trend function uses data recorded for certain time intervals to calculate and display the expected value of data for an unknown time period. as described in TrendV (trend. © 2011 MicroStrategy. page 380.. This function uses a linear equation to predict future values. you can use Trend to enter values manually.. see GrowthV (growth. page 380. vector input). it is more common to use TrendV to use metrics and attributes to enter this information. Therefore. • • • Example As described in the syntax requirements. This is most commonly used to predict future metric values based on historical data. However.KnownDataN.KnownDataN are separate scalar values that provide the data to use to predict a future value for. For a function that predicts values in a similar way for data that is increasing or decreasing exponentially. vector input). For example. it is more common to use TrendV which can use a metric to enter a list of values.

FutureTimeOffset is the point in time after the final time interval available for which to predict the data. For example. However. vector input) The TrendV function uses data recorded for certain time intervals to calculate and display the expected value of data for an unknown time period. unknown values. SortBy>(KnownData. profit. This is most commonly used to predict future metric values based on historical data. if your profits are increasing by $10. You can use TrendV to predict values for any point in time. it is best suited to predict values that increase or decrease in a linear trend. Inc. For a function that predicts values in a similar way for data that is increasing or decreasing exponentially. this type of function is meant for predicting future. If your data meets these requirements. KnownData is commonly used for metrics that represent data such as revenue. month. This function uses a linear equation to predict future values. Therefore. and so on. see GrowthV (growth. and so on.4 Plug-In Package Functions MicroStrategy Functions Reference TrendV (trend. you would enter the value of 2 for FutureTimeOffset. This list of values is the known data to use to predict a future value for. which requires you to specify a time interval such as year for each expression. Syntax TrendV <FactID.000 each year. This is an advantage of TrendV in relation to ForecastV. For example. see the examples described below. This is commonly defined as an integer. vector input). FutureTimeOffset) Where: • KnownData is an object representing a list of values. to predict values for the year 2009 when the last available data you have is for 2007. For example. The TrendV function assumes that data is available for sequential time intervals with no missing data. based on revenue data for three years. you want to predict what your Revenue will be for the coming year. For an example. including dates that have known data. © 2011 MicroStrategy. page 353. • 380 Statistical functions . this allows you to use a single expression to use on reports with varying time intervals such as year. quarter. • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact. this is a scenario that is well suited for a prediction based on a linear equation.

After making the new custom subtotal available for the Revenue metric (see the Advanced Reporting Guide for steps to make custom subtotals available for metrics) a report with the attribute Year and the metric Revenue is created. as shown below: This value is the same value predicted in the example using ForecastV. For more information. When a subtotal is applied to a metric on a report. vector input). The advantage of using TrendV is that since you do not have to define the attribute or other object that defines the time interval. it displays the predicted value for 2008 Revenue. as described in ForecastV (forecast. 1) Since this is in a subtotal. the placeholder inputs that metric’s values. When the 2008 Trend is displayed on the report. Example The TrendV function is useful to display predicted future values of a metric as a subtotal of the metric on a report. For example.MicroStrategy Functions Reference Plug-In Package Functions 4 • SortBy is a parameter that defines the order of calculation. 1 is used as the offset in the time interval to predict data for the first time interval that is not known. Statistical functions 381 . the report can be modified to display © 2011 MicroStrategy. Inc. Also. in the MicroStrategy Tutorial project a new subtotal named 2008 Trend can be created with the following definition: TrendV(x. page 348. page 19. see BreakBy and SortBy parameters. the x is a placeholder for a metric. For example. you can switch the time interval used by modifying the report.

This is shown in the report below. Inc. . VarTest returns the P-value for the hypothesis test in the following form: • H0: σ 2 (Argument) = σ 02 382 Statistical functions © 2011 MicroStrategy. which allows the 2008 Trend subtotal to predict the revenue for the first quarter of 2008. Decision Accept H0 Reject H0 Reality: H0 is correct No problem Type 2 error Reality: H1 is correct Type 1 error No problem Definition P-value = Pr[Reject H0| H0 is correct] P-value is basically a probability of making a Type 2 error. The type of subtotal shown above could also be created using ForecastV. but it would require you to create a separate subtotal that used the Quarter attribute to define the time intervals.4 Plug-In Package Functions MicroStrategy Functions Reference Quarter instead of Year. VarTest (variance test) Returns the P-value of a test that tests the variance of the data against a particular value.

MicroStrategy Functions Reference Plug-In Package Functions 4 • H1: σ 2 (Argument) < σ 02 [Type = –1] 2 σ 2 (Argument) ≠ σ 02 [Type = 0: Two-sided test] ϑ 2 σ 2 (Argument) > σ 02 [Type = 1] ϑ 0 2 σ 2 (Argument) ≠ σ 02 [Type = 2: One-sided test] ϑ Syntax VarTest <Hypothesis Type> (Argument. Statistical functions 383 . less than (-1). Hypothesis Variance) Where: • Hypothesis Type is the parameter to set whether you are testing the probability of the value being equal (0). and the second tests the probability of the value being less than (-1). Hypothesis Variance is the variance you are testing. WeibullDistribution Returns either the cumulative distribution or the probability density of a random variable. 1000) = 1000 For a set of values (M1). such as the calculation of the mean time to failure for a given device. • • Example VarTest(M1. or not equal to (2) the sigma or variance. Usage notes For each variance test function. Inc. greater than (1). Argument is a fact or metric representing the values you are testing. A parameter must be specified for the second test. The first tests the probability of the value being equal (0). what is the probability that the variance of the value will be equal to 1000? Note that M1 needs to have a defined dimensionality. © 2011 MicroStrategy. greater than (1). two tests are performed. Used in reliability analysis. or not equal to (2) the sigma or variance.

Beta) Where: • • • • x is the numeric value at which the distribution is evaluated. it returns the cumulative distribution. the Weibull exponential return is λ = 1 -β • Usage notes The following are invalid conditions: • • • • alpha or beta is nonnumeric. Alpha is a distribution parameter. .α . beta < 0. Expression • For the Weibull cumulative distribution: α –( x ⁄ β ) F ( x .4 Plug-In Package Functions MicroStrategy Functions Reference Syntax WeibullDistribution <Cumulative> (x. Beta is a distribution parameter. 384 Statistical functions © 2011 MicroStrategy.α . alpha < 0. If Cumulative=1.β ) = --x α β When alpha = 1.β ) = 1 – e • For the Weibull probability density: α α – 1 e –( x ⁄ β )α f ( x . Inc. it returns the probability density. x < 0. Cumulative is a logical value that determines the form of the function: If Cumulative=0 (default). Alpha.

page 385 Databases that a function can be evaluated on. see Types of function processing. page 388 For additional information on how functions are processed. Introduction The functions provided with MicroStrategy can be evaluated by the MicroStrategy Analytical Engine or passed to the database for processing. The sections and tables in this appendix list MicroStrategy Analytical Engine and database support for MicroStrategy functions.A MICROSTRATEGY AND DATABASE SUPPORT FOR FUNCTIONS A. • • Analytical Engine support for functions. Analytical Engine support for functions The functions listed in the table below are supported by the MicroStrategy Analytical Engine. Inc. This allows metrics to be evaluated by MicroStrategy in © 2011 MicroStrategy. Analytical Engine support for functions 385 . Reviewing this support allows you to determine whether a MicroStrategy function can be supported for your MicroStrategy environment.

and therefore are not supported by the MicroStrategy Analytical Engine. Function type Basic functions Functions supported by the MicroStrategy Analytical Engine • • • • • • • • • • • • • • • • • • • • Add Average Avg Count First Geomean Greatest Last Least Max Median Min Mode Multiply Product Stdev StdevP Sum Var VarP Date and time functions All date and time functions must be evaluated by the database. . • • • • • • • • • Banding BandingC BandingP Case CaseV IsNotNull IsNull NullToZero ZeroToNull Internal functions Null and Zero functions 386 Analytical Engine support for functions © 2011 MicroStrategy. Inc. page 388.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference cases where functions cannot be evaluated by a database. It also allows metrics to support smart metric functionality (see the Advanced Reporting Guide). To review database support for functions. see Databases that a function can be evaluated on.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type OLAP functions Functions supported by the MicroStrategy Analytical Engine • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • ExpWghMovingAvg ExpWghRunningAvg FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingDifference MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum NTile NTileSize NTileValue NTileValueSize Percentile Rank Rank and NTile functions String functions Arithmetic operators • Lower • Upper • All Arithmetic functions are supported by the MicroStrategy Analytical Engine © 2011 MicroStrategy. Analytical Engine support for functions 387 .

All financial functions are supported by the MicroStrategy Analytical Engine. If a function cannot be evaluated 388 Databases that a function can be evaluated on © 2011 MicroStrategy. If a function is listed for a database.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Comparison operators Functions supported by the MicroStrategy Analytical Engine • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions Mathematical functions Statistical functions All data mining functions are supported by the MicroStrategy Analytical Engine. All mathematical functions are supported by the MicroStrategy Analytical Engine. . All statistical functions are supported by the MicroStrategy Analytical Engine. Databases that a function can be evaluated on The tables below list the function support for each database that is certified for use with MicroStrategy. the function can be evaluated within that database. Inc.

page 508 Vertica. page 491 Teradata. page 396 Greenplum.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A within a database. page 410 HP Neoview. For information on the certification and support for databases. Inc. page 452 Netezza. page 481 Red Brick.x.0. only database that are certified to work with MicroStrategy are listed below. the function may be able to be supported by the MicroStrategy Analytical Engine (see Analytical Engine support for functions. page 385). page 464 PostgreSQL.5. page 487 Sybase. page 416 Informix. page 389 IBM DB2. Except where explicitly stated. page 516 Aster nCluster The tables listed below describe the MicroStrategy function support for Aster nCluster databases: • • Aster nCluster 4. Databases that a function can be evaluated on 389 . page 428 Microsoft Access. page 455 Oracle. refer to the MicroStrategy Readme: • • • • • • • • • • • • • • • Aster nCluster.2. page 393 © 2011 MicroStrategy. page 437 Microsoft SQL Server. page 390 Aster nCluster 4. page 443 MySQL.

Inc.2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Sum AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions Null and Zero functions • Coalesce • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull RunningAvg RunningCount RunningMax RunningMin RunningSum OLAP functions Rank and NTile functions • Rank 390 Databases that a function can be evaluated on © 2011 MicroStrategy.0. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Aster nCluster 4.

Inc. Databases that a function can be evaluated on 391 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None © 2011 MicroStrategy.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Trunc Statistical functions None 392 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 393 .x Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions Null and Zero functions • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull © 2011 MicroStrategy. Inc.5.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Aster nCluster 4.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • Lag Lead RunningAvg RunningCount RunningMax RunningMin RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like Arithmetic operators Comparison operators 394 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 395 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators for rank Functions that can be evaluated on the database • • • • • • • • • • *<= *<> *= *>= *Between Not*Between AND IF Not Or Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Trunc Statistical functions None © 2011 MicroStrategy.

page 396 DB2 UDB V9. UNIX. Inc. and Windows. UNIX.5 for Linux.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference IBM DB2 The tables listed below describe the MicroStrategy function support for IBM DB2 databases: • • • • DB2 UDB V9.1.5 for Linux.7 for Linux. page 408 DB2 UDB V9. . UNIX. page 401 DB2 for i 6. page 405 DB2 for i 7. and Windows.1. and Windows Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product StdevP Sum Var VarP 396 Databases that a function can be evaluated on © 2011 MicroStrategy.

Databases that a function can be evaluated on 397 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 398 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Databases that a function can be evaluated on 399 . Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Intercept RSquare Slope Statistical functions 400 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A DB2 UDB V9. Databases that a function can be evaluated on 401 . UNIX.7 for Linux. and Windows Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy.

. Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPRank RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 402 Databases that a function can be evaluated on © 2011 MicroStrategy.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Databases that a function can be evaluated on 403 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Intercept RSquare Slope Statistical functions 404 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 405 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A DB2 for i 6.1 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None • Rank © 2011 MicroStrategy.

Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None 406 Databases that a function can be evaluated on © 2011 MicroStrategy.

Databases that a function can be evaluated on 407 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Statistical functions None © 2011 MicroStrategy.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference DB2 for i 7.1 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None • Rank 408 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None © 2011 MicroStrategy. Databases that a function can be evaluated on 409 . Inc.

2. page 414 410 Databases that a function can be evaluated on © 2011 MicroStrategy.3. Inc. page 411 Greenplum 3.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Statistical functions None Greenplum The tables listed below describe the MicroStrategy function support for Greenplum databases: • • Greenplum 3. .

Databases that a function can be evaluated on 411 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Greenplum 3. Inc.2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions None © 2011 MicroStrategy.

Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators 412 Databases that a function can be evaluated on © 2011 MicroStrategy.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Correlation Covarience Intercept RSquare Slope Statistical functions © 2011 MicroStrategy. Databases that a function can be evaluated on 413 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Greenplum 3.3 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions None 414 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Inc. Databases that a function can be evaluated on 415 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Correlation Covarience Intercept RSquare Slope Statistical functions HP Neoview The tables listed below describe the MicroStrategy function support for HP Neoview databases: • • HP Neoview 2. Inc. .4. page 417 HP Neoview 2. page 420 416 Databases that a function can be evaluated on © 2011 MicroStrategy.3.

Inc.3 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None © 2011 MicroStrategy. Databases that a function can be evaluated on 417 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A HP Neoview 2.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None 418 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Slope Standardize Statistical functions © 2011 MicroStrategy. Databases that a function can be evaluated on 419 .

4 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None 420 Databases that a function can be evaluated on © 2011 MicroStrategy.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference HP Neoview 2. . Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None © 2011 MicroStrategy. Databases that a function can be evaluated on 421 . Inc.

page 423 422 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.3.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Slope Standardize Statistical functions Infobright The tables listed below describe the MicroStrategy function support for Infobright databases: • Infobright 3.1. .

Databases that a function can be evaluated on 423 .2.4. Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A • Infobright 3. page 426 Infobright 3.1 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce © 2011 MicroStrategy.3.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Null and Zero functions Functions that can be evaluated on the database • • • • IsNotNull IsNull NullToZero ZeroToNull OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like Arithmetic operators Comparison operators 424 Databases that a function can be evaluated on © 2011 MicroStrategy. .

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators for rank Functions that can be evaluated on the database • • • • • • • • • • *<= *<> *= *>= *Between Not*Between AND IF Not Or Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions None © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 425 .

2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions None 426 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Infobright 3.4.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 427 .

x. Inc.1. . page 429 Informix IDS 11.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions None Informix The tables listed below describe the MicroStrategy function support for Informix databases: • • • Informix IDS 11.5. page 434 428 Databases that a function can be evaluated on © 2011 MicroStrategy. page 431 Informix XPS 8.

1 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Stdev Sum Var AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None © 2011 MicroStrategy. Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Informix IDS 11. Databases that a function can be evaluated on 429 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None 430 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 431 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Exp Floor Int Int2 Ln Log10 Mod Power Quotient Round Round2 Sin Sqrt Tan Trunc Statistical functions None Informix IDS 11.5 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • Add Average Avg Count Max Min Multiply Stdev Sum Var © 2011 MicroStrategy. Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim RightStr RTrim SubStr Trim Upper 432 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Databases that a function can be evaluated on 433 .

x Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • Add Average Avg Count Max Min Multiply Stdev Sum Var 434 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Exp Floor Int Int2 Ln Log10 Mod Power Quotient Round Round2 Sin Sqrt Tan Trunc Statistical functions None Informix XPS 8.

Databases that a function can be evaluated on 435 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim RightStr RTrim SubStr Trim Upper © 2011 MicroStrategy.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None 436 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

2002. Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Exp Floor Int Int2 Ln Log10 Mod Power Round Round2 Sin Sqrt Tan Trunc Statistical functions None Microsoft Access The tables listed below describe the MicroStrategy function support for Microsoft Access databases. Databases that a function can be evaluated on 437 . Microsoft Access database are: • • Microsoft Access 2000. page 438 Microsoft Access 2007. or 2003. page 440 © 2011 MicroStrategy.

or 2003 Microsoft Access 2000. Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Sum AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None 438 Databases that a function can be evaluated on © 2011 MicroStrategy.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Microsoft Access 2000. Inc. 2002. or 2003 are only supported for demonstration purposes. . 2002.

Inc. Databases that a function can be evaluated on 439 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower Position RightStr SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy.

Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev StdevP Sum Var VarP 440 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • Floor Int Int2 Ln Mod Quotient Statistical functions None Microsoft Access 2007 Microsoft Access 2007 is only supported for demonstration purposes.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper © 2011 MicroStrategy. Databases that a function can be evaluated on 441 . Inc.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None 442 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • Abs Cos Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Round Round2 Sin Sqrt Tan Statistical functions None Microsoft SQL Server The tables listed below describe the MicroStrategy function support for Microsoft SQL Server databases: • • • Microsoft SQL Server 2000. page 446 Microsoft SQL Server 2008. page 444 Microsoft SQL Server 2005. Inc. page 449 © 2011 MicroStrategy. Databases that a function can be evaluated on 443 .

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Microsoft SQL Server 2000 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None 444 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None © 2011 MicroStrategy. Databases that a function can be evaluated on 445 . Inc.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Statistical functions • None Microsoft SQL Server 2005 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev StdevP Sum Var VarP 446 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions • OLAPRank • Rank • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper © 2011 MicroStrategy. Databases that a function can be evaluated on 447 . Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None 448 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc. .

Databases that a function can be evaluated on 449 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions None Microsoft SQL Server 2008 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev StdevP Sum Var VarP © 2011 MicroStrategy.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions • OLAPRank • Rank • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper 450 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 451 .

x.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions None MySQL The tables listed below describe the MicroStrategy function support forMySQL databases: • MySQL 5. Inc. . page 453 452 Databases that a function can be evaluated on © 2011 MicroStrategy.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A MySQL 5.x Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions None © 2011 MicroStrategy. Databases that a function can be evaluated on 453 . Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators 454 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 455 . Inc.x.0. page 460 © 2011 MicroStrategy.6. page 456 Netezza 5.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions None Netezza The tables listed below describe the MicroStrategy function support for Netezza databases: • • Netezza 4.

. Inc.x Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions 456 Databases that a function can be evaluated on © 2011 MicroStrategy.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Netezza 4.6.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 457 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None 458 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc. .

Databases that a function can be evaluated on 459 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions © 2011 MicroStrategy. Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Netezza 5. Inc.0 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions 460 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 461 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators © 2011 MicroStrategy. Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None 462 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 463 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions © 2011 MicroStrategy. Inc.

page 477 Oracle 10g Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • Add Average Avg Count First Geomean Greatest Last Least Max Median Min Multiply Product Stdev StdevP Sum Var VarP 464 Databases that a function can be evaluated on © 2011 MicroStrategy. . page 464 Oracle 10gR2. page 473 Oracle 11g R2. Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Oracle The tables listed below describe the MicroStrategy function support for Oracle databases: • • • • Oracle 10g. page 469 Oracle 11g.

Databases that a function can be evaluated on 465 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy. Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 466 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc. .

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Databases that a function can be evaluated on 467 .

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions 468 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Oracle 10gR2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count First Geomean Greatest Last Least Max Median Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 469 .

. Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Null and Zero functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum OLAP functions Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 470 Databases that a function can be evaluated on © 2011 MicroStrategy.

Inc. Databases that a function can be evaluated on 471 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy.

. Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions 472 Databases that a function can be evaluated on © 2011 MicroStrategy.

Databases that a function can be evaluated on 473 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Oracle 11g Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count First Geomean Greatest Last Least Max Median Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Null and Zero functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum OLAP functions Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 474 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 475 .

. Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions 476 Databases that a function can be evaluated on © 2011 MicroStrategy.

Inc. Databases that a function can be evaluated on 477 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Oracle 11g R2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count First Geomean Greatest Last Least Max Median Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce © 2011 MicroStrategy.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Null and Zero functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingStdevP MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningStdevP RunningSum OLAP functions Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 478 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 479 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Round2 Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions 480 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

page 481 PostgreSQL 8. Inc. page 485 PostgreSQL 8. Databases that a function can be evaluated on 481 .3.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A PostgreSQL The tables listed below describe the MicroStrategy function support for PostgreSQL databases: • • PostgreSQL 8.4.3 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper 482 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 483 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Arithmetic operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Inc.

Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Correlation Covarience Intercept RSquare Slope Statistical functions 484 Databases that a function can be evaluated on © 2011 MicroStrategy.

Databases that a function can be evaluated on 485 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A PostgreSQL 8.4 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Greatest Least Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions None © 2011 MicroStrategy. Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators 486 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

page 488 © 2011 MicroStrategy.3. Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Correlation Covarience Intercept RSquare Slope Statistical functions Red Brick The tables listed below describe the MicroStrategy function support for Red Brick databases: • Red Brick 6. Databases that a function can be evaluated on 487 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Red Brick 6. Inc.3 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Sum AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions 488 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 489 . Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators © 2011 MicroStrategy.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • Abs Ceiling Exp Floor Int Int2 Ln Mod Quotient Round Round2 Sqrt Statistical functions None 490 Databases that a function can be evaluated on © 2011 MicroStrategy. .

2. page 500 Sybase IQ 15. page 494 Sybase IQ 15.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Sybase The tables listed below describe the MicroStrategy function support for Sybase databases: • • • • • Sybase ASE 15. page 491 Sybase ASE 15.5. Databases that a function can be evaluated on 491 . Inc.1. page 504 Sybase ASE 15 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Sum AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions © 2011 MicroStrategy. page 496 Sybase IQ 15.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Internal functions Functions that can be evaluated on the database • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions String functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like Arithmetic operators Comparison operators 492 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

Inc. Databases that a function can be evaluated on 493 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators for rank Functions that can be evaluated on the database • • • • • • • • • • *<= *<> *= *>= *Between Not*Between AND IF Not Or Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Statistical functions None © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Sybase ASE 15. Inc. .5 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Max Min Multiply Sum AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions OLAP functions Rank and NTile functions None None 494 Databases that a function can be evaluated on © 2011 MicroStrategy.

Inc. Databases that a function can be evaluated on 495 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None © 2011 MicroStrategy.

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Statistical functions None Sybase IQ 15 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev Sum Var 496 Databases that a function can be evaluated on © 2011 MicroStrategy. .

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 497 .

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 498 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

Inc. Databases that a function can be evaluated on 499 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy.

1 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev Sum Var 500 Databases that a function can be evaluated on © 2011 MicroStrategy. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Trunc Statistical functions None Sybase IQ 15. Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 501 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 502 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 503 .

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Trunc Statistical functions None Sybase IQ 15.2 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Stdev Sum Var 504 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

Inc. Databases that a function can be evaluated on 505 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Week Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy.

Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • Lag Lead MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingSum OLAPAvg OLAPCount OLAPMax OLAPMin OLAPRank OLAPSum RunningAvg RunningCount RunningMax RunningMin RunningStdev RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U- Arithmetic operators 506 Databases that a function can be evaluated on © 2011 MicroStrategy.

Databases that a function can be evaluated on 507 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • < <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Comparison operators for rank Logical operators Data mining functions Financial functions None None © 2011 MicroStrategy. Inc.

page 512 508 Databases that a function can be evaluated on © 2011 MicroStrategy.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Mathematical functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Asin Atan Atan2 Ceiling Cos Degrees Exp Floor Int Int2 Ln Log10 Mod Power Quotient Radians Round Round2 Sin Sqrt Tan Trunc Statistical functions None Teradata The tables listed below describe the MicroStrategy function support for Teradata databases: • • Teradata 12. Inc. page 509 Teradata 13. .

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Teradata 12 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions • Banding • BandingC • Coalesce • • • • IsNotNull IsNull NullToZero ZeroToNull Null and Zero functions © 2011 MicroStrategy. Databases that a function can be evaluated on 509 . Inc.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type OLAP functions Functions that can be evaluated on the database • • • • • • • • • • • MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingSum RunningAvg RunningCount RunningMax RunningMin RunningSum Rank and NTile functions String functions • Rank • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like Arithmetic operators Comparison operators 510 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Inc. Databases that a function can be evaluated on 511 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Comparison operators for rank Functions that can be evaluated on the database • • • • • • • • • • *<= *<> *= *>= *Between Not*Between AND IF Not Or Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Sin Sqrt Tan Tanh Trunc © 2011 MicroStrategy.

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Statistical functions Functions that can be evaluated on the database • • • • • • • • • • • Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Teradata 13 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP 512 Databases that a function can be evaluated on © 2011 MicroStrategy. . Inc.

Databases that a function can be evaluated on 513 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Date and time functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Internal functions • Banding • BandingC • Coalesce • • • • • • • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull MovingAvg MovingCount MovingMax MovingMin MovingStdev MovingSum RunningAvg RunningCount RunningMax RunningMin RunningSum Null and Zero functions OLAP functions Rank and NTile functions • Rank © 2011 MicroStrategy. Inc.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type String functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators Data mining functions None 514 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

Inc. Databases that a function can be evaluated on 515 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Financial functions Mathematical functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Cosh Degrees Exp Floor Int Int2 Ln Log Log10 Mod Power Quotient Radians Round Sin Sinh Sqrt Tan Tanh Trunc Correlation Covarience Fisher Intercept InverseFisher Pearson RSquare Skew Slope Standardize SteYX Statistical functions © 2011 MicroStrategy.

page 519 Vertica 4.0. Inc. page 522 Vertica 3.5.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Vertica The tables listed below describe the MicroStrategy function support for Vertica databases: • • Vertica 3.0 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions 516 Databases that a function can be evaluated on © 2011 MicroStrategy. .

Databases that a function can be evaluated on 517 .MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Internal functions Null and Zero functions Functions that can be evaluated on the database • Coalesce • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead OLAPRank OLAP functions Rank and NTile functions String functions None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like Arithmetic operators Comparison operators © 2011 MicroStrategy. Inc.

Inc. .A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Comparison operators for rank Functions that can be evaluated on the database • • • • • • • • • • *<= *<> *= *>= *Between Not*Between AND IF Not Or Logical operators Data mining functions Financial functions Mathematical functions None None • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions • Standardize 518 Databases that a function can be evaluated on © 2011 MicroStrategy.

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Vertica 3. Databases that a function can be evaluated on 519 . Inc.5 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions Null and Zero functions • Coalesce • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead OLAPRank OLAP functions © 2011 MicroStrategy.

.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators 520 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc.

Inc.MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions • Standardize © 2011 MicroStrategy. Databases that a function can be evaluated on 521 .

A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Vertica 4.0 Function type Basic functions Functions that can be evaluated on the database • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Add Average Avg Count Geomean Max Min Multiply Product Stdev StdevP Sum Var VarP AddDays AddMonths CurrentDate CurrentDateTime CurrentTime Date DayOfMonth DayOfWeek DayOfYear DaysBetween Hour MilliSecond Minute Month MonthEndDate MonthsBetween MonthStartDate Quarter Second Year YearEndDate YearStartDate Date and time functions Internal functions Null and Zero functions • Coalesce • • • • • • • • • IsNotNull IsNull NullToZero ZeroToNull FirstInRange Lag LastInRange Lead OLAPRank OLAP functions 522 Databases that a function can be evaluated on © 2011 MicroStrategy. Inc. .

MicroStrategy Functions Reference MicroStrategy and Database Support for Functions A Function type Rank and NTile functions String functions Functions that can be evaluated on the database None • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Concat ConcatBlank InitCap LeftStr Length Lower LTrim Position RightStr RTrim SubStr Trim Upper x + / U< <= <> = > >= Begins With Between Contains Ends With In Like Not Begins With Not Between Not Contains Not Ends With Not In Not Like *<= *<> *= *>= *Between Not*Between AND IF Not Or Arithmetic operators Comparison operators Comparison operators for rank Logical operators © 2011 MicroStrategy. Inc. Databases that a function can be evaluated on 523 .

Inc.A MicroStrategy and Database Support for Functions MicroStrategy Functions Reference Function type Data mining functions Financial functions Mathematical functions Functions that can be evaluated on the database None None • • • • • • • • • • • • • • • • • • • • • • • • • • Abs Acos Acosh Asin Asinh Atan Atan2 Atanh Ceiling Cos Degrees Exp Ln Log Log10 Mod Power Quotient Radians Randbetween Round Round2 Sin Sqrt Tan Trunc Statistical functions • Standardize 524 Databases that a function can be evaluated on © 2011 MicroStrategy. .

See also: • • attribute element attribute form attribute element A value of any of the attribute forms of an attribute. For example. January. February. prompt. custom group. Order. Item. template. Glossary: Analytical Engine 525 . Customer. attribute A data level defined by the system architect and associated with one or more columns in a data warehouse lookup table. metric. consolidation. and March are elements of the attribute Month. Application objects include (among others) these object types: report. The Analytical Engine evaluates functions not supported by the data warehouse RDBMS and it cross-tabulates reports. and Year. Attributes include data classifications like Region. They provide a means for aggregating and filtering at a given level.GLOSSARY Analytical Engine A component of the MicroStrategy Intelligence Server that performs all advanced analytical functions. New York and Dallas are elements of the attribute City. City. © 2011 MicroStrategy. Inc. filter. application object MicroStrategy object used to provide analysis of and insight into relevant data. document. Age. Application objects are developed in MicroStrategy Desktop and they are the building blocks for reports and documents.

database logins. Long Description. Arithmetic operators are +. Configuration objects include (among others) these object types: users. functions when the analytical engine reaches the next instance of the specified attribute or hierarchy. or metrics. attributes. Each element contains its own set of filtering qualifications. where each set of ages is a band.Glossary MicroStrategy Functions Reference attribute form One of several columns associated with an attribute that are different aspects of the same thing. Rank. custom group An object that can be placed on a template and is made up of an ordered collection of elements called custom group elements. break by An attribute or hierarchy where calculations for an OLAP function restart. configuration objects A MicroStrategy object appearing in the system layer and usable across multiple projects. Inc. . NTile. schedules. and various expressions that calculate percent values. compound metric A type of metric defined by a formula based on arithmetic operators and non-group functions. -. *. Examples are RunningAvg(Cost_Metric) and Sum(Cost_Metric) + Sum(Profit_Metric). 526 Glossary: attribute form © 2011 MicroStrategy. and 31–40. and /. where every other row is a different color and the two colors alternate. ID. or Relative. To break by an attribute or hierarchy in an expression. database instances. customers in the age ranges of 10–20. Last Name. and Abbreviation could be forms of the attribute Customer. Banding is also used for display purposes. banding A method of organizing values according to a set of descriptive or meaningful data ranges called buckets. 21–30. The operators and functions can be applied to facts. Name. you must set the BreakBy parameter. For example. To break by an attribute or hierarchy means to restart calculations that use OLAP. Examples of OLAP functions include RunningStdevP. non-group functions are OLAP and scalar functions such as running sum or rank. Every attribute supports its own collection of forms. Compare consolidation.

© 2011 MicroStrategy. facts. which can be accessed from MicroStrategy Desktop. For example: Sum(dollar_sales) or [Sales] . The order of the attributes is typically—though not always—defined such that a higher attribute has a one-to-many relationship with its child attributes. schema object MicroStrategy object created. Glossary: fact 527 . Schema objects directly reflect the warehouse structure and include (among others) attributes. attributes. or other metrics. functions.[Cost]. often numeric and typically aggregatable. Inc. or inventory quantities in counts. These objects are developed in MicroStrategy Architect. It represents a business measure or key performance indicator. usually by a project designer.MicroStrategy Functions Reference Glossary fact 1) A measurement value. hierarchy A set of attributes defining a meaningful path for element browsing or drilling. See also metric. that relates the information in the logical data model and physical warehouse schema to the MicroStrategy environment. See also fact. partition mappings. 2) The MicroStrategy object that contains the metric definition. operators. hierarchies. tables. facts. metric 1) A business calculation defined by an expression built with functions. or sales in dollars. stored in a data warehouse. 2) A schema object representing a column in a data warehouse table and containing basic or aggregated numbers—usually prices. and transformations.

Inc. sort by The order of the return values of an expression in relation to the order of the value or metadata object given. which is applied to facts. To sort by a value or metadata object in an expression. 528 Glossary: simple metric © 2011 MicroStrategy. which is the input argument. attributes. or other metrics. in addition to the required group function. and which metadata object to sort by.Glossary MicroStrategy Functions Reference simple metric A type of metric defined by a formula containing a mathematical expression based on at least one group function. you must set the SortBy parameter. Sort by may also be performed on the value of the subexpression. It can also contain non-group functions or arithmetic operators. Examples are Avg(Sum((Cost_Fact + Profit_Fact))) and Avg((Cost_Metric + Profit_Metric))). such as sum or average. A sort by includes whether to sort in ascending or descending order. .

16. 135. 11 ApplyAgg 133 ApplyComparison 134 ApplyComparison in filter 16 ApplyLogic 134 ApplyOLAP 134 ApplySimple 135 example 12. 136 argument 24 arithmetic operator 236 Divide 237 Minus 236 Plus 237 Times 236 Unary Minus 238 Asin 315 Asinh 316 Atan 316 Atan2 316 Atanh 317 attribute defined on 2. 24 attribute form expression 32 accessing 34 Average 93 average 94 moving 163 OLAP 175 529 . 134.INDEX A Abs 314 Accrint 259 Accrintm 261 Acos 314 Acosh 315 Add 92 analytical engine 46 And 254 application object defined on 2 Apply functions 5. 136 syntax 132 using extra arguments in 132 ApplyAgg 133 example 133 ApplyComparison 134 example 12. 134 in filter 16 © 2011 MicroStrategy. ApplyLogic 134 example 134 ApplyOLAP 134 example 135 ApplySimple 135 example 15. Inc. 16.

Simple 83 B banding functions 131 BandingC 139 BandingP 141 base formula 25 basic functions 92 Add 92 Average 93 Avg 94 First 98 GeoMean 99 Greatest 100 Last 101 mathematical (arithmetic operators) 236 Max 103 Median 105 Min 106 Mode 108 Product 110 StDev 112 StDevP 111 Sum 114 Var 117 VarP 115 Begins With 242 BetaDistribution 335 Between 243 Between Enhanced 252 BinomialDistribution 336 break by defined on 9 parameter 19 business example confidence level 72 530 C Case 144 case functions 132 Ceiling 317 ChiSquareDistribution 338 ChiSquareTest 340 Combine 318 comparison for rank operator 249 Between Enhanced 252 Equal Enhanced 251 Greater Equal Enhanced 251 Less Equal Enhanced 249 Not Between Enhanced 253 Not Equal Enhanced 250 comparison operator 239 Begins With 242 Between 243 Contains 243 Ends With 244 Equal 241 Greater 241 Greater Equal 242 In 244 Less Equal 239 Less Than 239 Like 245 Not Begins With 246 Not Between 246 Not Contains 247 Not Ends With 247 Not Equal 240 Not In 248 Not Like 248 compound metric 26 © 2011 MicroStrategy.Index MicroStrategy Functions Reference running 192 Avg 94 AvgDev 334 hypothesis testing 66 statistical descriptors . . Inc.

112 dimensionality 25 Disc 274 distribution.MicroStrategy Functions Reference Index Confidence 340 configuration object defined on 2 consolidation element expression 35 accessing 36 Contains 243 Correlation 341 Cos 319 Cosh 319 count moving 164 OLAP 178 running 193 Coupdaybs 263 Coupdays 264 Coupdaysnc 265 Coupncd 266 Coupnum 268 Couppcd 269 Covariance 342 CritBinomial 343 Cumipmt 270 Cumprinc 271 CurrentDate 120 CurrentDateTime 120 CurrentTime 121 custom expression ApplyComparison in filter 16 custom group defined on 36 custom group expression 36 accessing 37 D Data Mining functions 258 Date 121 date and time functions CurrentDate 120 CurrentDateTime 120 CurrentTime 121 Date 121 DayOfMonth 121 DayOfWeek 122 DayOfYear 123 DaysBetween 123 Hour 124 MilliSecond 124 Minute 125 Month 125 MonthEndDate 126 MonthsBetween 127 MonthStartDate 126 Quarter 128 Second 128 Week 129 Year 129 YearEndDate 130 YearStartDate 130 DayOfMonth 121 DayOfWeek 122 DayOfYear 123 DaysBetween 123 Db 273 Ddb 274 Degrees 320 deviation standard (population) 111 standard (sample) 111. 531 . Inc. standard normal cumulative 112 Divide 237 Dollarde 276 Dollarfr 276 Duration 276 © 2011 MicroStrategy.

264 Coupdaysnc 265 Coupncd 266 Coupnum 268 Couppcd 269 Cumipmt 270 Cumprinc 271 Db 273 Ddb 274 Disc 274 Dollarde 276 Duration 276 Effect 278 Fv 279 Fvschedule 279 Intrate 280 Ipmt 282 IRR 282 Mduration 284 MIRR 285 Nominal 286 Nper 287 NPV 287 Oddfprice 288 Oddfyield 291 Oddlprice 292 Oddlyield 294 Pmt 296 Ppmt 296 Price 297 Pricedisc 299 Pricemat 300 Pv 302 Rate 303 Received 303 Sln 305 Syd 305 Tbilleq 306 Tbillprice 307 Tbillyield 308 532 © 2011 MicroStrategy. 136 ApplyAgg 133 ApplyComparison 12. 135. 136 prompted date 12 Exp 321 ExponentialDistribution 344 ExpWghMovingAvg 151 ExpWghRunningAvg 152 F fact expression 38 accessing 39 Factorial 321 FDistribution 346 filter defined on 40 ApplyComparison function in 16 filter expression 40 accessing 41 financial functions Accrint 259 Accrintm 261 Coupdaybs 263. 15. Inc. 134 ApplyLogic 134 ApplyOLAP 135 ApplySimple 15. .Index MicroStrategy Functions Reference E Effect 278 Ends With 244 engine analytical 46 query 46 SQL 46 Equal 241 Equal Enhanced 251 example Apply function 12. 16. 134.

6 Fv 279 Fvschedule 279 H HeteroscedasticTTest 355. 356 HomoscedasticTTest 355. FTest 350 function basics of 4 function plug-In 62 function type 5 Apply function 11 Apply functions example 12 comparison function 10 group-value function 8 OLAP function 9 single-value function 5. 356 Hour 124 HypergeometricDistribution 357 I If 145.MicroStrategy Functions Reference Index Vdb 309 Yield 309 Yielddisc 311 Yieldmat 312 First 98 first occurrence 229 FirstInRange 153 Fisher 345 Floor 322 Forecast 346 ForecastV 348 formula. 254 In 244 InitCap 224 initial capitalization 224 InitialCap 224 Input Metric Formula dialog box 31 Insert Function Wizard 43 Int 323 Intercept 358 internal functions ApplyAgg 133 ApplyComparison 134 ApplyLogic 134 ApplyOLAP 134 ApplySimple 135 BandingC 139 BandingP 141 Case 144 international support xxviii Intrate 280 InverseBetaDistribution 359 InverseChiDistribution 360 InverseFDistribution 361 InverseFisher 360 InverseGammaDistribution 362 InverseLognormalDistribution 362 InverseNormDistribution 363 InverseNormSDistribution 364 InverseTDistribution 365 Ipmt 282 533 G GammaDistribution 351 GeoMean 99 Greater 241 Greater Equal 242 Greater Equal Enhanced 251 Greatest 100 Growth 352 GrowthV 353 © 2011 MicroStrategy. Inc. metric 25 formula. See compound metric. .

25 534 © 2011 MicroStrategy. Inc.Index MicroStrategy Functions Reference IRR 282 IsNotNull 148 IsNull 149 K Kurtosis 365 L Lag 155 Last 101 LastInRange 160 Lead 161 LeftStr 225 Length 226 Less Equal 239 Less Equal Enhanced 249 Less Than 239 Like 245 Ln 324 Log 324 Log10 325 logical operator 254 And 254 If 145. 254 Not 255 Or 256 LognormalDistribution 366 Lower 227 LTrim 228 M mathematical functions Abs 314 Acos 314 Acosh 315 Asin 315 Asinh 316 Atan 316 Atan2 316 Atanh 317 Ceiling 317 Combine 318 Cos 319 Cosh 319 Degrees 320 Exp 321 Factorial 321 Floor 322 Int 323 Ln 324 Log 324 Log10 325 Mod 325 Power 326 Quotient 327 Radians 328 Randbetween 328 Round 329 Round2 330 Sin 331 Sinh 331 Sqrt 331 Tan 332 Tanh 333 Trunc 333 Max 103 maximum moving 167 OLAP 181 running 194 Mduration 284 MeanTTest 367 Median 105 metric defined on 2. .

Inc.MicroStrategy Functions Reference Index base formula 25 dimensionality 25 formula 25 metric expression accessing 30 Metric Editor 31 MicroStrategy engine 46 function 46 function type xvi structure 46 MilliSecond 124 Min 106 minimum 106 moving 169 OLAP 184 running 195 Minus 236 Minute 125 MIRR 285 Mod 325 Mode 108 Month 125 MonthEndDate 126 MonthsBetween 127 MonthStartDate 126 moving average 163 average. position of first 229 Oddfprice 288 Oddfyield 291 Oddlprice 292 Oddlyield 294 535 © 2011 MicroStrategy. exponential weight 151 count 164 difference 166 maximum 167 minimum 169 standard deviation (population) 170 standard deviation (sample) 172 sum 173 MovingAvg 163 MovingCount 164 MovingDifference 166 MovingMax 167 MovingMin 169 MovingStdev 172 MovingStDevP 170 MovingSum 173 N NegativeBinomialDistribution 368 Nominal 286 NormalDistribution 369 Not 255 Not Begins With 246 Not Between 246 Not Between Enhanced 253 Not Contains 247 Not Ends With 247 Not Equal 240 Not Equal Enhanced 250 Not In 248 Not Like 248 Nper 287 NPV 287 NTile 202 NTileSize 204 NTileValue 206 NTileValueSize 214 NULL/Zero functions IsNotNull 148 IsNull 149 ZerotToNull 150 O occurrence. .

Index MicroStrategy Functions Reference OLAP average 175 count 178 maximum 181 minimum 184 rank 187 sum 189 OLAP functions ExpWghMovingAvg 151 ExpWghRunningAvg 152 FirstInRange 153 Lag 155 LastInRange 160 Lead 161 MovingAvg 163 MovingCount 164 MovingDifference 166 MovingMax 167 MovingMin 169 MovingStdev 172 MovingStDevP 170 MovingSum 173 OLAPAvg 175 OLAPCount 178 OLAPMax 181 OLAPMin 184 OLAPRank 187 OLAPSum 189 RunningAvg 192 RunningCount 193 RunningMax 194 RunningMin 195 RunningStDev 198 RunningStDevp 196 RunningSum 200 OLAPAvg 175 OLAPCount 178 OLAPMax 181 536 OLAPMin 184 OLAPRank 187 OLAPSum 189 operator arithmetic 236 comparison 239 logical 254 Or 256 P PairedTTest 371 parameter 18 BreakBy 19 SortBy 19 Pass-through function. . Inc. See Apply functions Pearson 371 Percentile 216 Permut 372 Plus 237 Pmt 296 PoissonDistribution 373 Position 229 Power 326 Ppmt 296 Price 297 Pricedisc 299 Pricemat 300 Product 110 Pv 302 Q Quarter 128 query engine 46 Quotient 327 © 2011 MicroStrategy.

172 running 196. comparison for 249 Rate 303 RDBMS platforms 132 Received 303 RightStr 230 Round 329 Round2 330 RSquare 374 RTrim 231 running average 192 average. 198 Standardize 376 StandardNormalDistribution 377 statistical functions AvgDev 334 BetaDistribution 335 BinomialDistribution 336 ChiSquareDistribution 338 ChiSquareTest 340 Confidence 340 Correlation 341 Covariance 342 FDistribution 346 Fisher 345 Forecast 346 ForecastV 348 FTest 350 © 2011 MicroStrategy.MicroStrategy Functions Reference Index R Radians 328 Randbetween 328 Rank 218 rank OLAP 187 rank and NTile functions NTile 202 NTileSize 204 NTileValue 206 NTileValueSize 214 Percentile 216 Rank 218 rank operator. exponential weight 152 count 193 maximum 194 minimum 195 standard deviation (population) 196 standard deviation (sample) 198 sum 200 RunningAvg 192 RunningCount 193 RunningMax 194 RunningMin 195 RunningStDev 198 RunningStDevp 196 RunningSum 200 S schema object defined on 2 Second 128 simple metric defined on 26 base formula 25 Sin 331 single-value function 5 Sinh 331 Skew 375 Sln 305 Slope 375 sort by defined on 8 parameter 19 SortBy parameter 150 SQL engine 46 Sqrt 331 standard deviation moving 170. Inc. 537 .

Syd 305 T Tan 332 Tanh 333 Tbilleq 306 Tbillprice 307 Tbillyield 308 TDistribution 378 technical support xxviii © 2011 MicroStrategy. Inc. See technical support. 356 Intercept 358 InverseBetaDistribution 359 InverseChiDistribution 360 InverseFDistribution 361 InverseFisher 360 InverseGammaDistribution 362 InverseLognormalDistribution 362 InverseNormDistribution 363 InverseNormSDistribution 364 InverseTDistribution 365 Kurtosis 365 LognormalDistribution 366 MeanTTest 367 NegativeBinomialDistribution 368 NormalDistribution 369 PairedTTest 371 Pearson 371 Permut 372 PoissonDistribution 373 RSquare 374 Skew 375 Slope 375 Standardize 376 StandardNormalDistribution 377 SteYX 377 TDistribution 378 Trend 379 TrendV 380 VarTest 383 WeibullDistribution 384 StDev 112 StDevP 111 SteYX 377 string 538 from left 225 from right 230 string functions InitCap 224 LeftStr 225 Length 226 Lower 227 LTrim 228 Position 229 RightStr 230 RTrim 231 SubStr 232 Trim 233 Upper 234 SubStr 232 subtotal expression 41 accessing 42 subtotals user-defined 41 Sum 114 sum moving 173 OLAP 189 running 200 support international xxviii support.Index MicroStrategy Functions Reference Growth 352 GrowthV 353 HeteroscedasticTTest 355. . 356 HomoscedasticTTest 355.

MicroStrategy Functions Reference Index Times 236 totals user-defined subtotals 41 transformation expression accessing 43 Trend 379 TrendV 380 Trim 233 trim left 228 right 231 Trunc 333 Y Year 129 YearEndDate 130 YearStartDate 130 Yield 309 Yielddisc 311 Yieldmat 312 Z ZeroToNull 150 U Unary Minus 238 Upper 234 upper case 234 user-defined subtotals 41 V value first in range 153 last in range 160 Var 117 variable. Inc. See compound metric. 539 . variance of a population 115 of a sample 117 VarP 115 VarTest 383 Vdb 309 W Week 129 WeibullDistribution 384 window size 54 © 2011 MicroStrategy.

.Index MicroStrategy Functions Reference 540 © 2011 MicroStrategy. Inc.