Beruflich Dokumente
Kultur Dokumente
Informatica PowerCenter
(Version 8.0)
PowerCenter Data Analyzer Calculation and Function Reference Version 8.0 December 2005 Copyright 2001-2005 Informatica Corporation. All rights reserved. Printed in the USA. This software and documentation contain proprietary information of Informatica Corporation, and are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright law. Reverse engineering of the software is prohibited. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or otherwise) without the prior written consent of Informatica Corporation. Use, duplication, or disclosure of the Software by the U.S. Government is subject to the restrictions set forth in the applicable software license agreement and as provided in DFARS 227.7202-1(a) and 227.7702-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable. The information in this product or documentation is subject to change without notice. If you find any problems in the software or documentation, please report them to us in writing. Informatica Corporation does not warrant that this product or documentation is error free. Informatica, Data Analyzer, PowerMart, PowerCenter, PowerChannel, PowerCenter Connect, MX, and Metadata Manager are trademarks or registered trademarks of Informatica Corporation in the United States and in jurisdictions throughout the world. BEA and WebLogic are registered trademarks of BEA Systems, Inc. All other company and product names may be trade names or trademarks of their respective owners. U.S. Patent Pending. Portions of this software and/or documentation are subject to copyright held by third parties, including without limitation: Copyright Sun Microsystems. All rights reserved. Copyright 2001 BEA Systems, Inc. All rights reserved. Copyright IBM Corp. 2000, 2001. All rights reserved. Copyright 1991-2000 DataDirect Technologies, Inc. All rights reserved. Isomorphic SmartClient presentation layer 2002 Isomorphic Software, Inc. All rights reserved. Copyright Palm, Inc. All rights reserved. Copyright Research In Motion Limited. All rights reserved. Copyright Unisys. All rights reserved. Copyright GoAmerica Communications Corp. All rights reserved. Copyright Microsoft Corp. All rights reserved. Copyright 1998-1999 Aandacht c.v. All rights reserved. Copyright 2001-2004 Panscopic Corporation, Inc. All rights reserved. This product includes software developed by the Apache Software Foundation (http://www.apache.org/). The Apache Software is Copyright 1999-2004 The Apache Software Foundation. All rights reserved. The Qexo software included with this software is Copyright 1996-1999 Per Bothner. All Rights Reserved. Your right to use such software is set forth in a modified GNU Public License, which may be found at http://www.gnu.org/software/kawa/License.html. The software is provided free of charge by Informatica, as is, without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. InstallAnywhere is Copyright 2005 Zero G Software, Inc. All Rights Reserved. Portions of the Data Analyzer component contain copyrighted material from The JBoss Group, LLC. Your right to use such materials is set forth in the GNU Lesser General Public License Agreement, which may be found at http://www.opensource.org/licenses/lgpl-license.php. The JBoss materials are provided free of charge by Informatica, as is, without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. DISCLAIMER: Informatica Corporation provides this documentation as is without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of non-infringement, merchantability, or use for a particular purpose. The information provided in this documentation may include technical inaccuracies or typographical errors. Informatica could make improvements and/or changes in the products described in this documentation at any time without notice.
Table of Contents
List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
New Features and Enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Informatica Distributed Services Architecture . . . . . . . . . . . . . . . . . . . . xvi Command Line Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Data Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xviii Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xviii Integration Service (PowerCenter Server) . . . . . . . . . . . . . . . . . . . . . . .xix Globalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx Performance Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxi Transformation Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii Usability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii PowerCenter Data Analyzer (PowerAnalyzer) . . . . . . . . . . . . . . . . . . .xxiii PowerCenter Metadata Manager (SuperGlue) . . . . . . . . . . . . . . . . . . .xxiii PowerCenter Connect for IBM MQSeries . . . . . . . . . . . . . . . . . . . . . .xxiii PowerCenter Connect for SAP NetWeaver mySAP Option (PowerCenter Connect for SAP R/3) . . . . . . . . . . . . . . . . . . . . . . . . . xxiv PowerCenter Connect for SAP NetWeaver BW Option (PowerCenter Connect for SAP BW) . . . . . . . . . . . . . . . . . . . . . . . . . xxiv PowerCenter Repository Reports (PowerCenter Metadata Reporter) . . . xxv About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi Other Informatica Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii Visiting Informatica Customer Portal . . . . . . . . . . . . . . . . . . . . . . . . xxvii Visiting the Informatica Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii Visiting the Informatica Developer Network . . . . . . . . . . . . . . . . . . . xxvii Visiting the Informatica Knowledge Base . . . . . . . . . . . . . . . . . . . . . xxvii
iii
Chapter 4: Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Function Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Day Count Basis Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Supported Units of Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Abs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 AccrInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 AccrIntM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 AddToDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 AmorDegrC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 AmorLinC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 And . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 ArcCos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 ArcCosh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 ArcCot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 ArcCoth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 ArcCsc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 ArcCsch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 ArcSec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 ArcSech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 ArcSin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 ArcSinh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 ArcTan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 ArcTanh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 AveDev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Avg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 BinomDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 BinomInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Ceiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 ChiDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 ChiInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 ChiTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Clean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Concat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Confidence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Table of Contents
Correl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Cos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Cosh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Cot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Coth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 CountAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 CountUnique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 CoupDayBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 CoupDayS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 CoupDaySNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 CoupNCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 CoupNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 CoupPCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Covar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Csc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Csch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 CumIPmt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 CumPrinc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 DDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 DateString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 DateValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 DevSq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 DfToRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Disc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Divide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Effect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 ElapsedDays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 ElapsedHours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 ElapsedYears . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 EndOfMonth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Equals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 EqualsIgnoreCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 ExponDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 FDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
vi Table of Contents
FInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 FV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Fisher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 FisherInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Forecast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 GammaDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 GammaInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 GammaLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 GeoMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 GreaterThan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 GreaterThanEquals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 HarMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Hour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 HypGeomDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 IRR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 If . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 IfNull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 IntDivide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 IntRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Kurt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Len . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 LessThan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 LessThanEquals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Log10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Log2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Lower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Max2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Min2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Minute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Mod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Table of Contents vii
Month . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 MovingAvg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 MovingSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Multiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 NPV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 NPer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Negate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 NextDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Nominal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 NormDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 NormInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 NormSDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 NormSInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 NotEquals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Now . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 NumberString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 PV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Pearson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 PercentContribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Percentile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 PeriodsPerYear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Pmt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Previous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Price . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 PriceDisc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 PriceMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 RateToDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Received . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Rept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Round . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
viii Table of Contents
RoundDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 RoundUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 RunningAvg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 RunningSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 SLn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 SYD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Sec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Sech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Second . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Sin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Sinh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Skew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Slope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Sqrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Standardize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Stdev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 StdevP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Steyx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Substitute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 TBillEq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 TBillPrice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 TBillYield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 TDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 TInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 TTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Tan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Tanh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Today . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 TriMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Trim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Trunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Table of Contents ix
Upper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 VDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 ValueOf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 VarP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 WeekNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Weekday . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Weibull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Within . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 XIRR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 XNPV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Yield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 YieldDisc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 YieldMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 ZTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Table of Contents
List of Figures
Figure Figure Figure Figure 1-1. 1-2. 1-3. 1-4. Custom Metrics Page in Advanced Mode . . . . . . . Custom Aggregates Page . . . . . . . . . . . . . . . . . . . Calculated Metric Properties Page . . . . . . . . . . . . Create Custom Attribute Page in Advanced Mode . . . . . . . . .. .. .. .. . . . . . . . . .. .. .. .. . . . . . . . . .. .. .. .. . . . . .. .. .. .. . . . . . . . . .. .. .. .. . . . . .. .. .. .. . . . . . . . . . . . . 3 4 5 6
List of Figures
xi
xii
List of Figures
List of Tables
Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table 2-1. Expression Syntax . . . . . . . . . . . . . . . . . . . . . . 2-2. Operators in Expressions . . . . . . . . . . . . . . . . . 2-3. Arithmetic Operators in Expressions . . . . . . . . . 2-4. Comparison Operators in Expressions . . . . . . . . 2-5. Logical Operators in Expressions . . . . . . . . . . . 2-6. Date Format Letters in Data Analyzer Functions 3-1. Time Attributes Used in Setting Context . . . . . . 3-2. Keywords for Specifying the Context Argument . 4-1. Values of the DayCountBasis Argument . . . . . . 4-2. Arguments for the Units Function . . . . . . . . . . A-1. Functions in the Aggregate Category . . . . . . . . . A-2. Functions in the Boolean Category . . . . . . . . . . A-3. Functions in the Comparative Category . . . . . . A-4. Functions in the Conditional Category . . . . . . . A-5. Function in the Conversion Category . . . . . . . . A-6. Functions in the Date & Time Category . . . . . . A-7. Functions in the Fetch Category . . . . . . . . . . . . A-8. Functions in the Financial Category . . . . . . . . . A-9. Functions in the Mathematical Category . . . . . . A-10. Functions in the Rounding Category . . . . . . . A-11. Functions in the Running Category . . . . . . . . A-12. Functions in the Statistical Category . . . . . . . . A-13. Functions in the String Category . . . . . . . . . . A-14. Functions in the Trigonometric Category . . . . A-15. Functions in the Unary Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . 10 . 14 . 15 . 15 . 16 . 18 . 25 . 26 . 33 . 34 264 269 270 271 272 273 275 276 282 283 284 285 289 291 293
List of Tables
xiii
xiv
List of Tables
Preface
Welcome to PowerCenter, the Informatica software product that delivers an open, scalable data integration solution addressing the complete life cycle for all data integration projects including data warehouses, data migration, data synchronization, and information hubs. PowerCenter combines the latest technology enhancements for reliably managing data repositories and delivering information resources in a timely, usable, and efficient manner. The PowerCenter repository coordinates and drives a variety of core functions, including extracting, transforming, loading, and managing data. The Integration Service can extract large volumes of data from multiple platforms, handle complex transformations on the data, and support high-speed loads. PowerCenter can simplify and accelerate the process of building a comprehensive data warehouse from disparate data sources.
xv
Informatica Distributed Services Architecture, xvi Command Line Programs, xvii Datatypes, xvii Data Profiling, xvii Documentation, xviii Installation, xviii Integration Service (PowerCenter Server), xix Globalization, xx Performance Improvements, xx Repository, xxi Transformation Language, xxii Transformations, xxii XML, xxii Usability, xxiii PowerCenter Data Analyzer (PowerAnalyzer), xxiii PowerCenter Metadata Manager (SuperGlue), xxiii PowerCenter Connect for IBM MQSeries, xxiii PowerCenter Connect for SAP NetWeaver mySAP Option (PowerCenter Connect for SAP R/3), xxiv PowerCenter Connect for SAP NetWeaver BW Option (PowerCenter Connect for SAP BW), xxiv PowerCenter Repository Reports (PowerCenter Metadata Reporter), xxv
Domains and nodes. PowerCenter 8.0 allows you to scale services and share resources across multiple machines. PowerCenter introduces a PowerCenter domain, the primary unit of administration for the PowerCenter environment, and a PowerCenter node, the logical representation of a machine in a domain. Services. PowerCenter provides application and core services. Application services represent PowerCenter server-based functionality such as the Repository Service, Integration Service, and SAP BW Service. Core services support the domain and application services. Core services include a Log Service, Licensing Service, and Domain Service.
xvi
Preface
High availability. You can use the high availability option to eliminate single points of failure in the PowerCenter environment and reduce service interruptions in the event of failure. High availability provides resilience, failover, and recovery for services. Administration. PowerCenter provides centralized administration through the Administration Console. You perform all administration tasks for the domain and services in the Administration Console. This includes administration of the Repository Service. Authentication Service. PowerCenter uses the Authentication Service to authenticate users for the Administration Console and the repository. For repository authentication, you can use LDAP or native authentication. To use LDAP authentication, you configure authentication at the domain level and register the module with each repository you want to use LDAP authentication. Licensing Service. PowerCenter uses the Licensing Service to enable features, such as PowerCenter options and connectivity. You assign each application service to a license to enable the service. Log Service. The Log Service is a core service of the PowerCenter domain. It captures log events for all services within the domain. Log types include domain, services, workflows, and sessions. You can view logs in the Administration Console and in the Workflow Monitor.
infacmd. infacmd is a new command line program that allows you to administer PowerCenter domains and services. You can perform tasks such as enabling and disabling services and purging log events. infasetup. infasetup is a new command line program that allows you to configure domains and nodes. Use infasetup to define domains and nodes, join domains, and configure node passwords, domain licenses, and domain service ports. pmcmd. pmcmd includes new commands to support Integration Service functionality and new syntax to connect to a domain. pmrep. pmrep now includes former pmrepagent commands and new syntax to connect to a domain.
Datatypes
Flat file definitions. You can configure flat file definitions to use the Integer or Double datatype.
Data Profiling
Functional Dependencies Analysis function. You can use the Functional Dependencies Analysis function to determine exact and approximate dependencies between columns in a source.
Preface
xvii
Inter-Source Structure Analysis function. You can use the Inter-Source Structure Inference function to determine primary key-foreign key relationships among multiple sources. Candidate key and redundancy column analysis. Data Profiling can return column sets of up to seven columns for candidate key and redundancy analysis. Also, the column precision to evaluate candidate keys and analyze redundancies is increased. Domain Inference function. The Domain Inference function can infer the source datatype and categories of inferred patterns. Data Profiling reports show results for the new types of data in this function. Column Lookup domain. You can use a flat file or relational source column as a domain. Multiple join columns. You can specify up to six join conditions in the Referential Integrity Analysis and Join Complexity Evaluation functions. Reporting. Data Profiling provides reporting enhancements such as improved paging capabilities and a consistent layout between custom profile reports and auto profile reports. In reports for the column-level Business Rule Validation function, you can click the Drill Down link on the Verbose Report Summary to view the source rows.
Documentation
PowerCenter documentation includes the following new books:
Administrator Guide. Provides information for administrators to manage the domain and services. Command Line Reference. Provides syntax and description for infacmd, infasetup, pmcmd, and pmrep. Performance Tuning Guide. Provides information about tuning the performance in PowerCenter. Upgrade Guide. Provides information about new and changed functionality in PowerCenter, including tasks that you might need to perform after upgrading to a new version.
Installation
Installation packaging. The PowerCenter installation DVD installs Informatica Distributed Services and the PowerCenter Client. PowerCenter also includes a documentation CD that you can use to install PowerCenter documentation. PowerCenter Editions. Based on the license you have, you can install PowerCenter Standard Edition or PowerCenter Advanced Edition. Configuration. The installation program can create a domain, add a node to an existing domain, and create a Repository Service and Integration Service. For PowerCenter Services, Data Analyzer, and Metadata Manager, you can use an existing repository or create a new repository. It also provides configuration options.
xviii
Preface
Upgrade. You can manually upgrade an existing PowerCenter Server or Repository Agent to an Integration Service or Repository Service.
Service-oriented architecture. The Integration Service replaces the PowerCenter Server. If you have the high availability option, you can configure the Integration Service to fail over to another node if the current node becomes unavailable. Load Balancer. The Load Balancer dispatches tasks. If you run tasks on a grid, the Load Balancer dispatches Session and Command tasks to nodes that can run the tasks. Resources. PowerCenter requires resources to run tasks. Resources can include plug-ins, connection objects, file directories, and shared libraries. You define resources for nodes and tasks. The Load Balancer dispatches tasks to nodes where the resources are available. Grid object. The server grid is updated to incorporate a grid object into the PowerCenter domain. You create a grid object in the Administration Console, and you assign one or more nodes to run on the grid. Run workflow on a grid. You can configure a workflow to run on an Integration Service associated with the grid. When you run a workflow on a grid, the Integration Service distributes the workflow tasks to available nodes. Run session on a grid. You can configure a session to run on a grid if the parent workflow is associated with a grid. When you run a session on a grid, the Integration Service distributes reader, writer, and transformation threads to available nodes.
Partitioning
Database partitioning. You can use the database partitioning partition type with Oracle and DB2 sources. Dynamic partitioning. The Integration Service can determine the number of partitions at run time based on the dynamic partitioning session property.
FTP
Partitioned FTP file targets. For partitioned target instances, the Integration Service writes to a remote merge file. For merged targets, the Integration Service creates a local merge file and transfers the merge file to the FTP host. Indirect FTP file sources. You can use an indirect file list for a flat file source instance located on a remote machine.
Recovery
Workflow recovery. If you have high availability, you can recover an interrupted workflow in the Workflow Manager or Workflow Monitor. When you recover a workflow, the
Preface xix
Integration Service attempts to complete the original workflow run. The Integration Service restores the last good state of the workflow and restarts or resumes the interrupted tasks.
Session task recovery. You can configure the recovery strategy to recover an interrupted session in a workflow. You can choose to resume, restart, or skip the Session task. When you recover the workflow, the Integration Service uses the recovery strategy to recover the session. Command task recovery. You can configure the recovery strategy to restart or skip the Command task when you recover a workflow.
Environment SQL
Transaction environment SQL. You can use transaction environment SQL to execute an SQL statement at the beginning of each transaction. This is in addition to the current connection environment SQL that executes each time the Integration Service connects to the database.
Globalization
Unicode repository. PowerCenter now supports a Unicode repository. You can choose the UTF-8 character set as the repository code page to store metadata from multiple languages. Code page validation. With expanded support for Unicode, PowerCenter code page validation rules are now less restrictive.
Performance Improvements
Pushdown optimization. The Integration Service can execute SQL against the source or target database instead of processing the transformation logic within the Integration Service. Partitioned flat file targets. The Integration Service can create an individual target file for all partitions, a merge file for all partitioned flat file target instances, and a file list that references the individual target files for all target partitions. Append to flat file targets. The Integration Service can append data to existing flat file target and reject files. Flat file source and target commands. You can specify a command for any flat file source or target instance in a session. You can use a command to generate source data and you can use a command to process target data. Data compression. Repository data is compressed during communication among the Repository Service, Integration Service, and PowerCenter Client.
xx
Preface
Repository
This section describes changes to the repository functionality.
Administration
Administration tool. You use the browser-based PowerCenter Administration Console to perform administrative tasks that were formerly done in the Repository Server Administration Console.
Architecture
Service-oriented architecture. In the Informatica distributed services architecture, each Repository Service manages a single repository. A Repository Service process is an instance of the Repository Service running on a particular node. If you have the high availability option, you can configure the Repository Service to fail over to another node if the current node becomes unavailable.
Additional import/export functionality. You can use the Meta Integration Model Bridge from Meta Integration Technology, Inc. to exchange data with the following business intelligence and data modeling tools:
CA AllFusion ERwin Data Modeler 4.x CA ERwin 3.x (ERX) and CA ERwin 3.5x (export only) Embarcadero ER/Studio Oracle Designer Sybase PowerDesigner
Object Queries
Non-versioned repositories. You can create and run queries against repositories that are not enabled for versioning. Label parameter. The following operators are added to the label parameter: Contains, Does Not Contain, Starts With, Does Not Start With, Ends With, and Does Not End With.
Versioned Objects
Checking out and checking in objects. You can explicitly check out versioned repository objects. You can view checked-in objects in the workspace. Viewing older versions of objects. You can view older versions of objects in the workspace.
Preface
xxi
Deployment
Assign owner and group to a folder. You can assign an owner and owner group when you copy a folder or deployment group. Generate a deployment control file. You can generate a deployment control file when you copy a folder or deployment group with the Copy Wizard.
Security
Extended repository privileges. You can assign additional extended repository privileges to manage repository objects. Privileges include Manage Connection, Manage Label, and Manage Folder.
Transformation Language
User-defined functions. You can create user-defined functions in the Designer to use in transformations and workflow tasks. You can include the functions in expressions or other user-defined functions. Custom Functions SDK. You can develop functions written in C Language and integrate them using a set of API calls that come with PowerCenter. You can include the functions in mapping and workflow expressions. New functions. The transformation language has 23 new built-in functions such as COMPRESS, DECOMPRESS, and REVERSE.
Transformations
Procedures with thread-specific operations. You can include thread-specific operations in Custom transformation procedures and configure the transformation to process each partition using one thread. Partitioning enhancements. You can partition a Custom transformation or any transformation created from a Custom transformation locally or across a grid. Java and C++ API. You can use Java and C++ to create the Custom transformation procedures. You can use the new API to access data in block mode and perform datatype conversions at the column level.
Java transformation. You can use the Java transformation to create, compile, and debug Java code snippets that execute in-line Java code in the mapping. You can also use Java to call expressions in a Java transformation.
XML
Filter data with query predicate. You can filter XML source data in a session by including an XPath query predicate in an XML definition. You can use string, numeric, and boolean XPath functions to filter source data.
xxii
Preface
Create a default namespace. You can use a default namespace to eliminate the namespace prefix in an XML target. Import part of an XML schema. You can import part of an XML schema when you import an XML file that uses the schema, but only contains some of the schema components. Use anySimpleType. You can import an XML schema that contains anySimpleType elements.
Usability
Propagate port description. In the Designer, you can edit a port description and propagate the description to other transformations in the mapping. Link ports in the workspace. In the Designer, you can link ports by dragging all ports from one mapping object to another mapping object in the workspace. Show background in iconic view. In the Designer and Workflow Manager, you can enable background colors for objects in iconic view.
SuperGlue renamed. SuperGlue is renamed PowerCenter Metadata Manager. 64-bit operating systems. Metadata Manager supports 64-bit operating systems. XConnects. The PowerCenter XConnect extracts additional metadata from the PowerCenter repository. PowerCenter XConnects now support parameterized connections, and data lineage is displayed for these connections. Data lineage diagrams. Data lineage diagrams display the following information:
If the container of the data structure or transformation box is different from the actual parent, the actual parent name of the data structure or transformation displays in the lineage diagram. Stored procedures are displayed as object structures. Public synonyms are displayed for all database tables across domains.
Metadata Manager Configuration Console. Metadata Manager Configuration Console now works on the PowerCenter 8.0 platform. You can now register multiple source repository instances under the corresponding repository type.
Improved real-time performance. The Integration Service can now commit source messages to the target at the end of a millisecond flush latency period. By default, the
Preface xxiii
integer n in the FlushLatency(n) function represents seconds. However, you can configure an MQSeries session to change the value to milliseconds.
PowerCenter Connect for SAP NetWeaver mySAP Option (PowerCenter Connect for SAP R/3)
PowerCenter Connect for SAP R/3 renamed. PowerCenter Connect for SAP R/3 is renamed PowerCenter Connect for SAP NetWeaver mySAP Option. Improved performance. The Integration Service creates caches in memory for sessions for inbound IDoc mappings or DMI mappings. You can configure the total cache size and cache directory. Outbound IDoc syntax validation. You can configure an outbound IDoc session to check for invalid IDocs and write them to a relational or flat file target. Mandatory segments and groups in IDoc and DMI mappings. In the SAP/ALE IDoc Prepare transformation, SAP/ALE IDoc Interpreter transformation, and SAP DMI Prepare transformation, you can view mandatory segments and groups to help you understand which segments the transformations require in the IDoc or DMI message. Scheduling Business Content Integration. The listener workflow controls the scheduling of the processing workflows. The listener workflow receives DataSource data from SAP, loads the data to staging targets, and then starts the appropriate processing workflow for the received data.
PowerCenter Connect for SAP NetWeaver BW Option (PowerCenter Connect for SAP BW)
PowerCenter Connect for SAP BW renamed. PowerCenter Connect for SAP BW is renamed PowerCenter Connect for SAP NetWeaver BW Option. PowerCenter Integration Server for SAP BW (PCISBW) renamed. PowerCenter Integration Server for SAP BW is renamed to SAP BW Service. Loading by packet size. PowerCenter Connect for SAP NetWeaver BW Option loads BW data as a packet based on the packet size value you set in the session. Load balancing. To support load balancing, the SAP BW Service records the BW host requesting data from PowerCenter. The Integration Service loads the data to the same requesting host. Process chains to load into SAP BW. You can create a BW Process chain to start a PowerCenter workflow that loads data into SAP BW. Improved logging. The SAP BW Service can capture messages from SAP BW when you run a BW session. You can view these log events in the PowerCenter Administration Console or in the SAP BW monitor. Recovery. You can enable a BW session for recovery. If the session fails, you can restart it in the Workflow Manager.
xxiv
Preface
PowerCenter Metadata Reporter renamed. PowerCenter Metadata Reporter is renamed PowerCenter Repository Reports. Server Grid List report. The Server Grid List report is replaced with the following reports:
Integration Service List. Displays a list of all Integration Services that run on the grids and nodes configured in PowerCenter. Repository Information. Displays a list of all Repository Services that run on nodes configured in PowerCenter. It also provides information about whether a node is a primary node or a backup node.
Metadata Extensions Usage report. The Metadata Extensions Usage report is replaced with the following reports:
Metadata Extensions Usage (Mapping and Mapplet). Displays a list of all reusable metadata extensions. The report is organized by repository and folder and shows the number of mappings or mapplets that use each metadata extension. Metadata Extensions Usage (Source, Target and Transformation). Displays a list of all reusable metadata extensions. The report is organized by repository and folder and shows the number of sources, targets, or transformations that use each metadata extension. Metadata Extensions Usage (Workflow, Worklet and Session). Displays a list of all reusable metadata extensions. The report is organized by repository and folder and shows the number of workflows, worklets, or sessions that use each metadata extension.
Preface
xxv
Document Conventions
This guide uses the following formatting conventions:
If you see It means The word or set of words are especially emphasized. Emphasized subjects. This is the variable name for a value you enter as part of an operating system command. This is generic text that should be replaced with user-supplied values. The following paragraph provides additional facts. The following paragraph provides suggested uses. The following paragraph notes situations where you can overwrite or corrupt data, unless you follow the specified procedure. This is a code example. This is an operating system command you enter from a prompt to run a task.
xxvi
Preface
Informatica Customer Portal Informatica web site Informatica Developer Network Informatica Knowledge Base Informatica Technical Support
Preface
xxvii
support@informatica.com for technical inquiries support_admin@informatica.com for general customer service requests
WebSupport requires a user name and password. You can request a user name and password at http://my.informatica.com.
North America / South America Informatica Corporation Headquarters 100 Cardinal Way Redwood City, California 94063 United States Europe / Middle East / Africa Informatica Software Ltd. 6 Waltham Park Waltham Road, White Waltham Maidenhead, Berkshire SL6 3TN United Kingdom Asia / Australia Informatica Business Solutions Pvt. Ltd. Diamond District Tower B, 3rd Floor 150 Airport Road Bangalore 560 008 India Toll Free Australia: 00 11 800 4632 4357 Singapore: 001 800 4632 4357 Standard Rate India: +91 80 51889000
Standard Rate Belgium: +32 15 281 702 France: +33 1 41 38 92 26 Germany: +49 1805 702 702 Netherlands: +31 306 022 797 United Kingdom: +44 1628 511 445
xxviii
Preface
Chapter 1
Overview
You can perform advanced calculations on metric and attribute data, such as rounding values or calculating the sum of specific metric values in a column. To perform an advanced calculation, you must write a mathematical expression that modifies data and returns a result. An expression can include any combination of the following components:
The following custom metric expression uses some of the preceding components:
ROUND({Revenue},1) + ABS({Sales Qty})/SUM({Cost})
Metrics: Revenue, Cost, and Sales Qty Functions: ROUND(), ABS(), and SUM() Operators: / and +
Types of Calculations
You can write expressions to create the following calculations:
For more information about custom metrics, see Adding Calculations to a Report in the Data Analyzer User Guide.
Types of Calculations
For more information about custom aggregates, see Adding Calculations to a Report in the Data Analyzer User Guide.
Figure 1-3 shows the Calculated Metric Properties page where you can create calculated metric expressions:
Figure 1-3. Calculated Metric Properties Page
For more information about calculated metrics, see Working with Calculated Metrics in the Data Analyzer Schema Designer Guide.
Types of Calculations
Figure 1-4 shows the Custom Attributes page, in advanced mode, where you can enter the custom attribute expression:
Figure 1-4. Create Custom Attribute Page in Advanced Mode
For more information about custom attributes you can create for a report, see Working with Metrics and Attributes in the Data Analyzer User Guide. For more information about custom attributes you can create in the Schema Directory, see Managing the Schema Directory in the Data Analyzer Schema Designer Guide.
Sales Price has a precision of two, while .2586 has a precision of four. The value of the custom metric is 403.1186, with a precision of four. If none of the values in the expression has a precision of two or more, the custom metric or custom aggregate has two as the default precision. Calculations that involve multiplication and division may result in higher precision than the values included in the operation. For example, you have the metric Sales Price with a value of 402.86 in the custom metric expression:
{Sale Price} *.258)
Sales Price has a precision of two, while .258 has a precision of three. The result of the calculation is 103.9379. Data Analyzer uses the precision of the value with the highest precision. Data Analyzer rounds the value to the highest precision in the expression. Therefore, the value of the custom metric is 103.938.
Currency Decimals
Certain financial functions return a monetary value. For example, the CumIPmt function returns the cumulative interest paid for a loan between two specified periods of time. When you use a function that returns a monetary value, you can enter a value for the currency digits to the right of the decimal point. The value you enter overrides the precision of the return value. Data Analyzer rounds the return value to the specified value for the currency digits.
Chapter 2
Expression Syntax
This chapter includes the following topics:
Overview
When you write an expression, use the correct syntax and write a valid mathematical expression. Although Data Analyzer provides syntax validation, you must enter valid values in the expression.
Syntax Rule
{Sales}
When a metric or attribute name occurs more than once in the repository, clarify which to use with the folder name and a pipe, as follows:
{folder_name|metric_name}
{Sales|Sales}
Note: Unnecessary use of the pipe may produce unexpected results. Use parentheses to define the order of execution. Data Analyzer evaluates the innermost set of parentheses before proceeding to the next. Surround arguments in parentheses as follows: function(argument). When using a metric or attribute, also use curly brackets: function({metric_name}). When you pass an optional argument to a function, you must also pass any other optional arguments that occur ahead of it in the function syntax. Data Analyzer does not support nested statistical functions. To find the sum, then the product: (6*(4+8))
ABS({Profit})
For the AmorDegrC function, if you pass the CurrencyDecimals argument, you must also pass the DayCountBasis argument. The following functions are not supported:
STDEV(ABS({Sales Qty})) VAR(ROUND({Sales Qty},2))
Nulls
NULL indicates that a value is either unknown or undefined. NULL is not equivalent to a blank or empty string (for character columns) or zero (for numerical columns). If any metric used in the expression has a null value, the expression returns NULL. For example if a custom metric has the expression:
({Sale Price} - ({Sale Price} * .25)) - {Product Price}
10
and the value of Product Price is NULL, the value of the custom metric is NULL.
if any of the sale price values is NULL, Data Analyzer ignores that value when calculating the average sale price. If you pass an entire row or column of null values, the function returns NULL. For more information about how specific functions handle null values, see Functions on page 31.
Overview
11
Function Syntax
A function manipulates values that you pass to it and returns a result. For example, you might use the Avg function to calculate the average salary of all your employees, or the Sum function to calculate the total sales for a set of metric values. The values you pass to a function are known as arguments. Data Analyzer uses the following syntax for a function in an expression:
function name(argument1, argument2 ...)
You can also pass optional arguments to many functions. Optional arguments display within square brackets ([ ]) in the syntax:
function name(argument1, argument2 ...[, argument x, argument y ...])
When you enter the function in the expression text box, do not enter the square brackets. Depending on the function, an argument takes any of the following values:
Metric name Attribute name Variable String literal Numeric literal Date value
Certain functions take the Context argument. The Context argument is a special type of argument that sets the scope for a function. For more information about the Context argument, see Setting the Context for a Function on page 21. Data Analyzer provides a point-and-click interface for all functions to help you enter expressions. To minimize syntax errors, use the point-and-click method to enter expressions. When you point and click instead of manually entering the expression, Data Analyzer supplies any necessary additional characters, such as brackets and pipes. When you use the point-and-click method to add a function to the expression, Data Analyzer displays the names of the required arguments in the expression. You can replace the argument names with the values you want to pass to the function. You can also enter values for any optional argument you want to pass to the function.
12
Constants
Use the following constants anywhere in an expression:
E. E is a mathematical constant that is the base of the natural logarithm. The value of E is equal to 2.718281828459. Use the E constant to calculate the natural logarithm of a numeric value. For example, you have an expression that returns the straight-line depreciation of an asset for one year. You want to calculate the natural logarithm of the depreciation of the asset in each year. Use the following expression where, the cost of the asset is $1,000, salvage value is $175, and the life of the asset is 8 years:
SLn(1000, 175, 8)*E
PI. PI is a real number that is used in many mathematical calculations. The value of PI is equal to 3.14159265359. Use the PI variable in trigonometric functions to covert radians to degrees or degrees to radians. For example, the following expression returns 0.707 radians as the cosine of 45 degrees:
Cos(45*PI/180)
FALSE TRUE
TRUE and FALSE are logical values that determine the form of the function in which they are being used. For example, in the BinomDist function, you can use TRUE or FALSE as the value of the Cumulative argument. If Cumulative is TRUE, the function returns the cumulative binomial distribution; otherwise it does not return the cumulative binomial distribution.
Note: The constants are not case sensitive. For example, within an expression, PI is the same as
pi.
Constants
13
Operators
Data Analyzer supports the use of multiple operators and the use of operators within nested expressions. If you write an expression that includes multiple operators, Data Analyzer evaluates the expression in the following order: 1. 2. 3. Arithmetic operators Comparison operators Logical operators
Data Analyzer evaluates operators in the order they appear in the following table. It evaluates operators in an expression with equal precedence to all operators from left to right. Table 2-2 lists the precedence for all operators:
Table 2-2. Operators in Expressions Operator () +, ^ *, /, % +, <, <=, >, >= =, <> ! & | Meaning Parentheses Unary plus and minus Power Multiplication, division, modulus Addition, subtraction Less than, less than or equal to, greater than, greater than or equal to Equal to, not equal to Logical NOT operator Logical AND operator, used when specifying conditions Logical OR operator, used when specifying conditions
You can also use operators within nested expressions. When expressions contain parentheses, Data Analyzer evaluates operations inside parentheses before operations outside parentheses. Operations in the innermost parentheses are evaluated first. For example, depending on how you nest the operations, the equation 8 + 5 - 2 * 8 returns different values:
Equation 8+5-2*8 8 + (5 - 2) * 8 Return Value -3 32
14
Arithmetic Operators
Use arithmetic operators to perform mathematical calculations on numeric data. Table 2-3 lists the arithmetic operators, in order of precedence, you can use in expressions:
Table 2-3. Arithmetic Operators in Expressions Operator +, ^, *, /, % +, Meaning Unary plus, unary minus. Unary plus indicates a positive value. Unary minus indicates a negative value. Power, multiplication, division, modulus. A modulus is the remainder after dividing two integers. For example, 13 % 2 = 1 because 13 divided by 2 equals 6 with a remainder of 1. Addition, subtraction. The addition operator (+) does not concatenate strings. To concatenate strings, use the Concat function. To perform arithmetic on date values, use the date functions.
If you perform arithmetic on a null value, the function returns NULL. When you use arithmetic operators in an expression, all of the operands in the expression must be numeric. For example, the expression 1 + 1 is not valid because it adds an integer to a string. The expression 1.23 + 4 / 2 is valid because all of the operands are numeric.
Note: Data Analyzer provides Date and Time functions that let you perform arithmetic on
date/time values. For further information on built-in date functions, see Dates on page 17.
Comparison Operators
Use comparison operators to compare character or numeric strings, manipulate data, and return a TRUE (1) or FALSE (0) value. Table 2-4 lists the comparison operators you can use in expressions:
Table 2-4. Comparison Operators in Expressions Operator = > < >= <= <> Meaning Equal to Greater than Less than Greater than or equal to Less than or equal to Not equal to
When you use comparison operators in an expression, the operands must be the same datatype. For example, the expression 123.4 > 123 is not valid because the expression compares a numeric value with a string. The expressions 123.4 > 123 and a <> b are valid because the operands are the same datatype.
Operators
15
If you compare a value to a null value, the result is NULL. For information on how to compare dates, see Dates on page 17.
Logical Operators
Use logical operators to manipulate numeric data. Expressions that return a numeric value evaluate to TRUE for non-zero values, FALSE for zero, and NULL for NULL. Table 2-5 lists the logical operators you can use in expressions:
Table 2-5. Logical Operators in Expressions Operator ! Equivalent SQL Operator NOT Meaning Negates result of an expression. For example, if an expression evaluates to TRUE, the ! operator returns FALSE. If an expression evaluates to FALSE, the ! operator returns TRUE. Joins two conditions and returns TRUE if both conditions evaluate to TRUE. Returns FALSE if one condition is not true. Connects two conditions and returns TRUE if any condition evaluates to TRUE. Returns FALSE if both conditions are not true.
& |
AND OR
Expressions that combine a null value with a Boolean expression produce results that are ANSI-compliant. For example, Data Analyzer produces the following results:
16
Dates
Data Analyzer provides Date and Time functions that help you perform calculations on dates. With the Date and Time functions you can round, truncate, or compare dates, extract one part of a date, or perform arithmetic on a date. For information on each function, see Functions on page 31. In addition to Date and Time functions, other functions also take dates as arguments. For example, financial functions AccrInt and AccrIntM take date arguments. As a value for a date argument, you can pass a date in one of the following ways:
Pass a date attribute. A date attribute contains date values that are recognized by Data Analyzer functions. You do not need to manipulate the date attribute values before passing them to a function. The following expression is an example of a function that takes date arguments. Begin Date and End Date are date attributes:
ElapsedDays({Begin Date}, {End Date})
Enter a date by using another function that generates a date. Functions that generate a date are Date, DateValue, EndOfMonth, Today, NextDate, and AddToDate. The following expression is an example of a function that takes date arguments. The expression uses the DateValue function to enter dates for the Disc function:
Disc(DateValue("4/1/2004"), DateValue("6/15/2004"), 95, 100)
You cannot directly enter a date string as the value for a date argument. For example, the following expression is invalid:
Disc("4/1/2004", "6/15/2004", 95, 100)
For more information about function usage and syntax, see Functions on page 31.
Calendar
Data Analyzer supports dates in the Gregorian calendar system only. Dates expressed in a different calendar system are not supported. Data Analyzer recognizes leap years and accepts any date in the Gregorian calendar.
Dates
17
DateString. The DateString function creates a string, when you provide date and format values. Use the DateFormat argument to provide the function information about the date you are passing. For example, the following expression returns the string 2003-Jan-13 AD:
DateString(date(2003, 01, 13), yyyy-MMM-dd G)
DateValue. The DateValue function creates a date, when you provide a date string value. Use the DateFormat argument to pass a date string in a format that is unrecognized by the function. For example, the following expression returns the date for 13th day of January, 2003 AD:
DateValue("13/January/2003 AD", "dd/MMMM/yyyy G")
w W D d E a
18
Table 2-6. Date Format Letters in Data Analyzer Functions Format Letter H h m s S z Description Hour of day (0 to 23), where zero is 12 AM (midnight). Hour number in AM or PM (1 to 12). Minute number in hour. Second portion of date. Millisecond portion of date. Time zone, returned as text. Examples H and HH return 16. hh returns 4. hh returns 04. m and mm returns 35. s returns 0. ss returns 00. S returns 000. z returns PMT.
Note: You must use the correct case for the format letters you use in your expressions. Data
Analyzer does not validate the case of the format letters you use in an expression. For example, if you use mm instead of MM to specify the month portion of a date, you might see incorrect data in your report.
Dates
19
20
Chapter 3
Overview, 22 Types of Context, 23 Syntax for the Context Argument, 24 Setting the Context for Functions of Running Category, 29
21
Overview
You can use the Context argument with functions such as Count and Covar. When you create a custom metric or custom aggregate expression, you can use the Context argument as a filter condition to set a scope for the function. The function performs the calculation on only those values for which the condition is true. Use the context argument to create a flexible expression by performing the calculation on a set of attribute values. For example, you have a report that displays the Sales Person and Region attributes and the Sales metric. To find out the total number of sales persons, use the Count function and pass a metric or attribute name as the value of the List argument:
Count(List [,Context])
To find out how many sales persons are from the Northern region, use the following syntax to pass a value for the Context argument:
Count({Sales Person}, "{Region}='Northern'")
The preceding expression counts the number of values in the Sales Person attribute for the Northern region.
Note: You cannot use the Context argument when using functions to create a calculated metric
expression.
22
Types of Context
Context can be one of the following types:
Layout Context
Use layout context to perform the calculation on rows, columns, or sections in the report. Use layout keywords to set the layout context. For example, you can use the ROW keyword to perform the Sum calculation on each row in a report. For more information about layout keywords, see Keywords on page 26. When you use a layout context in a custom metric expression, the custom metric is known as a layout-dependent custom metric. You cannot create filters or set rankings for layoutdependent metric calculations. For more information about layout-dependent metric calculations, see Adding Calculations to a Report in the Data Analyzer User Guide.
Value Context
Use value context to perform the calculation on specified attribute values. Use attributes and value keywords to set the value context. For example, you can use the THIS keyword to get the value of an attribute for the current row. For more information about value keywords, see Keywords on page 26.
Types of Context
23
The above expression calculates the total of all Sales values where the State attribute value is either CA or AZ.
Separators
Use the comma (,) symbol to separate multiple values within a condition. For example:
Avg({Sales}, {Category}=Food, Drinks, Supplies)
You can include multiple conditions within the Context argument. Use the semicolon (;) symbol to separate multiple conditions. For example:
Sum({Sales}, {State}=CA;{Category}=Food)
Attributes
Use attribute names and attribute values to set the value context. Use attribute names that are part of the report. Use the point-and-click interface to add attribute names and attribute values to the expression. If you manually enter the attribute names in the expression, you must enclose attribute names within curly brackets ({}). For reports with time settings, you can use time attributes as keywords when you set the value of the Context argument. Time attributes allow you to track time periods in reports. Your Data Analyzer system administrator must set up the time attributes in the time dimension table before you can use them in your expressions. For more information about setting
24
calendar attributes, see Working with Time Dimensions in the Data Analyzer Schema Designer Guide. For reports with time settings, you can select the applicable time attributes for an expression. Applicable time attributes are the attributes that represent the time period selected for the report and any other time period of a higher granularity. For example, for a report for the Current Quarter, you can select QUARTER_NUM or YEAR_NUM time attributes for your expression. Use the point-and-click interface to add the time attribute name and attribute values to the expression. If you manually enter the time attribute name in the expression, you must enter the at (@) symbol before the time attribute name. Table 3-1 lists the time attributes that you can use when passing the Context argument:
Table 3-1. Time Attributes Used in Setting Context Time Attribute Name HOUR_NUM Meaning Refers to the hour number in day. Example To calculate the total sales made between 10:00 and 11:00 am, use the following expression:
Sum({Sales}, {@HOUR_NUM}=10)
YEAR_DAY_NUM
To calculate the total sales made on the first day of the year, use the following expression:
Sum({Sales}, {@YEAR_DAY_NUM}=1)
YEAR_WEEK_NUM
To calculate the total sales made in the fourth week of the year, use the following expression:
Sum({Sales}, {@YEAR_WEEK_NUM}=4)
YEAR_MONTH_NUM
To calculate the total sales made in the month of June, use the following expression:
Sum({Sales}, {@YEAR_MONTH_NUM}=6)
QUARTER_NUM
To calculate the average sales made in the first quarter, use the following expression:
Avg({Sales}, {@QUARTER_NUM}=1)
To calculate the average sales made in the current quarter, use the following expression:
Avg({Sales}, {@QUARTER_NUM}=CURRENT)
YEAR_NUM
To calculate the total sales made in 2003, use the following expression:
Sum({Sales}, {@YEAR_NUM}=2003)
25
Table 3-1. Time Attributes Used in Setting Context Time Attribute Name DATE_TIME Meaning Refers to the date and time values. In the expression, the value of the DATE_TIME time attribute must be in the following format: yyyy-MM-dd HH:mm:ss Note: The above is the ISO date format. Refers to the date value. In the expression, the value of the DATE_NO_TIME time attribute must be in the following format: yyyy-MM-dd Note: The above is the ISO date format. Example To calculate the total sales made on February 14, 2004 at 11:00 am, use the following expression:
Sum({Sales}, {@DATE_TIME}=2004-0214 11:00:00)
DATE_NO_TIME
To calculate the total sales made on February 14, 2004, use the following expression:
Sum({Sales}, {@DATE_TIME}=2004-0214)
Keywords
Use the following types of keywords in expressions to set the value of the Context argument:
Layout keywords. Allow you to set the layout context. For more information about the layout context, see Layout Context on page 23. Value keywords. Allow you to set the value context. For more information about the value context, see Value Context on page 23.
Use the point-and-click interface to add keywords to the expression. If you manually enter the keywords in the expression, you must enter the keywords in uppercase letters. You must enter the at (@) symbol before the layout keywords.
Note: You cannot use layout keywords with numeric attributes.
ROW
Layout
You have a report that displays as a cross tabular report table. The report displays the Sales for each product category for each state. Category is the column attribute and State is the row attribute. To calculate the sum for the Sales values for each row, use the following expression:
Sum({Sales}, @ROW)
26
Table 3-2. Keywords for Specifying the Context Argument Keyword SECTION Type of Keyword Layout Meaning Refers to all the section attributes. Use SECTION in reports with sectional report tables. Example You have a report that displays as a sectional report table. The report displays the Sales for each product category by region. Region is the section attribute and Category is the row attribute. To calculate the sum for the Sales values for each section, use the following expression:
Sum({Sales}, @SECTION)
THIS
Value
Refers to a value at the current position in the processing of the function. You cannot use THIS in a custom aggregate expression. Refers to the current calendar. Use this keyword in reports with time settings. You cannot use CURRENT in a report with time settings that displays Hour by Hour granularity. Checks whether a value is NULL.
You have a report that displays the sales for each state and each category. State and Category are row attributes. To calculate what percent of sales for each row contributed to the total sales for that state, use the following expression:
{Sales}/Sum({Sales}, {State}=THIS)*100
CURRENT
Value
To calculate the total sales made in the current quarter, use the following expression:
Sum({Sales}, {@QUARTER_NUM}=CURRENT)
NULL
Value
You have a report that displays sales made in the current quarter by each sales person. If a sale was a result of a customer enquiry, the sales person attribute value is NULL. To calculate the total sales that resulted due to customer enquires, use the following expression:
Sum({Sales}, {Sales Person}=NULL)
Note: The set of values must include values that display continuously in the report table.
$AGGREGATE_BY$ Variable
When creating a custom aggregate expression, you can use the $AGGREGATE_BY$ variable to set the value of the Context argument. The variable works as a placeholder for the layout context in the expression. Use this variable to perform a calculation on rows, columns, and sections in a report.
Syntax for the Context Argument 27
For example, in a cross tabular report table, to count metric values for the Sales metric by row and by column, use the following expression:
Count({Sales}, $AGGREGATE_BY$)
Use the point-and-click interface to add the variable to an expression. If you manually enter the variable, you must enclose the variable name within dollar ($) signs. For more information about using variable in custom aggregates, see Adding Calculations to a Report in the Data Analyzer User Guide.
28
For the functions in the Running category, you can use the Context argument to perform the calculation for a row, a column, or a time attribute used in the report. Use the following keywords to set the Context:
Time attribute name. For a list of time attribute names, see Table 3-1 on page 25. COLUMN keyword. For more information about using the COLUMN keyword, see Keywords on page 26. ROW keyword. For more information about using the ROW keyword, see Keywords on page 26. SECTION keyword. Within each section, Data Analyzer performs the calculation for columns only. For more information about using the SECTION keyword, see Keywords on page 26.
If you do not pass a value for the Context argument, Data Analyzer performs the calculation for all values of the given metric or attribute. For a report with a tabular report table, Data Analyzer performs the calculation for the column. For a report with a cross tabular report table, Data Analyzer performs the calculation for all values across all rows and columns. For a report with a sectional report table, Data Analyzer performs the calculation for all values across all sections, including the Summary section. When you use the Context argument for functions in the Running category, you cannot use attribute values in the Context argument. For more information about each function, see Functions on page 31.
29
30
Chapter 4
Functions
This chapter includes information on Data Analyzer functions that you can use in expressions. Each function description includes:
31
Function Categories
Data Analyzer provides the following types of functions:
Aggregate. Perform calculations on a list of numeric values. Boolean. Perform boolean operations in calculations. Comparative. Compare values in calculations. Conditional. Check for conditions in calculations. Conversion. Convert one unit of measure to another unit of measure. Date & Time. Manipulate date and time values in calculations. Fetch. Get the next or previous value of a given metric or attribute. Financial. Perform common business calculations, such as determining the payment for a loan, the future value or net present value of an investment, and the values of various securities. Mathematical. Perform common arithmetic calculations on numeric values. Rounding. Round or truncate numeric values. Running. Perform calculations that display trends within a set of values. Statistical. Perform statistical analysis on sets of values. String. Manipulate text strings in calculations. Trigonometric. Perform common trigonometric calculations on numeric values. Unary. Manipulate the signs (+ or -) of numeric values. User Defined. The User Defined category lists additional functions that you create in Data Analyzer. If you have not created any functions, the User Defined category is empty.
32
Chapter 4: Functions
Table 4-1 lists the values you can use for the DayCountBasis argument:
Table 4-1. Values of the DayCountBasis Argument Value ACT/360 Meaning Actual number of days between dates divided by 360. When calculating the numerator, the first date is excluded and second date is included in the calculation. The fraction assumes that there are 360 days in the year. Actual number of days between dates divided by 365. When calculating the numerator, the first date is excluded and second date is included in the calculation. The fraction assumes that there are 365 days in the year. Actual number of days between dates divided by 365 or 366. When calculating the numerator, the first date is excluded and second date is included in the calculation. The fraction uses 366 as the denominator if the second date is in a leap year. Actual number of days between dates divided by actual number of days in the year. When calculating the numerator, the first date is excluded and second date is included in the calculation. National Association of Securities Dealers (NASD) 30/360 day count fraction. This day count fraction calculates the elapsed days assuming all months have 30 days after adjusting the two dates based on the following conditions: - If the first date is the 31st of a month, it is adjusted to the 30th of the same month. - If the second date is the 31st of a month and the first date is earlier than the 30th of a month, the second date is adjusted to the 1st of the next month. - If the second date is earlier than the 31st or if the first date is the 30th of a month, the second date is adjusted to the 30th of the same month. Day count fraction assumes that there are 30 days in each month and 360 days in the year. When calculating the numerator, the dates are adjusted based on the following conditions: - If the first date is the 31st of a month, the fraction adjusts it to the 30th of the same month. - If the second date is the 31st and if first date is the 30th or 31st, second date is adjusted to 30th of the same month. European 30/360 day count fraction. The day count fraction assumes that there are 30 days in each month and 360 days in the year. When calculating the numerator, the dates are adjusted based on the following conditions: - If the first date is the 31st of a month, the fraction adjusts it to the 30th of the same month. - If the second date is the 31st, it is adjusted to 30th of the same month. 30E+/360 day count fraction assumes that there are 30 days in each month and 360 days in the year. When calculating the numerator, the dates are adjusted based on the following conditions: - If the first date is the 31st of a month, the fraction adjusts it to the 30th of the same month. - If the second date is the 31st, it is adjusted to 1st of the next month.
ACT/365
ACT/365L
30/360
30E/360
30E+/360
Note: Values of the DayCountBasis argument are not case sensitive and must be enclosed
Function Categories
33
Note: Unit names are not case sensitive and must be enclosed within quotation marks.
34
Chapter 4: Functions
ABS
Returns the absolute value of a number. You can use this function with a numeric metric, numeric attribute, or a calculated numeric value. This function belongs to the Unary category.
Syntax
Abs(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the absolute value of the Discount metric:
Abs({Discount})
Discount --------1.56 -3.99 0.99 -3.49 Return Value -----------1.56 3.99 0.99 3.49
Abs
35
ACCRINT
Returns the accrued interest for a security that pays periodic interest. The interest rate (Rate argument) must be adjusted for the frequency of payments. To adjust the interest rate for frequency, divide the annual rate by the number of payments made in an year. For example, a coupon pays an annual interest rate of 15 percent and the frequency is "Quarterly". Calculate the value of the Rate argument by dividing 15% by 4. This function belongs to the Financial category.
Syntax
AccrInt(IssueDate, FirstInterestDate, SettlementDate, Rate [, ParValue, Frequency, DayCountBasis, CurrencyDecimals]) Argument IssueDate FirstInterestDate SettlementDate Rate Datatype Date Date Date Numeric Description Required. Date when the security was issued. Must be less than SettlementDate. Required. Date when the security will make its first interest payment. Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Optional. Par value of a security. Default is 1,000. Must be greater than or equal to 0. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
ParValue Frequency
Numeric String
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns 25.42 as the accrued interest for a government savings bond:
36
Chapter 4: Functions
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
AccrInt
37
ACCRINTM
Returns the accrued interest for a security that pays interest at maturity. The interest rate (Rate argument) must be adjusted for the frequency of payments. To adjust the interest rate for frequency, divide the annual rate by the number of payments made in an year. This function belongs to the Financial category.
Syntax
AccrIntM(IssueDate, SettlementDate, Rate [, ParValue, DayCountBasis, CurrencyDecimals]) Argument IssueDate SettlementDate Rate Datatype Date Date Numeric Description Required. Date when the security was issued. Must be less than SettlementDate. Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Optional. Par value of a security. Default is 1,000. Must be greater than or equal to 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
ParValue DayCountBasis
Numeric String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns 41.10 as the accrued interest for a note:
AccrIntM(DateValue("4/1/2004"), DateValue("6/15/2004"), 0.2, 1000, "ACT/ 365", 2)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
38 Chapter 4: Functions
ADD
Returns the sum of two numeric values. This function belongs to the Mathematical category.
Syntax
Add(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression returns sum of quantity sold and quantity in stock:
ADD({Quantity Sold}, {Quantity in Stock})
Quantity Sold ------------200 9855 6.89 Quantity in Stock ----------------252 566 3.52 Return Value -----------452 10421 10.41
Add
39
ADDTODATE
Adds years, months, and days to a date, and returns the adjusted date. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
AddToDate(Date, Years, Months, Days) Argument Date Years Months Days Datatype Date Numeric Numeric Numeric Description Required. Date value you want to pass to the function. Required. Number of years. Required. Number of months. Required. Number of days.
Return Value
Date
Examples
To add one months and five days to the Date Shipped attribute, use the following expression:
AddToDate({Date Shipped}, 0, 1, 5)
Date Shipped -----------1/12/2001 10/9/2002 1/29/2004 Return Value -----------2/17/2001 11/14/2002 3/5/2004
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
40
Chapter 4: Functions
AMORDEGRC
Returns the depreciation for each accounting period, based on a depreciation coefficient. If an asset is purchased in the middle of the accounting period, the function prorates the depreciation. This function is similar to the AmorLinC function, except that a depreciation coefficient is applied in the calculation depending on the life of the asset. This function belongs to the Financial category.
Syntax
AmorDegrC(Cost, PurchaseDate, FirstPeriodDate, Salvage, Period, Rate [, DayCountBasis, CurrencyDecimals]) Argument Cost PurchaseDate FirstPeriodDate Datatype Numeric Date Date Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Date asset was purchased. Must be less than FirstPeriodDate. Required. Date of the end of the first period. For example, if the first period for the calculation is the year 2004, the FirstPeriodDate is December 31st, 2004. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number representing the period for which you want to perform the calculation. Default is the same as the value of the Life argument. Must be greater than or equal to 0. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
Salvage Period
Numeric Numeric
Rate
Numeric
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
AmorDegrC
41
Examples
Your company purchased a printer on September 10, 2003. The cost of the printer was 5000 F (French Francs) and the salvage value is 500 F. The depreciation rate is 15 percent. The following expression returns 1037 F as the depreciation for the second accounting period:
AmorDegrC(5000, Date(2003, 9, 10), Date(2003, 12, 31), 500, 2, 0.15)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
42
Chapter 4: Functions
AMORLINC
Returns the depreciation for each accounting period. If an asset is purchased in the middle of the accounting period, the function prorates the depreciation. This function belongs to the Financial category.
Syntax
AmorLinC(Cost, PurchaseDate, FirstPeriodDate, Salvage, Period, Rate [, DayCountBasis, CurrencyDecimals]) Argument Cost PurchaseDate FirstPeriodDate Datatype Numeric Date Date Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Date asset was purchased. Must be less than FirstPeriodDate. Required. Date of the end of the first period. For example, if the first period for the calculation is the year 2004, the FirstPeriodDate is December 31st, 2004. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number representing the period for which you want to perform the calculation. Default is the same as the value of the Life argument. Must be greater than or equal to 0. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
Salvage Period
Numeric Numeric
Rate
Numeric
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
You purchased a printer on September 10, 2003. The cost of the printer was $5000 and the salvage value is $500. The depreciation rate is 15 percent. The following expression returns $750 as the depreciation for the second accounting period:
AmorLinC(5000, Date(2003, 9, 10), Date(2003, 12, 31), 500, 2, 0.15)
AmorLinC
43
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
44
Chapter 4: Functions
AND
Joins two conditions and returns TRUE if both conditions are true. Returns FALSE if any condition or both conditions are not true. This function belongs to the Boolean category.
Syntax
And(BooleanValue1, BooleanValue2) Argument BooleanValue1 BooleanValue2 Datatype Boolean Boolean Description Required. Boolean condition you want to pass to the function. Required. Boolean condition you want to pass to the function.
Return Value
Boolean
Examples
The following expression returns TRUE:
And(TRUE, TRUE)
And
45
ARCCOS
Returns the arc cosine of a numeric value. The arc cosine is the trigonometric inverse of a cosine. The arc cosine is the angle whose cosine is the passed numeric value. As the argument for the ArcCos function, you must pass a value that is between -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcCos(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range 0 to PI.
Examples
The following expression returns the value 120 (degrees):
ArcCos(-0.5)*180/PI
46
Chapter 4: Functions
ARCCOSH
Returns the inverse hyperbolic cosine of a numeric value. The inverse hyperbolic cosine is the trigonometric inverse of a hyperbolic cosine. As the argument for the ArcCosh function, you must pass a real number that is greater than or equal to 1. This function belongs to the Trigonometric category.
Syntax
ArcCosh(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value 0:
ArcCosh(1)
ArcCosh
47
ARCCOT
Returns the arc cotangent of a numeric value. The arc cotangent is the trigonometric inverse of a cotangent. The arc cotangent is the angle whose cotangent is the passed numeric value. This function belongs to the Trigonometric category.
Syntax
ArcCot(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range -PI/2 to +PI/2.
Examples
The following expression return the value 0.46 (radians):
ArcCot(2)
48
Chapter 4: Functions
ARCCOTH
Returns the inverse hyperbolic cotangent of a numeric value. The inverse hyperbolic cotangent is the trigonometric inverse of a hyperbolic cotangent. As the argument for the ArcCoth function, you must pass a value that is outside the range of -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcCoth(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value 0.20:
ArcCoth(5)
ArcCoth
49
ARCCSC
Returns the arc cosecant of a numeric value. The arc cosecant is the trigonometric inverse of a cosecant. The arc cosecant is the angle whose cosecant is the passed numeric value. As the argument for the ArcCsc function, you must pass a value that is outside the range of -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcCsc(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range -PI/2 to +PI/2.
Examples
The following expression returns the value 1.57 (radians):
ArcCsc(1)
50
Chapter 4: Functions
ARCCSCH
Returns the inverse hyperbolic cosecant of a numeric value. The inverse hyperbolic cosecant is the trigonometric inverse of a hyperbolic cosecant. This function belongs to the Trigonometric category.
Syntax
ArcCsch(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value 0.10:
ArcCsch(10)
ArcCsch
51
ARCSEC
Returns the arc secant of a numeric value. The arc secant is the trigonometric inverse of a secant. The arc secant is the angle whose secant is the passed numeric value. This function belongs to the Trigonometric category.
Syntax
ArcSec(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range 0 to PI.
Examples
The following expression returns the value 1.47 (radians):
ArcSec(10)
52
Chapter 4: Functions
ARCSECH
Returns the inverse hyperbolic secant of a numeric value. The inverse hyperbolic secant is the trigonometric inverse of a hyperbolic secant. As the argument for the ArcSec function, you must pass a value that is outside the range of -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcSech(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value 0.5:
ArcSech(1.32)
ArcSech
53
ARCSIN
Returns the arc sine of a numeric value. The arc sine is the trigonometric inverse of a sine. The arc sine is the angle whose sine is the passed numeric value. As the argument for the ArcSin function, you must pass a value that is between -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcSin(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range -PI/2 to +PI/2.
Examples
The following expression returns the value 0.85 (radians):
ArcSin(0.75)
54
Chapter 4: Functions
ARCSINH
Returns the inverse hyperbolic sine of a numeric value. The inverse hyperbolic sine is the trigonometric inverse of a hyperbolic sine. This function belongs to the Trigonometric category.
Syntax
ArcSinh(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value -1.19:
ArcSinh(-1.5)
ArcSinh
55
ARCTAN
Returns the arc tangent of a numeric value. The arc tangent is the trigonometric inverse of a tangent. The arc tangent is the angle whose tangent is the passed numeric value. This function belongs to the Trigonometric category.
Syntax
ArcTan(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function. The value is in the range -PI/2 to +PI/2.
Examples
The following expression returns the value 1.11 (radians):
ArcTan(2)
56
Chapter 4: Functions
ARCTANH
Returns the inverse hyperbolic tangent of a numeric value. The inverse hyperbolic tangent is the trigonometric inverse of a hyperbolic tangent. As the argument for the ArcTanh function, you must pass a number that is between -1 and 1. This function belongs to the Trigonometric category.
Syntax
ArcTanh(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. An angle, expressed in radians. To convert radians to degrees, multiply the radians by 180/PI or use the Units function.
Examples
The following expression returns the value 0.42:
ArcTanh(0.4)
ArcTanh
57
AVEDEV
Returns the average of the absolute deviations of values in a list from their mean. The AveDev function determines the variability in a set of values. This function belongs to the Aggregate category.
Syntax
AveDev(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 2695.35 as the average of the absolute deviations of the Amount Sold metric, where the Category attribute value is Drinks:
AveDev({Amount Sold}, "{Category}='Drinks'")
Category -------Drinks Drinks Drinks Snacks Drinks Drinks Snacks Amount Sold ----------13253.74 6392.94 10502.07 550.05 5420.59 6974.26 777.62
58
Chapter 4: Functions
AVG
Returns the average of all values in a list. This function belongs to the Aggregate category.
Syntax
Avg(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 4.16 as the average profit of all products:
Avg({Profit})
Profit -----5.99 2.59 3.89
Avg
59
BINOMDIST
Returns the value for the statistical binomial distribution. Binomial distribution is the probability of observing X number of successes in a fixed number of independent trials. This function belongs to the Statistical category.
Syntax
BinomDist(X, Trials, ProbabilityOfSuccess, Cumulative) Argument X Trials ProbabilityOfSuccess Cumulative Datatype Numeric Numeric Numeric Boolean Description Required. Number for which you want to perform the calculation. Must be between 0 and Trials, inclusive. Required. Number of independent trials. Required. Probability of a success on a single trial. Must be between 0 and 1, inclusive. Required. Logical value that determines the form of the function. If cumulative is TRUE, the function returns the cumulative answer. Otherwise, it does not return the cumulative answer.
Return Value
Numeric
Examples
A test consists of 16 questions. For each question, the answer can be true or false. The probability of getting a true answer for a question is 0.5. The following expression returns 0.89 as the binomial distribution for getting a true answer for at most 10 questions:
BinomDist(10, 16, 0.5, TRUE)
The following expression returns 0.12 as the binomial distribution for getting a true answer for exactly 10 questions:
BinomDist(10, 16, 0.5, FALSE)
60
Chapter 4: Functions
BINOMINV
Returns the number (integer) for which the cumulative binomial distribution is greater than or equal to a criterion value. The cumulative binomial distribution is the first argument (Probability) that you pass to the function. The BinomInv function is the statistical inverse of binomial distribution (BinomDist) function. This function belongs to the Statistical category.
Syntax
BinomInv(Probability, Trials, ProbabilityOfSuccess) Argument Probability Trials ProbabilityOfSuccess Datatype Numeric Numeric Numeric Description Required. Probability associated with the distribution. Must be between 0 and 1, inclusive. Required. Number of independent trials. Required. Probability of a success on a single trial. Must be between 0 and 1, inclusive.
Return Value
Numeric
Examples
In an experiment, you flip a coin six times. For each flip, you can get heads or tails. The probability of getting heads for a coin flip is 0.5. The following expression returns 3 as the smallest number of coin flips for a cumulative binomial distribution of 0.75:
BinomInv(0.75, 6, 0.5)
BinomInv
61
CEILING
Returns the value rounded up to the specified number of digits, towards positive infinity. The PowerAnalyzer Ceiling function differs from the Microsoft Excel Ceiling function. In the PowerAnalyzer Ceiling function, Significance is the number of digits to the right of the decimal point. In Excel, Significance is the multiple to which you want to round. The PowerAnalyzer Ceiling function rounds a number towards positive infinity, whereas the Excel Ceiling function rounds a number away from zero. This function belongs to the Rounding category.
Syntax
Ceiling(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
The following expression returns the number rounded up to the significance, towards positive infinity:
Ceiling({Number}, {Significance})
Number -----2.425 -2.425 2.425 -2.425 2.425 -2.425 2.425 -2.425 Significance -----------1 1 2 2 3 3 0 0 Return Value -----------2.5 -2.4 2.43 -2.42 2.425 -2.424 3 -2
Notes
If you pass a negative number (-n) as the value of the Significance argument, the Ceiling function returns 10 raised to the nth power. For example, Ceiling(2.425, -2) returns 100.
62 Chapter 4: Functions
To generate the same result as the Excel Ceiling(value, significance) function, use the following expression:
RoundUp(value/significance) * significance
Ceiling
63
CHIDIST
Returns the probability of the chi-squared distribution. The chi-squared distribution is associated with a chi-squared test and a certain number of degrees of freedom. The chisquared test allows you to compare observed and expected values. This function belongs to the Statistical category.
Syntax
ChiDist(X, DegreesOfFreedom) Argument X DegreesOfFreedom Datatype Numeric Numeric Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0. Required. Whole number representing the degrees of freedom. Degrees of freedom is the number of values in a statistical calculation that are free to vary. Must be between 1 and 10,000, inclusive.
Return Value
Numeric
Examples
In an experiment involving the student test scores, the value of a chi-squared test is 2.5 and the degrees of freedom is 8. The following expression returns 0.96 as the probability of the chi-squared distribution:
ChiDist(2.5, 8)
64
Chapter 4: Functions
CHIINV
Returns the inverse of the probability associated with a chi-squared distribution. The ChiInv (Probability, DegressofFreedom) function returns the value X, where Probability is the return value of the ChiDist(X, DegressofFreedom) function. This function belongs to the Statistical category.
Syntax
ChiInv(Probability, DegreesOfFreedom) Argument Probability DegreesOfFreedom Datatype Numeric Numeric Description Required. Probability associated with the distribution. Must be between 0 and 1, inclusive. Required. Whole number representing the degrees of freedom. Degrees of freedom is the number of values in a statistical calculation that are free to vary. Must be between 1 and 10,000, inclusive.
Return Value
Numeric
Examples
The following expression returns 2.5 as the value of a chi-squared test:
ChiInv(0.96, 8)
ChiInv
65
CHITEST
Returns the chi-squared goodness of fit between expected and observed lists. You can use this function to find out if results based on a hypothesis are verified by an experiment. Pass numeric metrics or attributes as the values for the ListExpected and ListObserved arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the ListObserved argument and the Context2 argument corresponds to the ListExpected argument. This function belongs to the Aggregate category.
Syntax
ChiTest(ListObserved, ListExpected [, Context1, Context2]) Argument ListObserved ListExpected Context1 Datatype Numeric List Numeric List String Description Required. List of observed values. Use a metric or attribute name. Required. List of expected results. Use a metric or attribute name. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.944 as the Chitest value between expected satisfaction rating and the actual satisfaction rating for customers in the 30-39 years age group:
ChiTest({Actual Rating}, {Expected Rating}, "{Age Group}='30-39'", "{Age Group}='30-39'")
Age Group --------30-39 30-39 20-29 30-39 20-29 Expected Rating --------------5.5 3 8.5 6 7 Actual Rating ------------6 3.5 9.9 6 12
66
Chapter 4: Functions
7 4.3 2
7 5 4
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
ChiTest
67
CLEAN
Cleans a string of control characters. Removes all nonprintable characters from a string. You can use this function to remove control characters from a string. These control characters are characters that may not print with your operating system. This function belongs to the String category.
Syntax
Clean(String) Argument String Datatype String Description Required. String value you want to pass to the function.
Return Value
String
68
Chapter 4: Functions
CONCAT
Concatenates two strings. If one of the strings is NULL, the Concat function ignores it and returns the other string. If both strings are NULL, the Concat function returns NULL. This function belongs to the String category.
Syntax
Concat(String1, String2) Argument String1 String2 Datatype String String Description Required. String value you want to pass to the function. Required. String value you want to pass to the function.
Return Value
String
Examples
The following expression concatenates the names in the First Name and Last Name attributes:
Concat({First Name}, {Last Name})
First Name ---------Beth Marin george Ally Last Name --------Kelley Jones cash NULL Return Value -----------BethKelley MarinJones georgecash Ally
Notes
The Concat function does not add spaces between the two strings. If you want to add a space between the strings, use an expression with two nested Concat functions:
Concat(Concat({First Name}, " "), {Last Name})
Concat
69
CONFIDENCE
Returns the confidence range for the mean of a population. The confidence range is a value on either side of a sample mean, which allows you to determine the standard deviation with a particular level of confidence. The level of confidence determines the value of the Alpha argument. Alpha equals (1-confidence level/100). For example, for an 80 percent confidence level, Alpha equals 0.2. This function belongs to the Statistical category.
Syntax
Confidence(Alpha, StdDev, Size) Argument Alpha StdDev Size Datatype Numeric Numeric Numeric Description Required. The alpha variable. Required. Standard deviation of a list of numbers. Required. Number of elements for which you want to perform the calculation. Must be greater than or equal to 0.
Return Value
Numeric
Examples
In an experiment to determine the time taken to complete a test, you have a sample of 100 students. The average time taken to complete the test is 45 minutes. The population standard deviation is 5.5. Use the following expression to determine, with 90 percent confidence, the interval within which the population mean lies:
Confidence(0.1, 5.5, 100)
The above expression returns the value 0.90. Thus, you can say with 90 percent confidence that the average time taken to complete the test equals 45 plus/minus 0.90 minutes, or 44.1 to 45.9 minutes.
70
Chapter 4: Functions
CORREL
Returns the correlation coefficient of two sets of values. You can use the correlation coefficient to determine the relationship between two sets of values. Pass numeric metrics or attributes as the values for the first and second List arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. This function belongs to the Aggregate category.
Syntax
Correl(List1, List2 [, Context1, Context2]) Argument List1 List2 Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute. Required. Name of a metric or attribute. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.1685 as the correlation coefficient of Sales in 2003 and 2004 for products in the Drinks category:
Correl({2003 Sales}, {2004 Sales}, "{Category}='Drinks'", "{Category}='Drinks'")
Category -------Drinks Drinks Food Drinks Drinks 2004 Sales ---------1500 5000 38088 6200 750 2003 Sales ---------2500 2250 10502 800 150
Correl
71
Drinks Food
2000 28195
750 16974
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
72
Chapter 4: Functions
COS
Returns the cosine of a numeric value. This function belongs to the Trigonometric category.
Syntax
Cos(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric. The value is in the range -1 to +1.
Examples
The following expression returns the cosine for all values of the Degrees metric:
Cos({Degrees}*PI/180)
Degrees ------0 90 70 NULL Return Value ----------------1.0 0.0 0.342020143325593 NULL
Cos
73
COSH
Returns the hyperbolic cosine of a numeric value. This function belongs to the Trigonometric category.
Syntax
Cosh(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the hyperbolic cosine for all values of the Angles metric:
Cosh({Angles})
Degrees ------1.0 3.66 0 NULL Return Value ---------------1.54308063481524 19.4435376920294 1.0 NULL
74
Chapter 4: Functions
COT
Returns the cotangent of a numeric value. This function belongs to the Trigonometric category.
Syntax
Cot(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the cotangent for all values of the Angles metric:
Cot({Angles})
Degrees ------1.0 0.52 5 NULL Return Value -----------0.64 1.74653 -0.30 NULL
Cot
75
COTH
Returns the hyperbolic cotangent of a numeric value. This function belongs to the Trigonometric category.
Syntax
Coth(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the value 2.16:
Coth(0.5)
76
Chapter 4: Functions
COUNTALL
Counts the number of values within a given metric or attribute. You can use this function to get the number of rows in a column. The Context argument allows you to count only a specific set of metric or attribute values. This function belongs to the Aggregate category.
Syntax
CountAll(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 2 as the number of values in the Sales Person attribute for the Northern region:
CountAll({Sales Person}, "{Region}='Northern'")
Sales Person -----------Roger Sean Tim Pearce Region -------Northern Eastern Northern Western
CountAll
77
COUNTUNIQUE
Counts the number of unique values within a given metric or attribute. You can use this function to get the number of unique rows in a column. The Context argument allows you to count only a specific set of metric or attribute values. This function belongs to the Aggregate category.
Syntax
CountUnique(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 3 as the number of unique values in the Region attribute:
CountUnique({Region})
Region -------Northern Eastern Northern Western
78
Chapter 4: Functions
COUPDAYBS
Returns the total number of coupon days from the beginning of a coupon period to the settlement date. This function belongs to the Financial category.
Syntax
CoupDayBS(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Numeric
Examples
The following expression returns 121 as the number of days from the beginning of a coupon period to the settlement date:
CoupDayBS(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
CoupDayBS
79
COUPDAYS
Returns the total number of coupon days in the coupon period that contains the settlement date. This function belongs to the Financial category.
Syntax
CoupDayS(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Numeric
Examples
The following expression returns 360 as the number of days in the coupon period that contains the settlement date:
CoupDayS(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
80
Chapter 4: Functions
COUPDAYSNC
Returns the total number of coupon days from the settlement date to the next coupon date. This function belongs to the Financial category.
Syntax
CoupDaySNC(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Numeric
Examples
The following expression returns 240 as the number of days from the settlement date to the next coupon date:
CoupDaySNC(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
CoupDaySNC
81
COUPNCD
Returns the next coupon date after the settlement date of a security. This function belongs to the Financial category.
Syntax
CoupNCD(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Date
Examples
The following expression returns November 30, 2003 as the next coupon date after the settlement date:
CoupNCD(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
82
Chapter 4: Functions
COUPNUM
Returns the number of coupons payable between the settlement date and maturity date. PowerAnalyzer rounds the number of coupons to the nearest whole number. This function belongs to the Financial category.
Syntax
CoupNum(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Date
Examples
The following expression returns 2 as the number of coupons payable between the settlement date and maturity date:
CoupNum(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
CoupNum
83
COUPPCD
Returns the previous coupon date before the settlement date of a security. This function belongs to the Financial category.
Syntax
CoupPCD(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Frequency
Date String
DayCountBasis
String
Return Value
Date
Examples
The following expression returns November 30, 2002 as the previous coupon date before the settlement date:
CoupPCD(Date(2003,3,31), Date(2004,11,30), "annual","30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
84
Chapter 4: Functions
COVAR
Returns covariance of two sets of values. Covariance is the average of the products of deviations for each data point pair. You can use this function to determine the relationship between two sets of values. Pass numeric metrics or attributes as the values for the first and second List arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. This function belongs to the Aggregate category.
Syntax
Covar(List1, List2 [, Context1, Context2]) Argument List1 List2 Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute. Required. Name of a metric or attribute. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 328400 as the covariance of quantity sold and quantity on hand for products in the Perishables group:
Covar({Quantity Sold}, {Quantity on Hand}, "{Group}='Perishables'", "{Group}='Perishables'") Group ----------Perishables Perishables Apparel Perishables Quantity Sold ------------1500 5000 38088 6200 Quantity on Hand ---------------2500 2250 10502 800
Covar
85
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
86
Chapter 4: Functions
CSC
Returns the cosecant of a numeric value. This function belongs to the Trigonometric category.
Syntax
Csc(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the value 1.67:
Csc(2.5)
Csc
87
CSCH
Returns the hyperbolic cosecant of a numeric value. This function belongs to the Trigonometric category.
Syntax
Csch(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the value 0.05:
Csch(3.66)
88
Chapter 4: Functions
CUMIPMT
Returns the cumulative interest paid for a loan between two specified periods of time. The Rate argument represents the interest rate for each period. Calculate NumberPeriods by multiplying the term of the loan by number of payments per year. This function belongs to the Financial category.
Syntax
CumIPmt(Rate, NumberPeriods, PresentValue, StartPeriod, EndPeriod, PaymentAtBeginning [, CurrencyDecimals]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Number of periods or payments. Must be greater than 0. Required. Current value of an asset or liability. Must be greater than 0. Required. Starting period for the calculation. Must be between 1 and EndPeriod, inclusive. Required. Ending period for the calculation. Must be greater than or equal to 1. Required. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns -9409.07 as the total interest paid in the second year of a six-year loan:
CumIPmt(0.0125, 72, 75000, 13, 24, TRUE)
You can use the CumIPmt function to calculate the interest paid in a single month. For example, to calculate the interest paid in the 6th month, pass 6 as the value of the StartPeriod and EndPeriod arguments. The following expression returns -897.21 as the interest paid in the 6th month:
CumIPmt(0.0125, 72, 75000, 6, 6, TRUE)
CumIPmt
89
Notes
To calculate interest rate earned in each period, divide the annual rate by the number of payments made in an year. For example, if you make monthly payments at an annual interest rate of 15 percent, the value of the Rate argument is 15% divided by 12. If you make annual payments, the value of the Rate argument is 15%.
90
Chapter 4: Functions
CUMPRINC
Returns the cumulative principal paid on a loan between two specified periods of time. The Rate argument represents the interest rate for each period. Calculate NumberPeriods by multiplying the term of the loan by number of payments per year. This function belongs to the Financial category.
Syntax
CumPrinc(Rate, NumberPeriods, PresentValue, StartPeriod, EndPeriod, PaymentAtBeginning [, CurrencyDecimals]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Number of periods or payments. Must be greater than 0. Required. Current value of an asset or liability. Must be greater than 0. Required. Starting period for the calculation. Must be between 1 and EndPeriod, inclusive. Required. Ending period for the calculation. Must be greater than or equal to 1. Required. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns -9386.53 as the total principal paid in the second year of a six-year loan, where you make monthly payments:
CumPrinc(0.0125, 72, 75000, 13, 24, TRUE)
You can use the CumPrinc function to calculate the principal paid in a single month. For example, to calculate the principal paid in the 6th month, pass 6 as the value of the StartPeriod and EndPeriod arguments. The following expression returns -669.09 as the principal paid in the 6th month:
CumPrinc(0.0125, 72, 75000,6, 6, TRUE)
CumPrinc
91
Notes
To calculate interest rate earned in each period, divide the annual rate by the number of payments made in an year. For example, if you make monthly payments at an annual interest rate of 15 percent, the value of the Rate argument is 15% divided by 12. If you make annual payments, the value of the Rate argument is 15%.
92
Chapter 4: Functions
DB
Returns the depreciation of an asset for a specified period using the fixed-declining balance depreciation calculation. The fixed-declining balance method calculates depreciation at a fixed rate. The value of the Period argument is the time period for which you want to calculate the depreciation. This function belongs to the Financial category.
Syntax
DB(Cost, Salvage, Life, Period [, FirstYearMonths, CurrencyDecimals]) Argument Cost Salvage Life Period Datatype Numeric Numeric Numeric Numeric Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number of periods over which an asset is being depreciated. Must be greater than 0. Required. Number representing the period for which you want to perform the calculation. Default is the same as the value of the Life argument. Must be greater than 0. Optional. Number of months in the first year of life. Default is 12. Must be between 1 and 12, inclusive. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
FirstYearMonths CurrencyDecimals
Numeric Numeric
Return Value
Numeric
Examples
An office desk costs $1,000 and has a life of 10 years. The salvage value of the desk is $100. The following expression returns $51.62 as the depreciation of the desk in the 7th year:
DB(1000,100,10,7)
Notes
If the number of months in the first year is not 12, then use the FirstYearMonths argument to pass the number of months in the first year. If the Life argument is expressed in months, the Period argument must also be expressed in months.
DB
93
DDB
Returns the depreciation of an asset for a specified period using the double-declining balance depreciation calculation. The double-declining balance method calculates depreciation at an accelerated rate. In the first period, depreciation is highest and it decreases in each subsequent period. The value of the Period argument is the time period for which you want to calculate the depreciation. Use the RateFactor argument to pass a value for the rate at which the balance declines. This function belongs to the Financial category.
Syntax
DDB(Cost, Salvage, Life [, Period, RateFactor, CurrencyDecimals]) Argument Cost Salvage Life Period Datatype Numeric Numeric Numeric Numeric Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number of periods over which an asset is being depreciated. Must be greater than 0. Optional. Number representing the period for which you want to perform the calculation. Default is the same as the value of the Life argument. Must be greater than 0. Optional. Factor used in calculating the rate. Default is 2. Must be greater than 0. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
RateFactor CurrencyDecimals
Numeric Numeric
Return Value
Numeric
Examples
The cost of a machine is $3,200 and it has a life of 8 years. The salvage value of the machine is $500. The following expression returns $800 as the depreciation of the machine in the 1st year:
DDB(3200,500,8,1)
Notes
If the Life argument is expressed in months, the Period argument must also be expressed in months.
94
Chapter 4: Functions
DATE
Returns a date given the year, month, and day values you pass to the function. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
Date(Year, Month, Day) Argument Year Month Day Datatype Numeric Numeric Numeric Description Required. Number representing the year. Must be between 1,000 and 3,000, inclusive. Required. Number representing the month of the year. Must be between 1 and 12, inclusive. Required. Number representing the day of the month. Pass a value valid for the given year and month. Must be between 1 and 31, inclusive.
Return Value
Date
Examples
The following expression returns the date September 10, 2004:
Date(2004, 9, 10)
Notes
If you pass an invalid value for the Month or Day arguments, the function returns NULL.
Date
95
DATESTRING
Converts a date to a string. By default, the function returns the date string in the M/d/yy format. To have the DateString function return the date string in a format different than the default format, you can pass the DateFormat argument to the function. The DateFormat argument provides the DateString function information about the date format you are passing. This function belongs to the Date & Time category.
Syntax
DateString(Date [, DateFormat]) Argument Date DateFormat Datatype Date String Description Required. Date value you want to pass to the function. Optional. Date format string for defining the date string. Default value is the date format for the PowerAnalyzer system locale, without the time part. You must enclose the date format string within quotation marks. For more information on the syntax of the date format string, see the PowerAnalyzer online help.
Return Value
String
Examples
The following expression returns the string 5/26/04:
DateString(Date(2004, 5, 26))
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
96
Chapter 4: Functions
DATEVALUE
Converts a string to a date. You can pass the date string in date format of the system locale. The DateValue function also recognizes certain commonly used date formats. You can pass the date string to the DateValue function in any of these date formats, which are recognized by the function. You can also pass the date string in other unrecognized date formats. When you pass the date string in an unrecognized date format, you must also pass the DateFormat argument to the function. The DateFormat argument provides the DateValue function information about the date format you are passing. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
DateValue(DateString [, DateFormat]) Argument DateString DateFormat Datatype String String Description Required. Date being specified as string. You must enclose the date string within quotation marks. Optional. Date format string for defining the date string. Default value is the date format for the PowerAnalyzer system locale, without the time part. You must enclose the date format string within quotation marks. For more information on the syntax of the date format string, see the PowerAnalyzer online help.
Return Value
Date
Examples
The following expression returns the date for the 10th day of June, 2004 in the yyyy/MM/dd format, which is a recognizable date format:
DateValue("2004/06/10")
The following expression returns the date for the 19th day of August, 2005 in the d/M/yyyy format, which is not a recognizable date format:
DateValue("19/8/2005", "d/M/yyyy")
DateValue
97
The following table lists the recognized formats you can use when passing the date string for the 6th day of April, 1984 to the DateValue function. You do not need to pass the date format string to the function for these formats:
Date String ---------------"6-APR-1984" "06-APR-1984" "April 6, 1984" "April 06, 1984" "1984/4/6" "1984/04/6" "1984/4/06" "1984/04/06" "1984.APR.6" "1984.APR.06" "4/6/1984" "04/6/1984" "4/06/1984" "04/06/1984" "1984-APR-6" "1984-APR-06" "6.APR.1984" "06.APR.1984" "1984-04-06" "1984-4-6" Date Format -----------d-MMM-yyyy dd-MMM-yyyy MMM d, yyyy MMM dd, yyyy yyyy/M/d yyyy/MM/d yyyy/M/dd yyyy/MM/dd yyyy.MMM.d yyyy.MMM.dd M/d/yyyy MM/d/yyyy M/dd/yyyy MM/dd/yyyy yyyy-MMM-d yyyy-MMM-dd d.MMM.yyyy dd.MMM.yyyy yyyy-MM-dd yyyy-M-d
98
Chapter 4: Functions
DAY
Returns the day of a date value. The Day function returns the day as an integer, with values ranging from 1 to 31. This function belongs to the Date & Time category.
Syntax
Day(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
All of the following expressions return the number 10:
Day(Date(2004, 9, 10)) Day(DateValue("2004/06/10")) Day(Today()), where today's date is October 10, 2004 Day(AddToDate(Today()), 0, 0, 9) where today's date is October 1, 2004 Day({Day Shipped}), where the value of the Day Shipped attribute is July 10, 2003
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
Day
99
DEVSQ
Returns the sum of squared deviations of a set of values from their sample mean. Use this function with a numeric metric or attribute. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
DevSq(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
You have a report that displays the average shelf life (in days) for every product your company sells. To calculate the sum of squared deviations of the average shelf life from its mean, use the following expression:
DevSq({Average Shelf Life})
Notes
If a value is NULL, the DevSq function ignores that row.
100
Chapter 4: Functions
DFTORATE
Returns the rate, given the discount factor. The discount factor is a number that is multiplied by a monetary value to reduce an expected future sum to its present value. This function is the reverse of the RateToDf function. Use the DfToRate function to compute the rate when the discount factor is known. This function belongs to the Financial category.
Syntax
DfToRate(DiscountFactor, RateConvention, ElapsedYears) Argument DiscountFactor RateConvention Datatype Numeric String Description Required. Discount factor of rate. Must be greater than or equal to 0. Required. Convention of quoting the rate. The rate can be "annual", "semiannual", "quarterly", "monthly", "weekly", "daily", "discount", "simple" or "continuous". Default value is "annual". Enclose the rate convention within quotation marks. Required. Elapsed years, expressed as a decimal number. Must be greater than or equal to 0.
ElapsedYears
Numeric
Return Value
Numeric
Examples
The following expression returns 0.055 as the rate:
DfToRate(0.3, "annual", 5)
DfToRate
101
DISC
Returns the discount rate for a security, expressed as a decimal number. To convert it to a percentage, multiply the discount rate by 100. This function belongs to the Financial category.
Syntax
Disc(SettlementDate, MaturityDate, Price, Redemption [, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Security price per $100 face value. Must be greater than 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Return Value
Numeric
Examples
The following expression returns 0.24 as the discount rate for a bond:
Disc(DateValue("4/1/2004"), DateValue("6/15/2004"), 95, 100)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
102
Chapter 4: Functions
DIVIDE
Returns the result of the first numeric value divided by the second numeric value. This function belongs to the Mathematical category.
Syntax
Divide(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression divides the value of the Profit metric by 2:
Divide({Profit}, 2)
Profit -----1000 520.75 6511 0 Return Value -----------500 260.375 3255.5 0
Divide
103
EFFECT
Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year. The effective annual interest rate is expressed as a decimal number. To convert it to a percentage, multiply the rate by 100. This function belongs to the Financial category.
Syntax
Effect(Rate, NumberPeriods) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than 0. Required. Number of periods or payments. Must be greater than 0.
NumberPeriods
Numeric
Return Value
Numeric
Examples
The following expression returns 0.27 as the effective annual interest rate, when the nominal annual interest rate is 25% and the number of compounding periods per year is 4:
Effect(0.25, 4)
Notes
To calculate the nominal annual interest rate, given the effective annual interest rate and the number of compounding periods per year, use the Nominal function.
104
Chapter 4: Functions
ELAPSEDDAYS
Returns the number of days in the period between the specified start time and end time, given a day count basis. You can use this function with date attributes. This function belongs to the Date & Time category.
Syntax
ElapsedDays(Date1, Date2 [, DayCountBasis]) Argument Date1 Date2 DayCountBasis Datatype Date Date String Description Required. Date value you want to pass to the function. Required. Date value you want to pass to the function. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Return Value
Numeric
Examples
The following expression returns the actual number of days in a promotional period:
ElapsedDays(Begin Date}, {End Date}, "ACT/ACT")
Begin Date ---------1/13/2004 3/20/2004 5/5/2004 5/9/2004 End Date --------3/20/2004 5/5/2004 5/9/2004 9/10/2004 Return Value -----------67 46 4 124
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. To get the same result as the Microsoft Excel days360(start_date, end_date, false) function, use the following expression:
ElapsedDays({start_date}, {end_date}, "NASD 30/360")
ElapsedDays
105
To get the same result as the Microsoft Excel days360(start_date, end_date, true) function, use the following expression:
ElapsedDays({start_date}, {end_date}, "30/360")
106
Chapter 4: Functions
ELAPSEDHOURS
Returns the number of hours in the period between the specified start time and end time. You can use this function with date attributes. The ElapsedHours function precision is milliseconds (expressed as a decimal number). This function belongs to the Date & Time category.
Syntax
ElapsedHours(Date1, Date2) Argument Date1 Date2 Datatype Date Date Description Required. Date value you want to pass to the function. Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the number of hours in a promotional period:
ElapsedHours({Begin Date}, {End Date})
Begin Date ---------1/13/2004 3/20/2004 5/5/2004 5/9/2004 End Date --------3/20/2004 5/5/2004 5/9/2004 9/10/2004 Return Value -----------1608 1103 96 2976
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
ElapsedHours
107
ELAPSEDYEARS
Returns the number of years in the period between the specified start time and end time, given a day count basis. The elapsed number of years is expressed as a decimal number. You can use this function with date attributes. This function belongs to the Date & Time category.
Syntax
ElapsedYears(Date1, Date2 [, DayCountBasis]) Argument Date1 Date2 DayCountBasis Datatype Date Date String Description Required. Date value you want to pass to the function. Required. Date value you want to pass to the function. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Return Value
Numeric
Examples
The following expression returns the number of years in a promotional period:
ElapsedYears({Begin Date}, {End Date})
Begin Date ---------1/13/2000 3/20/2001 5/5/2002 5/9/2002 End Date --------3/20/2001 5/5/2002 5/9/2003 9/10/2004 Return Value -----------1.186 1.125 1.011 2.336
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
108
Chapter 4: Functions
ENDOFMONTH
Returns the last date in the month for a given date value. You can use the EndOfMonth function to calculate due dates that correspond with the last date of a month. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
EndOfMonth(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Date
Examples
The following expression returns the date June 30, 2004:
EndOfMonth(DateValue("2004/06/10"))
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
EndOfMonth
109
EQUALS
Compares two numeric values and returns TRUE if the values are equal or FALSE if the values are not equal. You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
Equals(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean
Examples
You want to find out which sales personnel made exactly 120 sales in the last month. The following expression compares the Sales metric with 120:
Equals({Sales}, 120)
Sales ----200 120 122 50 Return Value -----------FALSE TRUE FALSE FALSE
110
Chapter 4: Functions
EQUALSIGNORECASE
Compares two strings and returns TRUE if the strings are identical or FALSE if the strings are not identical. The function ignores the case of the letters in the two strings. You can use this function to compare two attributes in a report. You can also compare an attribute with a given string value. This function belongs to the String category.
Syntax
EqualsIgnoreCase(String1, String2) Argument String1 String2 Datatype String String Description Required. String value you want to pass to the function. Required. String value you want to pass to the function.
Return Value
Boolean
Examples
You want to find out if a product name is the same as the product category name. The following expression compares the Product Name attribute with the Product Category attribute:
EqualsIgnoreCase({Product Name}, {Product Category})
Product Name --------------Big Can Drinks drinks National Bottle drinks Product Category ---------------Drinks Drinks Drinks Supplies Return Value -----------FALSE TRUE FALSE FALSE
EqualsIgnoreCase
111
EXP
Returns E raised to the specified power (exponent), where E=2.71828183. For example, EXP(2) returns 7.38905609893065. Most often, you use this function to analyze scientific and technical data, rather than business data. Exp is the opposite of the Log function, which returns the natural logarithm of a numeric value. You can use the Exp function with a numeric metric, numeric attribute, or a calculated numeric value. This function belongs to the Unary category.
Syntax
Exp(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression uses the values of the Profit metric as the exponent value:
Exp({Profit})
Profit -----10 -2 8.55 NULL Return Value -----------22026.46579 0.135334 5166.75443 NULL
112
Chapter 4: Functions
EXPONDIST
Returns the exponential distribution. Exponential distribution is used to determine the time between consecutive, rare, and random events in a process with no memory. For example, you can use the ExponDist function to determine the time you have to wait before you get your next phone call. If you pass TRUE as the value of the Cumulative argument, ExponDist returns the cumulative distribution calculation. If you pass FALSE as the value of the Cumulative argument, the function returns the probability density calculation. This function belongs to the Statistical category.
Syntax
ExponDist(X, Lambda, Cumulative) Argument X Lambda Cumulative Datatype Numeric Numeric Boolean Description Required. Number for which you want to perform the calculation. Required. The lambda variable. Required. Logical value that determines the form of the function. If cumulative is TRUE, the function returns the cumulative answer. Otherwise, it does not return the cumulative answer.
Return Value
Numeric
Examples
The following function returns 0.78 as the exponential distribution when the X argument is 1 and the Lambda argument is 1.5:
ExponDist(1, 1.5, TRUE)
ExponDist
113
FDIST
Returns the F probability distribution. The F probability distribution is typically used to develop hypothesis tests. Use the FDist function to calculate the one-sided probability of the likelihood that two variances are different. This function belongs to the Statistical category.
Syntax
FDist(X, DegreesOfFreedomNum, DegreesOfFreedomDenom) Argument X DegreesOfFreedomNum DegreesOfFreedomDenom Datatype Numeric Numeric Numeric Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0. Required. Whole number representing the numerator degrees of freedom numerator. Must be between 1 and 10,000, inclusive. Required. Whole number representing the denominator degrees of freedom. Must be between 1 and 10,000, inclusive.
Return Value
Numeric
Examples
You want to find out if female students are more diverse in their response to a particular question than male students. The standard deviation for female respondents equals 6 and standard deviation for male respondents equals 4. The value of the X argument is 2.25 (X=6*6/4*4). The numerator degrees of freedom is 39 and the denominator degrees of freedom is 64. The following expression returns 0.0019 as the F probability distribution:
FDist(2.25, 39, 64)
114
Chapter 4: Functions
FINV
Returns the inverse of the probability associated with a F distribution. The Probability argument passed to the FInv function is the probability associated with the F distribution. The F probability distribution is typically used to develop hypothesis tests. This function belongs to the Statistical category.
Syntax
FInv(Probability, DegreesOfFreedomNum, DegreesOfFreedomDenom) Argument Probability DegreesOfFreedomNum DegreesOfFreedomDenom Datatype Numeric Numeric Numeric Description Required. Probability associated with the distribution. Must be between 0 and 1, inclusive. Required. Whole number representing the numerator degrees of freedom numerator. Must be between 1 and 10,000, inclusive. Required. Whole number representing the denominator degrees of freedom. Must be between 1 and 10,000, inclusive.
Return Value
Numeric
Examples
You are conducting a hypothesis test to determine the degree of variability in two data sets. The numerator degrees of freedom is 39 and the denominator degrees of freedom is 64. The probability associated with the hypothesis test is 0.0019. The following expression returns 2.25 as the inverse of the probability associated with the F distribution:
FInv(0.0019, 39, 64)
FInv
115
FV
Returns the future value of an investment, where you make periodic, constant payments and the investment earns a constant interest rate. The Rate argument represents the interest rate earned in each period. PresentValue is the current value of the investment. If you omit the PresentValue argument, the FV function assumes it to be 0. This function belongs to the Financial category.
Syntax
FV(Rate, NumberPeriods, Payment [, PresentValue, PaymentAtBeginning, CurrencyDecimals]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Number of periods or payments. Must be greater than 0. Required. Payment amount due. Optional. Current value of an asset or liability. Optional. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
You deposit $2,000 into an account that earns 9 percent annual interest compounded monthly (monthly interest of 9%/12, or 0.75%). You plan to deposit $250 at the beginning of every month for the next 12 months. The following expression returns $5,337.96 as the amount that will be in the account at the end of 12 months:
FV(0.0075, 12, -250, -2000, TRUE)
Notes
To calculate interest rate earned in each period, divide the annual rate by the number of payments made in an year. The payment value and present value are negative because these are amounts that you pay.
116 Chapter 4: Functions
FACTORIAL
Returns the factorial (n!) of a number, where n! equals 1*2*3*...*n. Use this function in mathematical calculations. If the number you pass to the function is not an integer, PowerAnalyzer truncates the number. This function belongs to the Mathematical category.
Syntax
Factorial(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function. Must be greater than or equal to 0.
Return Value
Numeric
Examples
The following expression returns the factorial of the values of the Numbers metric:
Factorial({Numbers})
Numbers ------6 1 5 2.2 Return Value -----------720 1 120 2
Factorial
117
FIND
Finds a text string (Find argument) within another text string (String argument), and returns the number of the starting position of the Find argument text within the String argument text. By default, PowerAnalyzer searches the string from beginning to end. You can have the Find string search from end to beginning by passing TRUE to the FromEnd argument. If the Find text does not exist within the String text, PowerAnalyzer returns NULL. This function belongs to the String category.
Syntax
Find(String, Find [, FromEnd]) Argument String Find FromEnd Datatype String String Boolean Description Required. String value you want to pass to the function. Required. String to find within other string. Optional. Starting position of the search. Default is FALSE. Enter TRUE to start the search from the end of the string.
Return Value
Numeric
Examples
The following expression returns the number of the starting position of the text "on" within the value of the Product Status attribute:
Find({Product Status}, "on")
Product Status -------------Now, on stock Not available On Stock Return Value -----------6 NULL NULL
Notes
You can use the Substring function within the PowerAnalyzer Find function to generate results similar to Excel. For example, in Excel you can specify the position to start the search:
Find("For", "DressesForYou", 8)
In PowerAnalyzer, use the following expression to return the same result as above:
Find(Substring("DressesForYou", 8), "For") + 7
118
Chapter 4: Functions
FISHER
Returns the Fisher transformation for a given value. Fisher returns a value that is an approximately normally distributed value rather than a skewed one. You can use the Fisher transformation to test hypothesis on the correlation coefficient. This function belongs to the Statistical category.
Syntax
Fisher(X) Argument X Datatype Numeric Description Required. Number for which you want to perform the calculation.
Return Value
Numeric
Examples
The following function returns 0.73 as the Fisher transformation for 0.62:
Fisher(0.62)
Fisher
119
FISHERINV
Returns the statistical inverse of the Fisher transformation. You can use this function when determining the relationship between ranges or arrays of data. This function belongs to the Statistical category.
Syntax
FisherInv(X) Argument X Datatype Numeric Description Required. Number for which you want to perform the calculation.
Return Value
Numeric
Examples
The following function returns 0.62 as the inverse of Fisher transformation:
FisherInv(0.73)
120
Chapter 4: Functions
FLOOR
Returns the value rounded down to the specified number of digits, towards positive infinity. The PowerAnalyzer Floor function differs from the Microsoft Excel Floor function. In the PowerAnalyzer Floor function, Significance is the number of digits to the right of the decimal point. In the Excel Floor function, Significance is the multiple to which you want to round. The PowerAnalyzer Floor function rounds a number towards positive infinity, whereas the Excel Floor function rounds a number away from zero. This function belongs to the Rounding category.
Syntax
Floor(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
The following expression returns the number rounded down to the significance, towards positive infinity:
Floor({Number}, {Significance})
Number -----2.425 -2.425 2.425 -2.425 2.425 -2.425 2.425 245 245 245 Significance -----------1 1 2 2 3 3 0 -1 -2 -3 Return Value -----------2.4 -2.5 2.42 -2.43 2.424 -2.425 2 240 200 0
Floor
121
Notes
To generate the same result as the Excel Floor(value, significance) function, use the following expression:
RoundDown(value/significance) * significance
122
Chapter 4: Functions
FORECAST
Predicts a future value based on existing values. You can use this function to determine future sales, inventory levels, or trends. You pass a single value and two sets of values (ListY and ListX) to the Forecast function. The single value is a ListX value. The function returns a predicted ListY value for the given ListX value. The function uses linear regression to predict the ListY value. Pass numeric metrics or attributes as the values for the ListY and ListX arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the ListY argument and the Context2 argument corresponds to the ListX argument. This function belongs to the Aggregate category.
Syntax
Forecast(X, ListY, ListX [, Context1, Context2]) Argument X ListY ListX Context1 Datatype Numeric Numeric List Numeric List String Description Required. Number for which you want to perform the calculation. Required. Name of a metric or attribute representing known dependent values. Required. Name of a metric or attribute representing known independent values. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 4534.59 as the forecasted sales for the year 2004 for Tshirts, given that sales for the last year were $5000:
Forecast(5000, {2004 Sales}, {2003 Sales}, "{Prod Category}='Women'"}, "{Prod Category}='Women'"})
Prod Category ------------2004 Sales ---------2003 Sales ----------
Forecast
123
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
124
Chapter 4: Functions
GAMMADIST
Returns the gamma distribution. The return value of the GammaDist function is the probability that a gamma-distributed random variable with arguments alpha and beta is less than or equal to x. You can use this function to study variables that may have a skewed distribution. This function belongs to the Statistical category.
Syntax
GammaDist(X, Alpha, Beta) Argument X Alpha Beta Datatype Numeric Numeric Numeric Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0. Required. The alpha variable. Must be greater than 0. Required. The beta variable. Must be greater than 0.
Return Value
Numeric
Examples
You need to know the time taken to send shipments from the warehouse to the store. The value of the gamma-distributed random variable (X) is 40. The value of alpha is 4 and the value of beta is 10. The following expression returns 0.567 as the gamma distribution probability:
GammaDist(40, 4, 10)
GammaDist
125
GAMMAINV
Returns the inverse of the gamma cumulative distribution. The Probability argument passed to the GammaInv function is the probability associated with the gamma cumulative distribution. Use this function to test a variable whose distribution may be skewed. This function belongs to the Statistical category.
Syntax
GammaInv(Probability, Alpha, Beta) Argument Probability Alpha Beta Datatype Numeric Numeric Numeric Description Required. Probability associated with the distribution. Must be between 0 and 1, inclusive. Required. The alpha variable. Must be greater than 0. Required. The beta variable. Must be greater than 0.
Return Value
Numeric
Examples
You need to know the time taken to send shipments from the warehouse to the store. The probability associated with the gamma cumulative distribution is 0.56. The value of alpha is 4 and the value of beta is 10. The following expression returns 40.024 as the value of X:
GammaDist(0.567, 4, 10)
126
Chapter 4: Functions
GAMMALOG
Returns the natural logarithm of the gamma function. This function belongs to the Statistical category.
Syntax
GammaLog(X) Argument X Datatype Numeric Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0.
Return Value
Numeric
Examples
The following expression returns 10.60 as the natural logarithm of the gamma function:
GammaLog(9)
Notes
The number e raised to the GammaLog(X) power equals (X - 1)!. The following expression returns 24, which is the same as 4!:
Exp(GammaLog(5))
GammaLog
127
GEOMEAN
Returns the geometric mean of a set of values, where each value must be a positive value. Pass numeric metrics or attributes as the List argument. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
GeoMean(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 5.36 as the geometric mean of the Percent Growth metric for products belonging to the Drinks and Food category:
GeoMean({Percent Growth}, "{Category}='Drinks', 'Food'")
Category -------Drinks Food Drinks Snacks Percent Growth -------------5.5 7 4 20
128
Chapter 4: Functions
GREATERTHAN
Compares two numeric values. You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
GreaterThan(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean. Returns TRUE if the first value is greater than the second value. Returns FALSE if the first value is not greater than the second value.
Examples
The following expression compares the two metrics and returns TRUE if eastern region sales are greater than western region sales:
GreaterThan({Eastern Sales}, {Western Sales})
Eastern Sales ------------200 120 122 250 Western Sales ------------220 121 122 205 Return Value -----------FALSE FALSE FALSE TRUE
GreaterThan
129
GREATERTHANEQUALS
Compares two numeric values. You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
GreaterThanEquals(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean. Returns TRUE if the first value is greater than or equal to the second value. Returns FALSE if the first value is less than the second value.
Examples
The following expression compares the two metrics and returns TRUE if eastern region sales are greater than western region sales:
GreaterThanEquals({Eastern Sales}, {Western Sales})
Eastern Sales ------------200 120 122 250 Western Sales ------------220 121 122 205 Return Value -----------FALSE FALSE TRUE TRUE
130
Chapter 4: Functions
HARMEAN
Returns the harmonic mean of a set of values, where each value must be a positive value. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. This function belongs to the Aggregate category.
Syntax
HarMean(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 14.268 as the harmonic mean of the Percent Growth metric for products belonging to the Drinks and Food category:
HarMean({Percent Growth}, "{Category}='Drinks';{Category}='Food'")
Category -------Drinks Food Drinks Snacks Percent Growth -------------13 12 20 7
HarMean
131
HOUR
Returns a number representing the hour of the day of a date value. The function returns the hour as an integer with values ranging from 0 to 23. This function belongs to the Date & Time category.
Syntax
Hour(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the hour of the day of each Date Shipped attribute value:
Hour({Date Shipped})
Date Shipped ---------------2004-03-10 2:15 2004-06-06 14:53 2004-06-01 7:20 2003-12-15 0:37 Return Value -----------2 14 7 0
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
132
Chapter 4: Functions
HYPGEOMDIST
Returns the value of the statistical hypergeometric distribution. Hypergeometric distribution is the probability of a given number of sample successes, where the sample size, population successes, and population size is known. You can use this function for experiments in which each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood. This function belongs to the Statistical category.
Syntax
HypGeomDist(X, SampleSize, Successes, PopulationSize) Argument X SampleSize Successes PopulationSize Datatype Numeric Numeric Numeric Numeric Description Required. Number for which you want to perform the calculation. Must be between 0 and Successes, inclusive. Required. Number of elements in the sample. Must be between 0 and PopulationSize, inclusive. Required. Number of successes in the population. Must be less than or equal to PopulationSize. Required. Number of elements in the population.
Return Value
Numeric
Examples
A test consists of 20 questions. For each question, the answer can be true or false. There are 8 questions with a true answer and 12 questions with a false answer. You select 4 questions at random. The following expression returns 0.363 as the probability that exactly 1 answer is true of the 4 selected questions:
HypGeomDist(1, 4, 8, 20)
HypGeomDist
133
IRR
Returns the internal rate of return for a series of cash flows represented by a set of values. These cash flows do not have to be of equal value, but they must occur at regular intervals, such as monthly or annually. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Financial category.
Syntax
IRR(CashFlows [, Context]) Argument CashFlows Context Datatype Numeric List String Description Required. Name of a metric or attribute representing a series of cash flows. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 0.12 as the internal rate of return of an investment:
IRR({Cash Flows})
Cash Flows ----------15000 10000 5000 2000 1000
Notes
The cash flows must include at least one positive and at least one negative value. To calculate the internal rate of return for cash flows that do not occur at regular intervals, use the XIRR function.
134
Chapter 4: Functions
IF
Returns one of two specified values based on the results of a condition. This function belongs to the Conditional category.
Syntax
If(If, True, False) Argument If True False Datatype Boolean Varies Varies Description Required. Boolean input for conditional test. Required. Object to be returned if test results are true. Required. Object to be returned if test results are false.
Return Value
Varies
Examples
To offer a 7% discount on products costing less than $50 and a 10% discount on all other products, use the following expression:
If(({Price} < 50), 7, 10)
Price ----45.50 69.99 5.59 Return Value -----------7 10 7
Notes
The values of the True and False arguments must be of the same datatype.
If
135
IFNULL
Returns the specified value if a condition returns NULL. Use to replace NULL in a metric or attribute. This function belongs to the Conditional category.
Syntax
IfNull(List, ReturnValue [, OtherValue]) Argument List ReturnValue OtherValue Datatype Varies Varies Varies Description Required. Name of a metric or attribute. Required. Return value if a the metric or attribute value is NULL. Optional. Return value if a metric or attribute value is not NULL.
Return Value
Varies
Examples
To grant a $1000 bonus to sales employees whose bonuses have not yet been calculated, use the following expression:
IfNull({Bonus}, 1000)
Bonus ----5000 NULL NULL 2300 Return Value -----------5000 1000 1000 2300
Notes
The values of the List, ReturnValue, and OtherValue arguments must be of the same datatype.
136
Chapter 4: Functions
INTDIVIDE
Divides one numeric value by another and returns the integer part of the quotient (result of the division). This function belongs to the Mathematical category.
Syntax
IntDivide(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression divides the value of the Profit metric by 8 and returns the integer part of the quotient:
IntDivide({Profit}, 8)
Profit -----18 24 20.25 26 Return Value -----------2 3 2 3
IntDivide
137
INTRATE
Returns the interest rate for a fully-invested security. The interest rate is expressed as a decimal number. To convert it to a percentage, multiply the interest rate by 100. This function belongs to the Financial category.
Syntax
IntRate(SettlementDate, MaturityDate, Investment, Redemption [, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Amount invested in the security. Must be greater than 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Return Value
Numeric
Examples
The following expression returns 0.055 as the interest rate for a fully-invested coupon:
IntRate(Date(2004,3,31), Date(2004,9,30), 20000, 20550, "30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
138
Chapter 4: Functions
KURT
Returns the kurtosis of a set of values. You can use kurtosis to compare the relative peakedness or flatness of a distribution with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
Kurt(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns -0.1875 as the kurtosis of the Percent Growth metric for products belonging to the Drinks and Food category:
Kurt({Percent Growth}, "{Category}='Drinks', 'Food'")
Category -------Drinks Food Drinks Snacks Drinks Snacks Food Percent Growth -------------3 2 5 7 7 9 3
Kurt
139
LEN
Returns the number of characters in a text string. This function belongs to the String category.
Syntax
Len(String) Argument String Datatype String Description Required. String value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns 14:
Len("Sacramento, CA")
The following expression returns the number of characters for each value of the State attribute:
Len({State})
State -------Ohio Hawaii New York Oregon Return Value -----------4 6 8 6
140
Chapter 4: Functions
LESSTHAN
Compares two numeric values You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
LessThan(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean. Returns TRUE if the first value is less than the second value. Returns FALSE if the first value is not less than the second value.
Examples
The following expression compares two metrics and returns TRUE if eastern region sales are less than western region sales:
LessThan({Eastern Sales}, {Western Sales})
Eastern Sales ------------200 120 122 250 Western Sales ------------220 121 122 205 Return Value -----------TRUE TRUE FALSE FALSE
LessThan
141
LESSTHANEQUALS
Compares two numeric values. You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
LessThanEquals(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean. Returns TRUE if the first value is less than or equal to the second value. Returns FALSE if the first value is greater than the second value.
Examples
The following expression compares two metrics and returns TRUE if eastern region sales were greater than western region sales:
LessThanEquals({Eastern Sales}, {Western Sales})
Eastern Sales ------------200 120 122 250 Western Sales ------------220 121 122 205 Return Value -----------TRUE TRUE TRUE FALSE
142
Chapter 4: Functions
LOG
Returns the natural logarithm of a numeric value. The Log function uses E as the base for the logarithm calculation. This function belongs to the Mathematical category.
Syntax
Log(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the natural logarithm of all values in the Number metric:
Log({Number})
Number -----10 100 835.92 2 Return Value -----------2.30 4.61 6.73 0.69
Log
143
LOG10
Returns the base 10 logarithm of a numeric value. This function belongs to the Mathematical category.
Syntax
Log10(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the base 10 logarithm of all values in the Number metric:
Log({Number})
Number -----10 100 835.92 2 Return Value -----------1.00 2.00 2.92 0.30
144
Chapter 4: Functions
LOG2
Returns the base 2 logarithm of a numeric value. This function belongs to the Mathematical category.
Syntax
Log2(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the base 2 logarithm of all values in the Number metric:
Log({Number})
Number -----10 100 835.92 2 Return Value -----------3.32 6.64 9.71 1.00
Log2
145
LOWER
Converts uppercase string characters to lowercase. This function belongs to the String category.
Syntax
Lower(String) Argument String Datatype String Description Required. String value you want to pass to the function.
Return Value
String
Examples
The following expression returns all values in the Customer Name metric in lowercase:
Lower({Customer Name})
Customer Name ------------ruby Rachel MATTHEW LeBron Return Value -----------ruby rachel matthew lebron
146
Chapter 4: Functions
MAX
Returns the maximum value of a numeric metric or attribute. This function belongs to the Aggregate category.
Syntax
Max(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 8.99 as maximum cost for products in your inventory:
Max({Cost})
Cost ---5.96 1.56 8.99 6.56
Max
147
MAX2
Returns the maximum of two numeric values. This function belongs to the Mathematical category.
Syntax
Max2(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression returns the maximum of the Domestic Sales and Overseas Sales metrics:
Max2({Domestic Sales}, {Overseas Sales})
Domestic Sales -------------500865 8000 45000 1000 Overseas Sales -------------200000 20000 1000 45000 Return Value -----------500865 20000 45000 45000
148
Chapter 4: Functions
MEDIAN
Returns the median value for a numeric metric or attribute. In a set of numeric data in ascending or descending order, the median is the value in the middle of the data set with an equal number of values distributed above and below that value. When there is an even number of values in the set, median is the average of the two numbers in the middle. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
Median(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 5.5 as the median weight for all products:
Median({Weight})
Weight -----10 5.5 3.7
Notes
This function returns the middle value when the data set has an odd number of values. It returns the average of the two middle values when the data set has even number of values. This function ignores NULLs when performing the calculation.
Median
149
MIN
Returns the minimum value of a numeric metric or attribute. This function belongs to the Aggregate category.
Syntax
Min(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 1.00 as the minimum profit margin among all products:
Min({Profit})
Profit -----2.50 1.00 7.50 1.01
150
Chapter 4: Functions
MIN2
Returns the minimum of two numeric values. This function belongs to the Mathematical category.
Syntax
Min2(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression returns the minimum of the Domestic Sales and Overseas Sales metrics:
Min2({Domestic Sales}, {Overseas Sales})
Domestic Sales -------------500865 8000 45000 1000 Overseas Sales -------------200000 20000 1000 45000 Return Value -----------200000 8000 1000 1000
Min2
151
MINUTE
Returns the minutes of the time part of a date value. The function returns the minutes as an integer with values ranging from 0 to 59. This function belongs to the Date & Time category.
Syntax
Minute(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the minutes of the hour of the Date Shipped attribute value:
Minute({Date Shipped})
Date Shipped ---------------2004-03-10 2:15 2004-06-06 14:53 2004-06-01 7:20 2003-12-15 0:37 Return Value -----------15 53 20 37
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
152
Chapter 4: Functions
MOD
Returns the modulus, the remainder of a division calculation, for any numeric metric or attribute. This function belongs to the Mathematical category.
Syntax
Mod(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
Use the following expression to determine the remainders of sales divided by 10:
Mod({Sales}, 10)
Sales ----1500 7125 3500 1095 Return Value -----------0 5 0 5
Mod
153
MODE
Returns the value that occurs most frequently in a numeric metric or attribute. When more than one value occurs at the greatest frequency, then the Mode function returns the first value to reach the greatest frequency. This function belongs to the Aggregate category.
Syntax
Mode(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 55000 as the most common salary:
Mode({Salary})
Salary -----55000 120000 35000 85000 55000
Notes
This function ignores NULLs when performing the calculation. If no value occurs more than once, PowerAnalyzer returns NULL.
154
Chapter 4: Functions
MONTH
Returns the month of a date value. The function returns the month as an integer, with values ranging from 1 (January) to 12 (December). This function belongs to the Date & Time category.
Syntax
Month(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
All of the following examples return the number 9:
Month(Date(2004, 9, 10)) Month(DateValue("15-Sep-2004")) Month(Today()), where today's date is September 10, 2004 Month(AddToDate(Today()), 0, 0, 9) where today's date is September 1, 2004 Month({Day Shipped}), where the value of the Day Shipped attribute is September 10, 2003
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
Month
155
MOVINGAVG
Returns the average (row-by-row) of a specified set of values. The Size argument defines the row set, or window, for which you want to calculate the moving average. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. This function belongs to the Running category.
Syntax
MovingAvg(List, Size [, Context]) Argument List Size Context Datatype Numeric List Numeric String Description Required. Name of a metric or attribute. Required. Number of elements for which you want to perform the calculation. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric List
Examples
If you want to calculate the moving average for the Sales metric, five rows at a time, use the following expression. The function returns the average for a set of five rows: 358 based on rows one through five, 245.8 based on rows two through six, and 243 based on rows three through seven. For the first four rows, the function does not perform the moving average calculation and returns the same value as the metric value.
MovingAvg({Sales}, 5)
Sales ----600 504 36 100 550 39 490 Return Value -----------600 504 36 100 358 245.8 243
156
Chapter 4: Functions
Notes
This function ignores NULLs when performing the calculation.
MovingAvg
157
MOVINGSUM
Returns the cumulative sum (row-by-row) of a specified set of values. The Size argument defines the row set, or window, for which you want to calculate the moving sum. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. This function belongs to the Running category.
Syntax
MovingSum(List, Size [, Context]) Argument List Size Context Datatype Numeric List Numeric String Description Required. Name of a metric or attribute. Required. Number of elements for which you want to perform the calculation. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric List
Examples
If you want to calculate the moving average for the Sales metric, five rows at a time, use the following expression. The function returns the sum for a set of five rows: 1790 based on rows one through five, 1229 based on rows two through six, and 1215 based on rows three through seven. For the first four rows, the function does not perform the moving sum calculation and returns the same value as the metric value.
MovingSum({Sales}, 5)
Sales ----600 504 36 100 550 39 490 Return Value -----------600 504 36 100 1790 1229 1215
158
Chapter 4: Functions
Notes
This function ignores NULLs when performing the calculation.
MovingSum
159
MULTIPLY
Returns the product of one numeric value multiplied by another. This function belongs to the Mathematical category.
Syntax
Multiply(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression multiplies the values of the Profit per Item and Quantity Sold metrics:
Multiply({Profit per Item}, {Quantity Sold})
Profit per Item --------------5 2 0 3 Quantity Sold ------------600 504 36 100 Return Value -----------3000 1008 0 300
160
Chapter 4: Functions
NPV
Calculates the net present value of an investment by using a discount rate and a series of cash flows. Use a metric to pass the cash flow values to the function. These cash flows do not have to be of equal value, but they must occur at regular periods of time, such as monthly or annually. In the cash flow, negative values represent future payments and positive values represent income. As the value of the Rate argument, pass the rate of discount over the length of one period. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Financial category.
Syntax
NPV(CashFlows, Rate [, CurrencyDecimals, Context]) Argument CashFlows Rate Datatype Numeric List Numeric Description Required. Name of a metric or attribute representing a series of cash flows. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
CurrencyDecimals Context
Numeric String
Return Value
Numeric
Examples
The following expression returns 31807.54 as the net present value of the asset after five months:
NPV({Cash Flows}, 0.12, "{Month}='January', 'February', 'March', 'April', 'May'")
Month --------January February March April Cash Flows ---------13253.74 6392.94 10502.07 5420.59
NPV
161
Notes
When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
162
Chapter 4: Functions
NPER
Returns the number of periods for an investment based on a constant interest rate and periodic, constant payments. The value of the Rate argument is the interest rate earned in each period. PresentValue is the lump-sum amount that a series of future payments is worth now. FutureValue is the cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the NPer function assumes it to be 0. For example, the future value of a loan is 0. This function belongs to the Financial category.
Syntax
NPer(Rate, PresentValue, Payment [, FutureValue, PaymentAtBeginning]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Current value of an asset or liability. Required. Payment amount due. Must not equal 0. Optional. Worth of an asset in the future. Optional. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE.
Return Value
Numeric
Examples
The present value of an investment is $2,000. Each payment is $500 and the future value of the investment is $20,000. The following expression returns 9 as the number of periods for which you need to make the payments:
NPer(0.01, -2000, -500, 20000, TRUE)
Notes
To calculate interest rate earned in each period, divide the annual rate by the number of payments made in an year. For example, if you make monthly payments at an annual interest rate of 15 percent, the value of the Rate argument is 15% divided by 12. If you make annual payments, the value of the Rate argument is 15%. The payment value and present value are negative because these are amounts that you pay.
NPer
163
NEGATE
Adds the minus sign to a positive number or removes the minus sign from a negative number. You can use the Negate function with a numeric metric, numeric attribute, or a calculated numeric value. You can also use this function within other functions, where you need to change the sign of a numeric value. This function belongs to the Unary category.
Syntax
Negate(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns -10:
Negate(10)
164
Chapter 4: Functions
NEXT
Returns the next value for the specified metric. This function belongs to the Fetch category.
Syntax
Next(Metric) Argument Metric Datatype Varies Description Required. Metric for which you want to get the value.
Return Value
Varies
Examples
The following expression returns the revenue from the next row:
Next({Revenue})
Revenue ------1500 7125 3500 1090 Return Value -----------7125 3500 1090 NULL
Notes
The function returns NULL if the specified value is the last value in the metric.
Next
165
NEXTDATE
Returns the next date in a period or payment schedule. This function belongs to the Date & Time category.
Syntax
NextDate(Date, Frequency [, NumberPeriods]) Argument Date Frequency Datatype Date String Description Required. Date value you want to pass to the function. Required. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Number of periods or payments. Must be greater than 0.
NumberPeriods
Numeric
Return Value
Date
Examples
The following expression returns December 30, 2004 as the next payment date for a loan:
NextDate(Date(2004,6,30),"semiannual")
You can pass the NumberPeriods argument to get the payment date after a given number of periods. For example, the following expression returns December 30, 2007 as the date for the 7th payment:
NextDate(Date(2004,6,30),"semiannual", 7)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
166
Chapter 4: Functions
NOMINAL
Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year. This function belongs to the Financial category.
Syntax
Nominal(Rate, NumberPeriods) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than 0. Required. Number of periods or payments. Must be greater than 0.
NumberPeriods
Numeric
Return Value
Numeric
Examples
The effective interest rate for a security is 7.25%. The number of compounding periods per year is four. The following expression returns 0.070 as the nominal interest rate:
Nominal(0.0725, 4)
Notes
To calculate the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year, use the Effect function.
Nominal
167
NORMDIST
Returns the normal distribution for a number, given the mean and standard deviation. Normal distributions have a wide range of applications in statistics. You can use the NormDist function to derive many kinds of statistical tests. If you pass TRUE as the value of the Cumulative argument, NormDist returns the cumulative distribution calculation. If you pass FALSE as the value of the Cumulative argument, the function returns the probability mass calculation. This function belongs to the Statistical category.
Syntax
NormDist(X, Mean, StdDev, Cumulative) Argument X Mean StdDev Cumulative Datatype Numeric Numeric Numeric Boolean Description Required. Number for which you want to perform the calculation. Required. Average of a list of numbers. Required. Standard deviation of a list of numbers. Must be greater than 0. Required. Logical value that determines the form of the function. If cumulative is TRUE, the function returns the cumulative answer. Otherwise, it does not return the cumulative answer.
Return Value
Numeric
Examples
The mean time to process an order is 30 days and the standard deviation is 5. You want to find the probability that an order will be processed in 35 days or less. The following expression returns 0.841 as the value of the normal cumulative distribution:
NormDist(35, 30, 5, true)
If you want to find the probability that an order will be processed in exactly 35 days, pass FALSE as the value of the Cumulative argument. The following expression returns the value 0.048:
NormDist(35, 30, 5, false)
Notes
If you pass zero as the value of the Mean argument and one as the value of the StdDev argument, the NormDist function returns the same result as the NormSDist (standard normal distribution) function.
168 Chapter 4: Functions
NORMINV
Returns the inverse of the normal cumulative distribution, given the mean and standard deviation. The Probability argument passed to the NormInv function is the probability associated with the normal distribution. This function belongs to the Statistical category.
Syntax
NormInv(Probability, Mean, StdDev) Argument Probability Mean StdDev Datatype Numeric Numeric Numeric Description Required. Probability associated with the distribution. Required. Average of a list of numbers. Required. Standard deviation of a list of numbers. Must be greater than 0.
Return Value
Numeric
Examples
You are analyzing the time it takes for to process customer orders. The mean time to process an order is 30 days and the standard deviation is 5. For a probability of 0.85, you want to find the maximum number of days it will take to process an order. The following expression returns the value 35.18 (or about 35 days):
NormInv(0.85, 30, 5)
NormInv
169
NORMSDIST
Returns the standard normal cumulative distribution, where the mean is zero and the standard deviation is one. This function belongs to the Statistical category.
Syntax
NormSDist(X) Argument X Datatype Numeric Description Required. Number for which you want to perform the calculation.
Return Value
Numeric
Examples
The following expression returns 0.869 as the value of the standard normal cumulative distribution:
NormSDist(1.12)
170
Chapter 4: Functions
NORMSINV
Returns the inverse of the standard normal cumulative distribution. In a standard normal cumulative distribution the mean is zero and the standard deviation is one. The Probability argument passed to the NormSInv function is the probability associated with the standard normal cumulative distribution. This function belongs to the Statistical category.
Syntax
NormSInv(Probability) Argument Probability Datatype Numeric Description Required. Probability associated with the distribution.
Return Value
Numeric
Examples
The following expression returns 1.121 as the inverse of the standard normal cumulative distribution:
NormSInv(0.869)
NormSInv
171
NOT
Returns the reverse of a TRUE or FALSE value passed to the function. If you pass TRUE, the Not function returns FALSE. If you pass FALSE, the Not function returns TRUE. Use this function within an expression, where you want get the reverse Boolean value of a given value. This function belongs to the Boolean category.
Syntax
Not(BooleanValue) Argument BooleanValue Datatype Boolean Description Required. Boolean condition you want to pass to the function.
Return Value
Boolean
Examples
The following expression returns FALSE:
Not(10>7)
172
Chapter 4: Functions
NOTEQUALS
Compares two numeric values. You can use this function to compare metrics or attributes to other metrics, attributes, or constant values. This function belongs to the Comparative category.
Syntax
NotEquals(Compare1, Compare2) Argument Compare1 Compare2 Datatype Varies Varies Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Value you want to compare. You can pass a numeric, date, or string value.
Return Value
Boolean. Returns TRUE if the first value is not equal to the second value. Returns FALSE if the two values are equal.
Examples
The following expression compares two metrics and returns TRUE if the Price in 2004 is different than the Price in 2004:
NotEquals({Price in 2003}, {Price in 2004})
Price in 2003 ------------2.01 5.2 12 9.5 Price in 2003 ------------3.66 7.85 12 8 Return Value -----------TRUE TRUE FALSE TRUE
NotEquals
173
NOW
Returns the value of the current date and time. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
Now()
Return Value
Date
Examples
The following expression returns 12 given that today's date is June 3, 2004 and the current time is 12:30 pm:
Hour(Now())
174
Chapter 4: Functions
NUMBERSTRING
Converts a number into a string. Use this function to pass values to other functions that take string arguments. This function belongs to the String category.
Syntax
NumberString(X) Argument X Datatype Numeric Description Required. Number for which you want to perform the calculation.
Return Value
String
Examples
The following expression converts values in the Customer Rating attribute to strings:
NumberString({Customer Rating})
Customer Rating --------------6 5.2 3 9.5 Return Value -----------5 5.2 3 9.5
NumberString
175
OR
Compares two conditions and returns TRUE if either of the two conditions is TRUE. Returns FALSE if both conditions are FALSE. You can use metric and attribute names in the arguments. This function belongs to the Boolean category.
Syntax
Or(BooleanValue1, BooleanValue2) Argument BooleanValue1 BooleanValue2 Datatype Boolean Boolean Description Required. Boolean condition you want to pass to the function. Required. Boolean condition you want to pass to the function.
Return Value
Boolean
Examples
The following expression returns FALSE:
Or(1-1=1,3+2=4)
Use the following expression find the products for which sales > 20000 or cost < 5000:
Or({Sales}>20000, {Cost}<5000)
Sales ----22000 52820 9000 19000 Cost ----5500 25000 6000 9500 Return Value -----------TRUE TRUE FALSE FALSE
176
Chapter 4: Functions
PV
Returns the present value of an investment. The present value is the lump-sum amount that a series of future payments is worth now. Rate is the interest rate earned in each period. FutureValue is the cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the PV function assumes it to be 0. For example, the future value of a loan is 0. This function belongs to the Financial category.
Syntax
PV(Rate, NumberPeriods, Payment [, FutureValue, PaymentAtBeginning, CurrencyDecimals]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Number of periods or payments. Must be greater than 0. Required. Payment amount due. Optional. Worth of an asset in the future. Optional. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns 12,524.43 as the amount that you must deposit in the account today to have a future value of $20000 in one year:
PV(0.0075, 12, -500, 20000, TRUE)
PV
177
PEARSON
Returns the Pearson product moment correlation coefficient (r). The value of the Pearson product moment correlation coefficient is in the range -1.0 to 1.0, inclusive. You can use this function to determine the extent of a linear relationship between two sets of values (ListY and ListX). Pass numeric metrics or attributes as the values for the ListY and ListX arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. This function belongs to the Aggregate category.
Syntax
Pearson(List1, List2 [, Context1, Context2]) Argument List1 List2 Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute. Required. Name of a metric or attribute. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.1685 as the Pearson product moment correlation coefficient for sales in the year 2003 and sales in the year 2004 for products in the Women category:
Pearson({2004 Sales}, {2003 Sales}, "{Prod Category}='Women'"}, "{Prod Category}='Women'"})
Prod Category ------------Women Women Men 2004 Sales ---------1500 5000 38088 2003 Sales ---------2500 2250 10502
178
Chapter 4: Functions
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
Pearson
179
PERCENTCONTRIBUTION
For a set of values, returns each value as the percentage of the sum of all values in the set. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. This function belongs to the Running category.
Syntax
PercentContribution(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric List
Examples
Use the following expression to display the revenue for each product category as a percentage of the total revenue:
PercentContribution({Revenue})
Revenue -------25661.79 25597.34 38088.29 26977.24 28195.74 Return Value -----------17.76 17.71 26.35 18.67 19.51
Notes
This function ignores NULLs when performing the calculation.
180
Chapter 4: Functions
PERCENTILE
Calculates the value that falls at a given percentile in a group of numbers. Optionally, you can use the Context argument to limit the values you want to pass to the function to calculate the percentile. This function belongs to the Statistical category.
Syntax
Percentile(List, Percentile [, Context]) Argument List Percentile Context Datatype Numeric List Numeric String Description Required. Name of a metric or attribute. Required. Percentile you want to calculate. Must be between 0 and 100, inclusive. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 106250.0 as the salary that falls at the 75th percentile of salaries greater than $50,000:
Percentile({Salary}, 75, "{Salary} > 50000")
Salary -------125000.0 27900.0 100000.0 NULL 55000.0 9000.0 85000.0 86000.0 48000.0 99000.0
Percentile
181
Notes
If a value is NULL, the function ignores the row.
182
Chapter 4: Functions
PERIODSPERYEAR
Returns the number of periods per year, given the frequency of payments. You can use this function to pass the period value to other financial functions. This function belongs to the Financial category.
Syntax
PeriodsPerYear([Frequency]) Argument Frequency Datatype String Description Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks.
Return Value
Numeric
Examples
The following expression returns 52 as the number of periods when you need to make weekly payments:
PeriodsPerYear("Weekly")
PeriodsPerYear
183
PLUS
Removes the plus sign from a given numeric value. If the given value does not have a plus sign, the function returns the same value. You can use this function with a numeric metric, numeric attribute, or a calculated numeric value. This function belongs to the Unary category.
Syntax
Plus(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression removes the plus sign from the values in the Profit metric:
Plus({Profit})
Profit -----+600 520 -35 950 Return Value -----------600 520 -35 950
184
Chapter 4: Functions
PMT
Returns the payment for a loan based on constant payments and a constant interest rate. The Rate argument is the interest rate for the loan for each period. The PresentValue is the principal for the loan. The FutureValue is cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the Pmt function assumes it to be 0. This function belongs to the Financial category.
Syntax
Pmt(Rate, NumberPeriods, PresentValue [, FutureValue, PaymentAtBeginning, CurrencyDecimals]) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Number of periods or payments. Must be greater than 0. Required. Current value of an asset or liability. Optional. Worth of an asset in the future. Optional. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns -2111.64 as the monthly payment amount of a loan:
Pmt(0.01, 10, 20000)
Notes
To calculate interest rate earned in each period, divide the annual rate by the number of payments made in an year. For example, if you make monthly payments at an annual interest rate of 15 percent, the value of the Rate argument is 15% divided by 12. If you make annual payments, the value of the Rate argument is 15%. The payment value is negative because these are amounts that you pay.
Pmt
185
POWER
Returns the value of a number raised to an exponent. The first argument you pass to the function is the base value. The second argument you pass to the function is the exponent. This function belongs to the Mathematical category.
Syntax
Power(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression returns the result of the Numbers metric raised to the Exponent metric:
Power({Numbers}, 2)
Numbers ------10 220 -3 8.5 Return Value -----------100 48400 9 72.25
Notes
If the base value is negative, the exponent must be an integer. In this case, the function rounds any decimal values to the nearest integer before returning a value.
186
Chapter 4: Functions
PREVIOUS
Returns the previous value for the specified metric or attribute. This function belongs to the Fetch category.
Syntax
Previous(Metric) Argument Metric Datatype Varies Description Required. Metric for which you want to get the value.
Return Value
Varies
Examples
The following expression returns the revenue from the previous quarter:
Previous({quarterly_revenue})
Quarterly Revenue ----------------1500 7125 3500 1090 Return Value -----------NULL 1500 7125 3500
Notes
PowerAnalyzer returns NULL if the specified value is the first value in the metric or attribute.
Previous
187
PRICE
Returns the price per $100 face value of a security that pays periodic interest. This function belongs to the Financial category.
Syntax
Price(SettlementDate, MaturityDate, Rate, Yield, Redemption [, Frequency, DayCountBasis, CurrencyDecimals]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Yield of security, expressed as a decimal number. Divide the percent yield by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
MaturityDate Rate
Date Numeric
Yield
Numeric
Redemption Frequency
Numeric String
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns $863.57 as the price of a bond:
Price(Date(2004,3,31), Date(2006,9,30), 0.05, 0.065, 1000, "semiannual", "30E+/360")
188
Chapter 4: Functions
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
Price
189
PRICEDISC
Returns the price per $100 face value of a discounted security. This function belongs to the Financial category.
Syntax
PriceDisc(SettlementDate, MaturityDate, Discount, Redemption [, DayCountBasis, CurrencyDecimals]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Discount rate of a security, expressed as a decimal number. Divide the percent discount rate by 100 to express it as a decimal number. Must be greater than 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
MaturityDate Discount
Date Numeric
Redemption DayCountBasis
Numeric String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns $87.50 as the price of a discounted bond:
PriceDisc(Date(2004,3,31), Date(2006,9,30), 0.05, 100, "30E+/360")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
190 Chapter 4: Functions
PRICEMAT
Returns the price per $100 face value of a security that pays interest at maturity. This function belongs to the Financial category.
Syntax
PriceMat(SettlementDate, MaturityDate, IssueDate, Rate, Yield [, DayCountBasis, CurrencyDecimals]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Date when the security was issued. Must be less than or equal to SettlementDate. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Yield of security, expressed as a decimal number. Divide the percent yield by 100 to express it as a decimal number. Must be greater than or equal to 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
Yield
Numeric
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns $96.60 as the price of a bond that pays interest at maturity:
PriceMat(Date(2004,3,31), Date(2006,9,30), Date(2004, 1, 1), 0.05, 0.065, "ACT/ACT")
PriceMat
191
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
192
Chapter 4: Functions
PRODUCT
Returns the result of multiplying values in a numeric metric or attribute. This function belongs to the Aggregate category.
Syntax
Product(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 1200 as the product of the Customer Count metric:
Product({Customer Count})
Customer Count -------------10 3 8 5
Notes
This function ignores NULLs when performing the calculation.
Product
193
RATE
Returns the interest rate earned per period by a security. PresentValue is the lump-sum amount that a series of future payments is worth now. FutureValue is cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the Rate function assumes it to be 0. For example, the future value of a loan is 0. This function belongs to the Financial category.
Syntax
Rate(NumberPeriods, Payment, PresentValue [, FutureValue, PaymentAtBeginning, CurrencyDecimals]) Argument NumberPeriods Payment PresentValue FutureValue PaymentAtBeginning Datatype Numeric Numeric Numeric Numeric Boolean Description Required. Number of periods or payments. Must be greater than 0. Required. Payment amount due. Required. Current value of an asset or liability. Optional. Worth of an asset in the future. Optional. Timing of the payment. Enter TRUE if payment is at the beginning of period. Enter FALSE if payment is at the end of period. Default is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns 0.0077 as the monthly interest rate of a loan:
Rate(48, -500, 20000)
To calculate the yearly interest rate multiply 0.0077 by 12, which equals 0.0924 or 9.24%.
Notes
The payment value is negative because these are amounts that you pay.
194
Chapter 4: Functions
RATETODF
Returns the discount factor, given the rate. The discount factor is a number that is multiplied by a monetary value to reduce an expected future sum to its present value. You can use the discount factor to evaluate the return on a capital investment, by calculating the present value of future cash flows. This function is the reverse of the DfToRate function. Use the RateToDf function to compute the rate when the discount factor is known. This function belongs to the Financial category.
Syntax
RateToDf(Rate, RateConvention, ElapsedYears) Argument Rate Datatype Numeric Description Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Convention of quoting the rate. The rate can be "annual", "semiannual", "quarterly", "monthly", "weekly", "daily", "discount", "simple" or "continuous". Default value is "annual". Enclose the rate convention within quotation marks. Required. Elapsed years, expressed as a decimal number. Must be greater than or equal to 0.
RateConvention
String
ElapsedYears
Numeric
Return Value
Numeric
Examples
The following expression returns 0.3 as the discount factor:
RateToDf(0.054, "annual", 5)
RateToDf
195
RECEIVED
Returns the amount received when a fully invested security matures. This function belongs to the Financial category.
Syntax
Received(SettlementDate, MaturityDate, Investment, Discount [, DayCountBasis, CurrencyDecimals]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Amount invested in the security. Must be greater than 0. Required. Discount rate of a security, expressed as a decimal number. Divide the percent discount rate by 100 to express it as a decimal number. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
DayCountBasis
String
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
The following expression returns $21,352.31 as the amount received when a fully invested bond matures:
Received(Date(2004,3,31), Date(2004,11,30), 20000, 0.095, "ACT/ACT")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
196
Chapter 4: Functions
REPLACE
Replaces a character string, or a part of a character string, with a new character string that you specify. You can specify where to start the replacement and the number of characters to replace. Use the Replace function when you want to replace any text that occurs in a specific location in a character string. This function belongs to the String category.
Syntax
Replace(String, Start, Count, Replace) Argument String Start Count Replace Datatype String Numeric Numeric String Description Required. String value you want to pass to the function. Required. Position where you want to start. For example, 1 represents the first position. Must not equal 0. Required. Number of characters. Must be greater than or equal to 0. Required. Replacement string.
Return Value
String
Examples
The following expression:
Replace("I left my heart in San Francisco.", 11, 5, "lung")
Notes
Use the Substitute function when you want to replace specific text in a text string.
Replace
197
REPT
Repeats text a given number of times. You can use the Rept function for formatting purposes. For example, you can display an attribute value multiple times within a single cell in the report. This function belongs to the String category.
Syntax
Rept(String, RepeatCount) Argument String RepeatCount Datatype String Numeric Description Required. String value you want to pass to the function. Required. Number of times you want to repeat the string. Must be greater than or equal to 0.
Return Value
String
Examples
Use the following expression to display the value for the Product Category attribute two times:
Rept({Product Category}, 2)
Product Category ---------------Boys Girls Men Women Return Value -----------BoysBoys GirlsGirls MenMen WomenWomen
198
Chapter 4: Functions
ROUND
Returns all values rounded to the specified number of digits. This function belongs to the Rounding category.
Syntax
Round(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
Use the following expression to round all values of the Dollar Cost metric to the cent:
Round({Dollar Cost}, 2)
Dollar Cost ----------15.846 8.43333333 9.0623 11.193 Return Value -----------15.85 8.43 9.06 11.19
Notes
Returns the same value if the significance is greater than the scale of the value.
Round
199
ROUNDDOWN
Returns a value rounded down N number of places to the right of the decimal point. If N is a negative number, rounds down N places left of the decimal point. This function belongs to the Rounding category.
Syntax
RoundDown(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
Use the following expression to round down the values of the Cost metric a given number of places to the right of the decimal point:
RoundDown({Cost}, {Significance})
Cost ------25.4469 8.85676 149.42 42.2131 4.23 4.23 Significance -----------3 2 -2 2 5 0 Return Value -----------25.446 8.85 100 42.21 4.23001 4
Notes
Returns the same value if the significance is greater than the scale of the value.
200
Chapter 4: Functions
ROUNDUP
Returns a value rounded up N number of places to the right of the decimal point. If N is a negative number, rounds up N places left of the decimal point. This function belongs to the Rounding category.
Syntax
RoundUp(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
Use the following expression to round up the values of the Cost metric a given number of places to the right of the decimal point:
RoundUp({Cost}, {Significance})
Cost ------25.4469 8.85676 149.42 42.2131 4.23 4.23 Significance -----------3 2 -2 2 5 0 Return Value -----------25.447 8.86 200 42.22 4.23 5
RoundUp
201
RUNNINGAVG
Returns the average of the current value and all previous values in a row or column. Running average is different than moving average, because moving average is always for a specified group of values (Size argument). The MovingAvg function performs the calculation for each group of values at a time. RunningAvg function starts at the beginning and runs through the entire set of values, recalculating at each value. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. This function belongs to the Running category.
Syntax
RunningAvg(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric List
Examples
Use the following expression to display the running average of monthly sales:
RunningAvg({Monthly Sales}, "@COLUMN")
Month -------January February March April May Monthly Sales ------------25661.79 25597.34 38088.29 26977.24 28195.74 Return Value -----------25661.79 25629.57 29782.47 29081.17 28904.08
Notes
This function ignores NULLs when performing the calculation.
202
Chapter 4: Functions
RUNNINGSUM
Returns the total of the current value and all previous values in a row or column. Running sum is different than moving sum, because moving sum is always for a specified group of values (Size argument). The MovingSum function performs the calculation for each group of values at a time. RunningSum function starts at the beginning and runs through the entire set of values, recalculating at each value. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. This function belongs to the Running category.
Syntax
RunningSum(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric List
Examples
Use the following expression to display the running sum of monthly sales:
RunningSum({Monthly Sales}, "@COLUMN")
Month -------January February March April May Monthly Sales ------------25661.79 25597.34 38088.29 26977.24 28195.74 Return Value -----------25661.79 51259.13 89347.42 116324.66 144520.40
Notes
This function ignores NULLs when performing the calculation.
RunningSum
203
SLN
Returns the straight-line depreciation of an asset for one period. This function belongs to the Financial category.
Syntax
SLn(Cost, Salvage, Life [, CurrencyDecimals]) Argument Cost Salvage Life CurrencyDecimals Datatype Numeric Numeric Numeric Numeric Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number of periods over which an asset is being depreciated. Must be greater than 0. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
Return Value
Numeric
Examples
An office chair costs $1,000 and has a life of 8 years. The salvage value of the chair is $175. The following expression returns $103.13 as the depreciation of the chair in each year using the straight-line depreciation method:
SLn(1000, 175, 8)
204
Chapter 4: Functions
SYD
Returns the depreciation of an asset using the sum-of-years' digits method for a given period. This function belongs to the Financial category.
Syntax
SYD(Cost, Salvage, Life, Period [, CurrencyDecimals]) Argument Cost Salvage Life Period Datatype Numeric Numeric Numeric Numeric Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number of periods over which an asset is being depreciated. Must be greater than 0. Required. Number representing the period for which you want to perform the calculation. Default is the same as the value of the Life argument. Must be greater than 0. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
Examples
A machine costs $2,500 and has a life of 8 years. The salvage value of the machine is $750. The following expression returns $388.89 as the depreciation allowed in the first year:
SYD(2500, 750, 8, 1)
The following expression returns $48.61 as the depreciation allowed in the eighth year:
SYD(2500, 750, 8, 8)
SYD
205
SEC
Returns the secant of a numeric value. This function belongs to the Trigonometric category.
Syntax
Sec(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the secant for all values of the Angles metric:
Sec({Angles})
Angles -----10 0.5 -2.5 NULL Return Value ------------1.19 1.14 -1.25 NULL
206
Chapter 4: Functions
SECH
Returns the hyperbolic secant of a numeric value. This function belongs to the Trigonometric category.
Syntax
Sech(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the hyperbolic secant for all values of the Angles metric:
Sech({Angles})
Degrees ------1.0 2.51 0 -0.2 Return Value -----------0.65 0.16 1.00 0.98
Sech
207
SECOND
Returns the second of the time part of a date value. The function returns the second as an integer with values ranging from 0 to 59. This function belongs to the Date & Time category.
Syntax
Second(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the second of the minute of the Date Shipped attribute value:
Second({Date Shipped})
Date Shipped ------------------2004-03-10 2:15:15 2004-06-06 14:53:22 2004-06-01 7:20:00 2003-12-15 0:37:05 Return Value -----------15 22 00 05
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
208
Chapter 4: Functions
SIGN
Returns whether a numeric value is positive, negative, or 0. You can use this function with a numeric metric, numeric attribute, or a calculated numeric value. This function belongs to the Unary category.
Syntax
Sign(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric. Returns -1 for negative values, 0 for 0, and +1 for positive values.
Examples
To find out if the Profit metric includes any negative values, use the following expression.
Sign({Profit})
Profit -----1584 -843 0 NULL Return Value -----------1 -1 0 NULL
Sign
209
SIN
Returns the sine of a numeric value. This function belongs to the Trigonometric category.
Syntax
Sin(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric. The value is in the range -1 to +1.
Examples
The following expression returns the sine for the values of the Angles metric:
Sin({Angles})
Angles -----0.92 1.5 3.25 NULL Return Value -----------0.80 1.00 -0.11 NULL
210
Chapter 4: Functions
SINH
Returns the hyperbolic sine of a numeric value. This function belongs to the Trigonometric category.
Syntax
Sinh(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the hyperbolic sine for all values of the Angles metric:
Sinh({Angles})
Degrees ------1.0 5.45 0.32 2.89 Return Value -----------1.18 116.38 0.33 8.97
Sinh
211
SKEW
Returns the statistical skewness of a distribution. Skewness is the degree of asymmetry of a distribution around its mean. A distribution is symmetric if it looks the same to the left and right of the center point. Positive skewness means the distribution has an asymmetric tail towards more positive values. Negative skewness means the distribution has an asymmetric tail towards more negative values. This function belongs to the Aggregate category.
Syntax
Skew(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns -0.98 as the skewness of the sales growth of different products in the month of January:
Skew({Sales Growth}, "{Month}='January'")
Product ------Books Apparel Toys Bicyles Shoes Sales Growth ------------2846.15 -375.88 2179.39 569.74 935.80
Notes
The metric or attribute you pass to the Skew function must have three or more values and must not have a sample standard deviation of 0. If there are less than three data values, or if the sample standard deviation is 0, the functions returns the following value: undefined.
212
Chapter 4: Functions
SLOPE
Returns the slope of the linear regression line that runs through values in two lists (ListY and ListX). The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line. Use numeric metric or attribute names as values of the ListY and ListX arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The first Context argument corresponds to the ListY argument and the second Context argument corresponds to the ListX argument. This function belongs to the Aggregate category.
Syntax
Slope(ListY, ListX [, Context1, Context2]) Argument ListY ListX Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute representing known dependent values. Required. Name of a metric or attribute representing known independent values. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.40 as the slope of the linear regression line that runs through values in the Sales and Cost metrics:
Slope({Sales}, {Cost})
Sales -------25661.79 25597.34 38088.29 Cost -------13253.74 6392.94 10502.07
Slope
213
26977.24 28195.74
5420.59 6974.26
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation.
214
Chapter 4: Functions
SQRT
Returns the square root of a given positive number. The square root of a negative number is not a value. This function belongs to the Mathematical category.
Syntax
Sqrt(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function. Must be greater than or equal to 0.
Return Value
Numeric
Examples
The following expression returns 7.28011:
Sqrt(53)
Sqrt
215
SQUARE
Returns the square of a given number. This function belongs to the Mathematical category.
Syntax
Square(NumericValue) Argument NumericValue Datatype Numeric Description Required. Numeric value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns 100.00:
Square(10)
216
Chapter 4: Functions
STANDARDIZE
Returns the normalized value for a distribution, given the mean and standard deviation. This function belongs to the Statistical category.
Syntax
Standardize(X, Mean, StdDev) Argument X Mean StdDev Datatype Numeric Numeric Numeric Description Required. Number for which you want to perform the calculation. Required. Average of a list of numbers. Required. Standard deviation of a list of numbers. Must be greater than 0.
Return Value
Numeric
Examples
The following expression returns 1.74 as the normalized value for 32:
Standardize(32,30,1.15)
Standardize
217
STDEV
Returns the standard deviation, treating values for a numeric metric or attribute as a sample population. The metric or attribute must include at least two values. This function belongs to the Aggregate category.
Syntax
Stdev(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 5244.31 as the standard deviation of the Revenue metric:
Stdev({Revenue})
Revenue -------25661.79 25597.34 38088.29 26977.24 28195.74
Notes
This function ignores NULLs when performing the calculation. This function returns NULL if the provided list includes less than two values.
218
Chapter 4: Functions
STDEVP
Returns the standard deviation, treating values for a numeric metric or attribute as a complete population. The metric or attribute must include at least two values. This function belongs to the Aggregate category.
Syntax
StdevP(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 4690.65 as the standard deviation of population of the Revenue metric:
StdevP({Revenue})
Revenue -------25661.79 25597.34 38088.29 26977.24 28195.74
Notes
This function ignores NULLs when performing the calculation. This function returns NULL if the provided list includes less than two values.
StdevP
219
STEYX
Returns the statistical standard error of linear regression between two lists of values (ListY and ListX). The standard error is a measure of the amount of error in the prediction of a Y value for an X value. Use metric or numeric attribute names as values of the ListY and ListX arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The first Context argument corresponds to the ListY argument and the second Context argument corresponds to the ListX argument. This function belongs to the Aggregate category.
Syntax
Steyx(ListY, ListX [, Context1, Context2]) Argument ListY ListX Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute representing known dependent values. Required. Name of a metric or attribute representing known independent values. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 3662.55 as the standard error of linear regression between values in the Cost and Sales metrics:
Steyx({Cost}, {Sales})
Sales -------25661.79 25597.34 38088.29 26977.24 Cost -------13253.74 6392.94 10502.07 5420.59
220
Chapter 4: Functions
28195.74
6974.26
Notes
The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation.
Steyx
221
SUBSTITUTE
Replaces a string of text with a new string of text that you specify. You can specify where to start the replacement and the number of characters to replace. Use the Substitute function when you want to replace specific text in a text string. This function belongs to the String category.
Syntax
Substitute(String, Find, Replace [, Instance]) Argument String Find Replace Instance Datatype String String String Numeric Description Required. String value you want to pass to the function. Required. String to find within other string. Required. Replacement string. Optional. The Nth instance of the string to find. Default is 1, the first instance.
Return Value
String
Examples
The following expression:
Substitute("The product sales are low...", ".", "!")
To replace only a specific instance of a text, specify the Nth instance of the text:
Substitute("The product sales are low...", ".", "!", 2)
Notes
Use the Replace function when you want to replace any text that occurs in a specific location in a text string.
222
Chapter 4: Functions
SUBSTRING
Returns a portion of a string. The Substring function counts all characters, including blanks, starting at the beginning of the string. This function belongs to the String category.
Syntax
Substring(String, Start [, Count]) Argument String Start Count Datatype String Numeric Numeric Description Required. String value you want to pass to the function. Required. Position where you want to start. For example, 1 represents the first position. Must not equal 0. Optional. Number of characters.
Return Value
String
Examples
The following expression returns the area code for each value of the Phone attribute:
Substring({Phone}, 1, 3)
Phone -----------809-555-0269 650-593-3851 415-385-5391 720-780-7993 Return Value -----------809 650 415 720
Notes
You must pass an integer as the value of the Start argument. If you pass a positive number, the function locates the start position by counting from the beginning of the string. If you pass a negative number, the function locates the start position by counting from the end of the string. If you pass zero, the function returns an empty string. You must pass an integer as the value of the Count argument. If you pass a positive number, the function returns characters to the right of the start position, inclusive. If you pass a negative number, the function returns characters to the right of the start position, inclusive. If you pass zero, the function returns an empty string. If you omit the Count argument, the function returns all characters from the start position to the end of the string.
Substring
223
SUBTRACT
Returns the result of one numeric value subtracted by another. This function belongs to the Mathematical category.
Syntax
Subtract(NumericValue1, NumericValue2) Argument NumericValue1 NumericValue2 Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
The following expression subtracts the value of the Sales metric from the value of the Cost metric:
Subtract({Sales}, {Cost})
Sales -------25661.79 25597.34 38088.29 26977.24 28195.74 Cost -------13253.74 6392.94 10502.07 5420.59 6974.26 Return Value -----------12408.05 19204.40 27586.22 21556.65 21221.48
224
Chapter 4: Functions
SUM
Returns the sum of all values This function belongs to the Aggregate category.
Syntax
Sum(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 44.52 as the total cost:
Sum({Cost})
Cost ----15.84 8.43 9.06 11.19
Sum
225
TBILLEQ
Returns the bond-equivalent yield for a Treasury bill. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. This function belongs to the Financial category.
Syntax
TBillEq(SettlementDate, MaturityDate, Discount) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Discount rate of a security, expressed as a decimal number. Divide the percent discount rate by 100 to express it as a decimal number. Must be greater than 0.
MaturityDate Discount
Date Numeric
Return Value
Numeric
Examples
The following expression returns 0.08 as the bond-equivalent yield for a Treasury bill:
TBillEq(Date(2004,3,31), Date(2004,11,30), 0.075)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
226
Chapter 4: Functions
TBILLPRICE
Returns the price per $100 face value for a Treasury bill. This function belongs to the Financial category.
Syntax
TBillPrice(SettlementDate, MaturityDate, Discount) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Discount rate of a security, expressed as a decimal number. Divide the percent discount rate by 100 to express it as a decimal number. Must be greater than 0.
MaturityDate Discount
Date Numeric
Return Value
Numeric
Examples
The following expression returns $94.92 as the price of a Treasury bill:
TBillPrice(Date(2004,3,31), Date(2004,11,30), 0.075)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
TBillPrice
227
TBILLYIELD
Returns the yield for a USA Treasury bill. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. This function belongs to the Financial category.
Syntax
TBillYield(SettlementDate, MaturityDate, Price) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Security price per $100 face value. Must be greater than 0.
MaturityDate Price
Date Numeric
Return Value
Numeric
Examples
The following expression returns 0.103 as the yield for a Treasury bill:
TBillYield(Date(2004,3,31), Date(2004,11,30), 93.5)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
228
Chapter 4: Functions
TDIST
Returns the probability for the Student t-distribution. You can use the t-distribution in the hypothesis testing of small sets of sample data. The numeric value (X) that you pass to the function is a calculated value of t for which the probability is to be computed. This function belongs to the Statistical category.
Syntax
TDist(X, DegreesOfFreedom [, Tails]) Argument X DegreesOfFreedom Datatype Numeric Numeric Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0. Required. Whole number representing the degrees of freedom. Degrees of freedom is the number of values in a statistical calculation that are free to vary. Must be between 1 and 10,000, inclusive. Optional. Number of distribution tails to return. If Tails is 1, the function returns the one-tailed distribution. If Tails is 2, the function returns the two-tailed distribution. Default is 1. Must be between 1 and 2, inclusive.
Tails
Numeric
Return Value
Numeric
Examples
The following expression returns 0.015 as the one-tailed t-distribution probability for 2.25 at 49 degrees of freedom:
TDist(2.25, 49, 1)
The following expression returns 0.029 as the two-tailed t-distribution probability for 2.25 at 49 degrees of freedom:
TDist(2.25, 49, 2)
TDist
229
TINV
Returns the t-value of the Student's t-distribution, given the probability and the degrees of freedom. The TInv function is the statistical inverse of the TDist function. This function belongs to the Statistical category.
Syntax
TInv(Probability, DegreesOfFreedom [, Tails]) Argument Probability DegreesOfFreedom Datatype Numeric Numeric Description Required. Probability associated with the distribution. Must be between 0 and 1, inclusive. Required. Whole number representing the degrees of freedom. Degrees of freedom is the number of values in a statistical calculation that are free to vary. Must be between 1 and 10,000, inclusive. Optional. Number of distribution tails to return. If Tails is 1, the function returns the one-tailed distribution. If Tails is 2, the function returns the two-tailed distribution. Default is 1. Must be between 1 and 2, inclusive.
Tails
Numeric
Return Value
Numeric
Examples
The following expression returns 1.597 as the one-tailed t-value for the probability of 0.063 at 49 degrees of freedom:
TInv(0.063, 20, 1)
The following expression returns 1.969 as the two-tailed t-value for the probability of 0.063 at 49 degrees of freedom:
TInv(2.25, 49, 2)
230
Chapter 4: Functions
TTEST
Returns the two-tailed probability associated with a Student's T-test. You can use the TTest function to determine whether two samples (List1 and List2) are likely to have come from the same population and have the same mean. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. This function belongs to the Aggregate category.
Syntax
TTest(List1, List2 [, Context1, Context2]) Argument List1 List2 Context1 Datatype Numeric List Numeric List String Description Required. Name of a metric or attribute. Required. Name of a metric or attribute. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.6344 as the T-test probability of the list price of products sold in USA and Canada:
TTest({USA List Price}, {Canada List price})
USA List Price -------------15 8 9 11 Canada List price ----------------16.5 9.25 10 11.75
TTest
231
Notes
The TTest function performs the two-sample unequal variance (heteroscedastic) test. The heteroscedastic test is a version of the Student's T-test and it assumes that the statistical distributions having different variances. The two lists must have equal number of values. If there is a NULL in one list, the corresponding value in the other list is skipped. In this case, the function does not include either value in the calculation.
232
Chapter 4: Functions
TAN
Returns the tangent of a given angle. This function belongs to the Trigonometric category.
Syntax
Tan(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric
Examples
The following expression returns the tangent for the values of the Angles metric:
Tan({Angles})
Angles -----0.55 0.75 1 NULL Return Value -----------0.61 0.93 1.56 NULL
Tan
233
TANH
Returns the hyperbolic tangent of a numeric value. This function belongs to the Trigonometric category.
Syntax
Tanh(Angle) Argument Angle Datatype Numeric Description Required. An angle, expressed in radians. To convert degrees to radians, multiply the degrees by PI/180 or use the Units function.
Return Value
Numeric. The value is in the range -1 to +1.
Examples
The following expression returns the hyperbolic sine for all values of the Angles metric:
Tanh({Angles})
Degrees ------2.89 5.45 1.0 0 Return Value -----------0.99 1.00 0.76 0.00
234
Chapter 4: Functions
TIME
Sets the time of day for a date. Use this function to set the time for a date value, when only the date part is known. You can also use this function to change the time part of a date value. This function belongs to the Date & Time category.
Syntax
Time(Date, Hour [, Minute, Second]) Argument Date Hour Minute Second Datatype Date Numeric Numeric Numeric Description Required. Date value you want to pass to the function. Required. Number representing the hour of the day. Must be between 0 and 23, inclusive. Optional. Number representing the minute of the hour. Must be between 0 and 59, inclusive. Optional. Number representing the second of a minute. Must be between 0 and 59, inclusive.
Return Value
Date
Examples
Use the following expression to set the ship date for each shipment to 5:30 am:
Time({Ship Date}, 5, 30)
Ship Date ---------------2004-03-10 2:15 2004-06-06 14:53 2004-06-01 7:20 2003-12-15 0:37 Return Value --------------2004-03-10 5:30 2004-06-06 5:30 2004-06-01 5:30 2003-12-15 5:30
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
Time
235
TODAY
Returns the value of the current date. You can use this function to pass a date value to another function. This function belongs to the Date & Time category.
Syntax
Today()
Return Value
Date
Examples
The following expression returns 5 given that today's date is May 28, 2004:
Month(Today())
236
Chapter 4: Functions
TRIMEAN
Returns the statistical trimean of a set of values. Trimean is calculated by adding the 25th percentile, twice the 50th percentile, the 75th percentile and dividing the result by four. For example, the 25th, 50th, and 75th percentile of a set of values are 51, 55, and 63, respectively. The trimean of the set of values is (51+55+55+63)/4, which equals 56. Use the TriMean function when you want to compute the mean that is less influenced by extreme data. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
TriMean(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 7710.88 as the trimean of the Revenue metric for products belonging to the Drinks and Food category:
TriMean({Revenue}, "{Category}='Drinks', 'Food'")
Category -------Drinks Food Drinks Snacks Food Drinks Revenue -------13253.74 6392.94 10502.07 550 5420.59 6974.26
TriMean
237
TRIM
Removes blanks from the end of a string. This function belongs to the String category.
Syntax
Trim(String) Argument String Datatype String Description Required. String value you want to pass to the function.
Return Value
String
Examples
Use the following expression to remove blank spaces from the end of Product Category attribute values:
Trim({Product Category})
Product Category ---------------" Boys" " Return Value -----------"Boys" "Girls" "Women" "Men"
"Girls
238
Chapter 4: Functions
TRUNC
Returns the value truncated to a specific digit. This function belongs to the Rounding category.
Syntax
Trunc(NumericValue [, Significance]) Argument NumericValue Significance Datatype Numeric Numeric Description Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name. Optional. Number of places to the right of decimal point. Negative value indicates number of places to the left of decimal point. Default is 0.
Return Value
Numeric
Examples
Use the following expression to truncate all values of a numeric metric to a specific digit:
Trunc({Number}, 3)
Number ---------------15.846 8.43333333333333 9.0623 11.2 Return Value -----------15.845 8.433 9.062 11.199
Notes
Returns the same value if you specify a significance that is greater than the scale of the value.
Trunc
239
UNITS
Converts the value you specify in one unit of measure (Units1) to another unit of measure (Units2), and returns the new value. This function belongs to the Conversion category.
Syntax
Units(Units1, Units2, NumericValue) Argument Units1 Units2 NumericValue Datatype String String Numeric Description Required. Units to convert from. Required. Units to convert to. Required. Numeric value you want to pass to the function. You can enter a numeric literal, numeric metric name, or numeric attribute name.
Return Value
Numeric
Examples
Units("hours", "days", 48) returns 2.00000 Units("meters", "inches", 2) returns 78.74016 Units("pounds", "ounces", 2) returns 32.00000
Notes
If you use a unit of measure not supported by PowerAnalyzer or if you use two units of measure that are supported by PowerAnalyzer but are not compatible, PowerAnalyzer displays an error message. For a complete list of the supported units of measure, see the PowerAnalyzer online help.
240
Chapter 4: Functions
UPPER
Converts lowercase string characters to uppercase. This function belongs to the String category.
Syntax
Upper(String) Argument String Datatype String Description Required. String value you want to pass to the function.
Return Value
String
Examples
The following expression returns all values in the Customer Name attribute as uppercase letters:
Upper({Customer Name})
Customer Name ------------ruby Rachel MATTHEW LeBron Return Value -----------RUBY RACHEL MATTHEW LEBRON
Upper
241
VDB
Returns the variable declining balance. The variable declining balance is the depreciation of an asset for a specified period, using the double-declining balance method or any other specified method. The VDB function allows you to switch to the straight-line depreciation method when depreciation is greater than the declining balance calculation. By default, the function uses the double-declining balance method for calculating the variable declining balance. This function belongs to the Financial category.
Syntax
VDB(Cost, Salvage, Life, StartPeriod, EndPeriod [, RateFactor, NoSwitch, CurrencyDecimals]) Argument Cost Salvage Life StartPeriod EndPeriod RateFactor NoSwitch Datatype Numeric Numeric Numeric Numeric Numeric Numeric Boolean Description Required. Cost of the asset. Must be greater than or equal to 0. Required. Value or worth of the asset after depreciation. Must be between 0 and Cost, inclusive. Required. Number of periods over which an asset is being depreciated. Must be greater than 0. Required. Starting period for the calculation. Must be greater than or equal to 0. Required. Ending period for the calculation. Optional. Factor used in calculating the rate. Default is 2. Must be greater than 0. Optional. Logical value specifying whether you want PowerAnalyzer to switch to straight-line depreciation if depreciation is greater than the declining balance calculation. Pass TRUE if you do not want PowerAnalyzer to switch to straight-line depreciation even when the depreciation is greater than the declining balance calculation. Pass FALSE if you want PowerAnalyzer to switch to straight-line depreciation when depreciation is greater than the declining balance calculation. Default value is FALSE. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive.
CurrencyDecimals
Numeric
Return Value
Numeric
242
Chapter 4: Functions
Examples
You purchase a new copier for $2,400 for your department. The copier has a useful life of 10 years. The salvage value of the copier is $300. The following expression returns $480 as the depreciation for the first year:
VDB(2400, 300, 10, 0, 1)
Notes
The values of the StartPeriod and EndPeriod arguments must be in the same units as the value of the Life argument. For example, if the life is expressed in months, the starting and ending periods must also be expressed in months.
VDB
243
VALUEOF
Returns the value of a given metric for a given context. This function belongs to the Aggregate category.
Syntax
ValueOf(List, Context) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Required. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
You have a report that displays the Amount Sold metric for each product category. The following expression returns 125,000 as the amount sold for the Bicycles product category:
ValueOf({Amount Sold}, "{Prod Category}='Bicycles'")
Prod Category ------------Toys Clothes Bicycles Scooters Amount Sold ----------500,000 250,555 125,000 4300
244
Chapter 4: Functions
VAR
Returns the variance, treating values in a numeric metric or attribute as a sample population. The metric or attribute must include at least two values. This function belongs to the Aggregate category.
Syntax
Var(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 5.766 as the variance for the Interest metric as a sample set of data:
Var({Interest})
Interest -------7.5 5 8.25 3
Notes
This function ignores NULLs when performing the calculation. This function returns NULL if the provided list includes less than two values.
Var
245
VARP
Returns the variance, treating values in a numeric metric or attribute as a complete population. The metric or attribute must include at least two values. This function belongs to the Aggregate category.
Syntax
VarP(List [, Context]) Argument List Context Datatype Numeric List String Description Required. Name of a metric or attribute. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 4.324 as the variance of each value in the Interest metric for an entire population:
VarP({Interest})
Interest -------7.5 5 8.25 3
Notes
This function ignores NULLs when performing the calculation. This function returns NULL if the provided list includes less than two values.
246
Chapter 4: Functions
WEEKNUM
Returns the number of the week within an year for a date value. The function returns the number of the week as an integer. This function belongs to the Date & Time category.
Syntax
WeekNum(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the number of the week for the Ship Date attribute values:
WeekNum({Ship Date})
Ship Date --------9/10/2004 9/22/2004 10/1/2004 11/5/2004 Return Value -----------37 39 40 45
Notes
Returns the ISO week number, which is not the same as Excel. To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
WeekNum
247
WEEKDAY
Returns the day of the week of a date value. The function returns the day of the week as an integer, with values ranging from 1 (Monday) to 7 (Sunday). This function belongs to the Date & Time category.
Syntax
Weekday(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
The following expression returns the day of the week for the Ship Date attribute values:
Weekday({Ship Date})
Ship Date --------9/10/2004 9/22/2004 10/1/2004 10/5/2004 Return Value -----------5 3 5 2
Notes
The PowerAnalyzer Weekday function is different than the Microsoft Excel Weekday function. The Excel Weekday function returns values ranging from 1 (for Sunday) to 7 (for Saturday). To get the same output as the Excel Weekday function, use the following expression:
Mod(Weekday(<date>), 7) + 1
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
248
Chapter 4: Functions
WEIBULL
Returns the statistical Weibull distribution. You can use this function to perform reliability analysis. The value of the Cumulative argument determines the form of the function. If you pass TRUE as the value of the Cumulative argument, PowerAnalyzer calculates the Weibull cumulative distribution. If you pass FALSE, PowerAnalyzer calculates the Weibull probability density. This function belongs to the Statistical category.
Syntax
Weibull(X, Alpha, Beta, Cumulative) Argument X Alpha Beta Cumulative Datatype Numeric Numeric Numeric Boolean Description Required. Number for which you want to perform the calculation. Must be greater than or equal to 0. Required. The alpha variable. Must be greater than 0. Required. The beta variable. Must be greater than 0. Required. Logical value that determines the form of the function. If cumulative is TRUE, the function returns the cumulative answer. Otherwise, it does not return the cumulative answer.
Return Value
Numeric
Examples
The following expression returns 1.00 as the Weibull cumulative distribution:
Weibull(121, 10, 15, TRUE)
Weibull
249
WITHIN
Compares a given value to all values in a list and returns TRUE if the given value is the same as the value in the list. The function returns FALSE if the given value is different than the value in the list. The Compare1 argument is the given value, which can be a metric or attribute. The CompareList argument is a comma-separated list of values. You can use this function to compare metric or attribute values to a list of dates, strings, or numbers. The list of dates, strings, or numbers must be enclosed within quotation marks. This function belongs to the Comparative category.
Syntax
Within(Compare1, CompareList) Argument Compare1 CompareList Datatype Varies String Description Required. Value you want to compare. You can pass a numeric, date, or string value. Required. Comma separated list of values. You can pass numeric, date, or string values.
Return Value
Boolean
Examples
The following expression determines that the number 10 is within the list of commaseparated values and returns TRUE:
Within(10, "100, 10, 22, 18")
The following expression compares the values for the Promo Begin Date metric to the date June 1, 2004:
Within({Promo Begin Date}, "2004-06-01")
Promo Begin Date ---------------2004-03-10 2004-06-06 2004-06-01 2003-12-15 Return Value -----------FALSE FALSE TRUE FALSE
Notes
When comparing a date attribute to the values in a list, you must enter values in the yyyyMM-dd format.
250
Chapter 4: Functions
When comparing a given string value to the values in the list, the Within function ignores the case of the letters.
Within
251
XIRR
Returns the internal rate of return for a series of cash flows, where the cash flows might not occur at periodic intervals of time. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Financial category.
Syntax
XIRR(CashFlows, Dates [, Context1, Context2]) Argument CashFlows Dates Context1 Datatype Numeric List Date List String Description Required. Name of a metric or attribute representing a series of cash flows. Required. List of dates passed to the function. Use a date attribute name. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Context2
String
Return Value
Numeric
Examples
The following expression returns 0.801 as the internal rate of return:
XIRR({Cash Flows}, {Payment Date})
Payment Date -----------1/1/2004 3/1/2004 5/30/2004 8/15/2004 11/4/2004 Cash Flows ----------15000 10000 5000 2000 1000
252
Chapter 4: Functions
Notes
The cash flows must include at least one positive and at least one negative value. To calculate the internal rate of return for periodic cash flows, use the IRR function.
XIRR
253
XNPV
Returns the net present value for a series of cash flows, where the cash flows might not occur at periodic intervals of time. In the cash flow, negative values represent future payments and positive values represent income. As the value of the Rate argument, pass the rate of discount that applies to the cash flows. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Financial category.
Syntax
XNPV(CashFlows, Dates, Rate [, CurrencyDecimals, Context1, Context2]) Argument CashFlows Dates Rate Datatype Numeric List Date List Numeric Description Required. Name of a metric or attribute representing a series of cash flows. Required. List of dates passed to the function. Use a date attribute name. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Optional. Currency places to the right of the decimal point. Default is 2. Must be between 0 and 3, inclusive. Optional. First filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it. Optional. Second filter for setting a scope for the function. Default is the same as the value of Context1. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
CurrencyDecimals Context1
Numeric String
Context2
String
Return Value
Numeric
Examples
The following expression returns 2000.14 as the net present value:
XNPV({Cash Flows}, {Payment Date}, 0.12)
Payment Date -----------1/1/1998 Cash Flows ----------15000
254
Chapter 4: Functions
Notes
The cash flows must include at least one positive and at least one negative value. To calculate the net present value for a series of periodic cash flows, use the NPV function. When you pass an optional argument, you must also pass all other optional arguments that occur before it in the function syntax.
XNPV
255
YEAR
Returns the year of a date value. The Year function returns the year as an integer. This function belongs to the Date & Time category.
Syntax
Year(Date) Argument Date Datatype Date Description Required. Date value you want to pass to the function.
Return Value
Numeric
Examples
All of the following examples return the number 2004:
Year(Date(2004, 9, 10)) Year(DateValue("2004/06/10")) Year(Today()), where today's date is October 10, 2004 Year(AddToDate(Today()), 0, 0, 9) where today's date is October 1, 2004 Year({Day Shipped}), where the value of the Day Shipped attribute is July 10, 2004
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
256
Chapter 4: Functions
YIELD
Returns the yield on a security that pays periodic interest. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. This function belongs to the Financial category.
Syntax
Yield(SettlementDate, MaturityDate, Rate, Price, Redemption [, Frequency, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Security price per $100 face value. Must be greater than 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Frequency of payments. The frequency can be "annual", "semiannual", "quarterly", "monthly", "weekly", or "daily". Default is "annual". Enclose the frequency within quotation marks. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
MaturityDate Rate
Date Numeric
DayCountBasis
String
Return Value
Numeric
Examples
The following expression returns 0.20 as the yield on a government bond:
Yield(Date(2004,3,31), Date(2004,11,30), 0.095, 93.5, 100, "annual","30E+/360")
Yield
257
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
258
Chapter 4: Functions
YIELDDISC
Returns the annual yield on a discounted security. The function returns the annual yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. This function belongs to the Financial category.
Syntax
YieldDisc(SettlementDate, MaturityDate, Price, Redemption [, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Security price per $100 face value. Must be greater than 0. Required. Amount to be received at maturity per $100 face value. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Return Value
Numeric
Examples
The following expression returns 0.10 as the annual yield on a discounted bond:
YieldDisc(Date(2004,3,31), Date(2004,11,30), 93.5, 100, "ACT/365")
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
YieldDisc
259
YIELDMAT
Returns the annual yield of a security that pays interest at maturity. The function returns the annual yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. This function belongs to the Financial category.
Syntax
YieldMat(SettlementDate, MaturityDate, IssueDate, Rate, Price [, DayCountBasis]) Argument SettlementDate Datatype Date Description Required. Date when the security will settle. The settlement date is the date after the issue date when the security is traded to the buyer. Must be less than MaturityDate. Required. Date when the security matures or expires. Required. Date when the security was issued. Must be less than or equal to SettlementDate. Required. Interest rate, expressed as a decimal number. Divide the percent rate by 100 to express it as a decimal number. Must be greater than or equal to 0. Required. Security price per $100 face value. Must be greater than 0. Optional. Day count basis used in date calculations. Day count basis is a method of interest calculation using a day count fraction. The day count basis can be "ACT/360", "ACT/365", "ACT/365L", "ACT/ACT", "NASD 30/360", "30/360", "30E/360", or "30E+/360". Default is "NASD 30/360". You must enclose the day count basis within quotation marks.
Price DayCountBasis
Numeric String
Return Value
Numeric
Examples
The following expression returns 0.13 as the annual yield on a bond that pays interest at maturity:
Yieldmat(DateValue("2004/03/31"), DateValue("2004/11/30"), DateValue("2003/11/30"), 0.052, 95)
Notes
To pass a date to this function, use a date attribute or another function that generates a date value. Examples of functions that generate a date value include Date, DateValue, Today, and AddToDate.
260 Chapter 4: Functions
ZTEST
Returns the two-tailed probability of a z-test for a given numeric value, X. The List argument is the numeric metric or attribute that contains the range of data against which you want to test X. StdDev is the standard deviation of the population. Use the Context argument to narrow the scope of the function to specific metric or attribute values. This function belongs to the Aggregate category.
Syntax
ZTest(List, X [, StdDev, Context]) Argument List X StdDev Context Datatype Numeric List Numeric Numeric String Description Required. Name of a metric or attribute. Required. Number for which you want to perform the calculation. Optional. Standard deviation of a list of numbers. Must be greater than 0. Optional. Filter for setting a scope for the function. Context allows you to narrow the calculation to a set of attribute or metric values. You must enclose the Context within quotation marks. The syntax for the Context argument depends on the function where you are using it.
Return Value
Numeric
Examples
The following expression returns 0.00695 as the z-test probability of getting 2 defective parts on an assembly line for products in the Widgets product group:
ZTest({Defective Parts}, 2, 12, "{Product Group}='Widgets'")
Product Group ------------Widgets Widgets Tools Widgets Tools Widgets Widgets Defective Parts --------------10 15 3 20 1 18 13
ZTest
261
262
Chapter 4: Functions
Appendix A
Aggregate Functions, 264 Boolean Functions, 269 Comparative Functions, 270 Conditional Functions, 271 Conversion Functions, 272 Date & Time Functions, 273 Fetch Functions, 275 Financial Functions, 276 Mathematical Functions, 282 Rounding Functions, 283 Running Functions, 284 Statistical Functions, 285 String Functions, 289 Trigonometric Functions, 291 Unary Functions, 293
263
Aggregate Functions
Table A-1 lists functions in the Aggregate category:
Table A-1. Functions in the Aggregate Category Function AveDev Syntax AveDev(List [, Context]) Description Returns the average of the absolute deviations of values in a list from their mean. The AveDev function determines the variability in a set of values. Returns the average of all values in a list. Returns the chi-squared goodness of fit between expected and observed lists. Use this function to find out if results based on a hypothesis are verified by an experiment. Pass numeric metrics or attributes as the values for the ListExpected and ListObserved arguments. Use the Context argument to narrow the scope of the function to specific metric or attribute values. The Context1 argument corresponds to the ListObserved argument and the Context2 argument corresponds to the ListExpected argument. Returns the correlation coefficient of two sets of values. Use the correlation coefficient to determine the relationship between two sets of values. Pass numeric metrics or attributes as the values for the first and second List arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. Counts the number of values within a given metric or attribute. Use this function to get the number of rows in a column. Use the Context argument to count a specific set of metric or attribute values. Counts the number of unique values within a given metric or attribute. Use this function to get the number of unique rows in a column. Use the Context argument to count a specific set of metric or attribute values.
Avg ChiTest
Correl
CountAll
CountAll(List [, Context])
CountUnique
CountUnique(List [, Context])
264
Table A-1. Functions in the Aggregate Category Function Covar Syntax Covar(List1, List2 [, Context1, Context2]) Description Returns covariance of two sets of values. Covariance is the average of the products of deviations for each data point pair. Use this function to determine the relationship between two sets of values. Pass numeric metrics or attributes as the values for the first and second List arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. Returns the sum of squared deviations of a set of values from their sample mean. Use this function with a numeric metric or attribute. Use the Context argument to narrow the scope of specific metric or attribute value. Predicts a future value based on existing values. Use this function to determine future sales, inventory levels, or trends. You pass a single value and two sets of values (ListY and ListX) to the Forecast function. The single value is a ListX value. The function returns a predicted ListY value for the given ListX value. The function uses linear regression to predict the ListY value. Pass numeric metrics or attributes as the values for the ListY and ListX arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The Context1 argument corresponds to the ListY argument and the Context2 argument corresponds to the ListX argument. Returns the geometric mean of a set of values, where each value must be a positive value. Pass numeric metrics or attributes as the List argument. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the harmonic mean of a set of values, where each value must be a positive value. The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. Returns the kurtosis of a set of values. Use kurtosis to compare the relative peakedness or flatness of a distribution with the normal distribution. Positive kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a relatively flat distribution. Use the Context argument to narrow the scope of specific metric or attribute value.
DevSq
DevSq(List [, Context])
Forecast
GeoMean
GeoMean(List [, Context])
HarMean
HarMean(List [, Context])
Kurt
Kurt(List [, Context])
Aggregate Functions
265
Table A-1. Functions in the Aggregate Category Function Max Median Syntax Max(List [, Context]) Description Returns the maximum value of a numeric metric or attribute. Returns the median value for a numeric metric or attribute. In a set of numeric data in ascending or descending order, the median is the value in the middle of the data set with an equal number of values distributed above and below that value. When there is an even number of values in the set, median is the average of the two numbers in the middle. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the minimum value of a numeric metric or attribute. Returns the value that occurs most frequently in a numeric metric or attribute. When more than one value occurs at the greatest frequency, then the Mode function returns the first value to reach the greatest frequency. Returns the Pearson product moment correlation coefficient (r). The value of the Pearson product moment correlation coefficient is in the range -1.0 to 1.0, inclusive. Use this function to determine the extent of a linear relationship between two sets of values (ListY and ListX). Pass numeric metrics or attributes as the values for the ListY and ListX arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument. Returns the result of multiplying values in a numeric metric or attribute. Returns the statistical skewness of a distribution. Skewness is the degree of asymmetry of a distribution around its mean. A distribution is symmetric if it looks the same to the left and right of the center point. Positive skewness means the distribution has an asymmetric tail towards more positive values. Negative skewness means the distribution has an asymmetric tail towards more negative values.
Median(List [, Context])
Min Mode
Min(List [, Context])
Mode(List [, Context])
Pearson
Product Skew
Product(List [, Context])
Skew(List [, Context])
266
Table A-1. Functions in the Aggregate Category Function Slope Syntax Slope(ListY, ListX [, Context1, Context2]) Description Returns the slope of the linear regression line that runs through values in two lists (ListY and ListX). The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line. Use numeric metric or attribute names as values of the ListY and ListX arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The first Context argument corresponds to the ListY argument and the second Context argument corresponds to the ListX argument. Returns the standard deviation, treating values for a numeric metric or attribute as a sample population. The metric or attribute must include at least two values. Returns the standard deviation, treating values for a numeric metric or attribute as a complete population. The metric or attribute must include at least two values. Returns the statistical standard error of linear regression between two lists of values (ListY and ListX). The standard error is a measure of the amount of error in the prediction of a Y value for an X value. Use metric or numeric attribute names as values of the ListY and ListX arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The first Context argument corresponds to the ListY argument and the second Context argument corresponds to the ListX argument. Returns the sum of all values. Returns the two-tailed probability associated with a Student's T-test. Use the TTest function to determine whether two samples (List1 and List2) are likely to have come from the same population and have the same mean. Use the Context argument to narrow the scope of specific metric or attribute value. The Context1 argument corresponds to the List1 argument and the Context2 argument corresponds to the List2 argument.
Stdev
Stdev(List [, Context])
StdevP
StdevP(List [, Context])
Steyx
Sum TTest
Aggregate Functions
267
Table A-1. Functions in the Aggregate Category Function TriMean Syntax TriMean(List [, Context]) Description Returns the statistical trimean of a set of values. Trimean is calculated by adding the 25th percentile, twice the 50th percentile, the 75th percentile and dividing the result by four. For example, the 25th, 50th, and 75th percentile of a set of values are 51, 55, and 63, respectively. The trimean of the set of values is (51+55+55+63)/4, which equals 56. Use the TriMean function when you want to compute the mean that is less influenced by extreme data. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the value of a given metric for a given context. Returns the variance, treating values in a numeric metric or attribute as a sample population. The metric or attribute must include at least two values. Returns the variance, treating values in a numeric metric or attribute as a complete population. The metric or attribute must include at least two values. Returns the two-tailed probability of a z-test for a given numeric value, X. The List argument is the numeric metric or attribute that contains the range of data against which you want to test X. StdDev is the standard deviation of the population. Use the Context argument to narrow the scope of specific metric or attribute value.
ValueOf Var
ValueOf(List, Context)
Var(List [, Context])
VarP
VarP(List [, Context])
ZTest
268
Boolean Functions
Table A-2 lists functions in the Boolean category:
Table A-2. Functions in the Boolean Category Function And Syntax And(BooleanValue1, BooleanValue2) Description Joins two conditions and returns TRUE if both conditions are true. Returns FALSE if any condition or both conditions are not true. Returns the reverse of a TRUE or FALSE value passed to the function. If you pass TRUE, the Not function returns FALSE. If you pass FALSE, the Not function returns TRUE. Use this function within an expression, where you want get the reverse Boolean value of a given value. Compares two conditions and returns TRUE if either of the two conditions is TRUE. Returns FALSE if both conditions are FALSE. Use metric and attribute names in the arguments.
Not
Not(BooleanValue)
Or
Or(BooleanValue1, BooleanValue2)
Boolean Functions
269
Comparative Functions
Table A-3 lists functions in the Comparative category:
Table A-3. Functions in the Comparative Category Function Equals Syntax Equals(Compare1, Compare2) Description Compares two numeric values and returns TRUE if the values are equal or FALSE if the values are not equal. Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares two numeric values. Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares two numeric values. Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares two numeric values Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares two numeric values. Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares two numeric values. Use this function to compare metrics or attributes to other metrics, attributes, or constant values. Compares a given value to all values in a list and returns TRUE if the given value is the same as the value in the list. The function returns FALSE if the given value is different than the value in the list. The Compare1 argument is the given value, which can be a metric or attribute. The CompareList argument is a comma-separated list of values. Use this function to compare metric or attribute values to a list of dates, strings, or numbers. The list of dates, strings, or numbers must be enclosed within quotation marks.
GreaterThan
GreaterThan(Compare1, Compare2)
GreaterThanEquals
GreaterThanEquals(Compare1, Compare2)
LessThan
LessThan(Compare1, Compare2)
LessThanEquals
LessThanEquals(Compare1, Compare2)
NotEquals
NotEquals(Compare1, Compare2)
Within
Within(Compare1, CompareList)
270
Conditional Functions
Table A-4 lists functions in the Conditional category:
Table A-4. Functions in the Conditional Category Function If IfNull Syntax If(If, True, False) Description Returns one of two specified values based on the results of a condition. Returns the specified value if a condition returns NULL. Use to replace NULL in a metric or attribute.
Conditional Functions
271
Conversion Functions
Table A-5 lists the function in the Conversion category:
Table A-5. Function in the Conversion Category Function Units Syntax Units(Units1, Units2, NumericValue) Description Converts the value you specify in one unit of measure (Units1) to another unit of measure (Units2), and returns the new value.
272
Date
DateString
DateString(Date [, DateFormat])
DateValue
DateValue(DateString [, DateFormat])
Day
Day(Date)
ElapsedDays
ElapsedHours
ElapsedHours(Date1, Date2)
ElapsedYears
273
Table A-6. Functions in the Date & Time Category Function EndOfMonth Syntax EndOfMonth(Date) Description Returns the last date in the month for a given date value. Use the EndOfMonth function to calculate due dates that correspond with the last date of a month. Use this function to pass a date value to another function. Returns a number representing the hour of the day of a date value. The function returns the hour as an integer with values ranging from 0 to 23. Returns the minutes of the time part of a date value. The function returns the minutes as an integer with values ranging from 0 to 59. Returns the month of a date value. The function returns the month as an integer, with values ranging from 1 (January) to 12 (December). Returns the next date in a period or payment schedule. Returns the value of the current date and time. Use this function to pass a date value to another function. Returns the second of the time part of a date value. The function returns the second as an integer with values ranging from 0 to 59. Sets the time of day for a date. Use this function to set the time for a date value, when only the date part is known. You can also use this function to change the time part of a date value. Returns the value of the current date. Use this function to pass a date value to another function. Returns the number of the week within an year for a date value. The function returns the number of the week as an integer. Returns the day of the week of a date value. The function returns the day of the week as an integer, with values ranging from 1 (Monday) to 7 (Sunday). Returns the year of a date value. The Year function returns the year as an integer.
Hour
Hour(Date)
Minute
Minute(Date)
Month
Month(Date)
Second(Date)
Time
Today WeekNum
Today()
WeekNum(Date)
Weekday
Weekday(Date)
Year
Year(Date)
274
Fetch Functions
Table A-7 lists the functions in the Fetch category:
Table A-7. Functions in the Fetch Category Function Next Previous Syntax Next(Metric) Previous(Metric) Description Returns the next value for the specified metric. Returns the previous value for the specified metric or attribute.
Fetch Functions
275
Financial Functions
Table A-8 lists the functions in the Financial category:
Table A-8. Functions in the Financial Category Function AccrInt Syntax AccrInt(IssueDate, FirstInterestDate, SettlementDate, Rate [, ParValue, Frequency, DayCountBasis, CurrencyDecimals]) Description Returns the accrued interest for a security that pays periodic interest. The interest rate (Rate argument) must be adjusted for the frequency of payments. To adjust the interest rate for frequency, divide the annual rate by the number of payments made in an year. For example, a coupon pays an annual interest rate of 15 percent and the frequency is Quarterly. Calculate the value of the Rate argument by dividing 15% by 4. Returns the accrued interest for a security that pays interest at maturity. The interest rate (Rate argument) must be adjusted for the frequency of payments. To adjust the interest rate for frequency, divide the annual rate by the number of payments made in an year. Returns the depreciation for each accounting period, based on a depreciation coefficient. If an asset is purchased in the middle of the accounting period, the function prorates the depreciation. This function is similar to the AmorLinC function, except that a depreciation coefficient is applied in the calculation depending on the life of the asset. Returns the depreciation for each accounting period. If an asset is purchased in the middle of the accounting period, the function prorates the depreciation. Returns the total number of coupon days from the beginning of a coupon period to the settlement date. Returns the total number of coupon days in the coupon period that contains the settlement date. Returns the total number of coupon days from the settlement date to the next coupon date. Returns the next coupon date after the settlement date of a security.
AccrIntM
AmorDegrC
AmorLinC
AmorLinC(Cost, PurchaseDate, FirstPeriodDate, Salvage, Period, Rate [, DayCountBasis, CurrencyDecimals]) CoupDayBS(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) CoupDayS(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) CoupDaySNC(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) CoupNCD(SettlementDate, MaturityDate [, Frequency, DayCountBasis])
CoupDayBS
CoupDayS
CoupDaySNC
CoupNCD
276
Table A-8. Functions in the Financial Category Function CoupNum Syntax CoupNum(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) Description Returns the number of coupons payable between the settlement date and maturity date. Data Analyzer rounds the number of coupons to the nearest whole number. Returns the previous coupon date before the settlement date of a security. Returns the cumulative interest paid for a loan between two specified periods of time. The Rate argument represents the interest rate for each period. Calculate NumberPeriods by multiplying the term of the loan by number of payments per year. Returns the cumulative principal paid on a loan between two specified periods of time. The Rate argument represents the interest rate for each period. Calculate NumberPeriods by multiplying the term of the loan by number of payments per year. Returns the depreciation of an asset for a specified period using the fixed-declining balance depreciation calculation. The fixeddeclining balance method calculates depreciation at a fixed rate. The value of the Period argument is the time period for which you want to calculate the depreciation. Returns the depreciation of an asset for a specified period using the double-declining balance depreciation calculation. The doubledeclining balance method calculates depreciation at an accelerated rate. In the first period, depreciation is highest and it decreases in each subsequent period. The value of the Period argument is the time period for which you want to calculate the depreciation. Use the RateFactor argument to pass a value for the rate at which the balance declines. Returns the rate, given the discount factor. The discount factor is a number that is multiplied by a monetary value to reduce an expected future sum to its present value. This function is the reverse of the RateToDf function. Use the DfToRate function to compute the rate when the discount factor is known. Returns the discount rate for a security, expressed as a decimal number. To convert it to a percentage, multiply the discount rate by 100.
CoupPCD
CoupPCD(SettlementDate, MaturityDate [, Frequency, DayCountBasis]) CumIPmt(Rate, NumberPeriods, PresentValue, StartPeriod, EndPeriod, PaymentAtBeginning [, CurrencyDecimals])
CumIPmt
CumPrinc
DB
DDB
DfToRate
Disc
Financial Functions
277
Table A-8. Functions in the Financial Category Function Effect Syntax Effect(Rate, NumberPeriods) Description Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year. The effective annual interest rate is expressed as a decimal number. To convert it to a percentage, multiply the rate by 100. Returns the future value of an investment, where you make periodic, constant payments and the investment earns a constant interest rate. The Rate argument represents the interest rate earned in each period. PresentValue is the current value of the investment. If you omit the PresentValue argument, the FV function assumes it to be 0. Returns the internal rate of return for a series of cash flows represented by a set of values. These cash flows do not have to be of equal value, but they must occur at regular intervals, such as monthly or annually. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the interest rate for a fully-invested security. The interest rate is expressed as a decimal number. To convert it to a percentage, multiply the interest rate by 100. Calculates the net present value of an investment by using a discount rate and a series of cash flows. Use a metric to pass the cash flow values to the function. These cash flows do not have to be of equal value, but they must occur at regular periods of time, such as monthly or annually. In the cash flow, negative values represent future payments and positive values represent income. As the value of the Rate argument, pass the rate of discount over the length of one period. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the number of periods for an investment based on a constant interest rate and periodic, constant payments. The value of the Rate argument is the interest rate earned in each period. PresentValue is the lump-sum amount that a series of future payments is worth now. FutureValue is the cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the NPer function assumes it to be 0. For example, the future value of a loan is 0.
FV
IRR
IRR(CashFlows [, Context])
IntRate
NPV
NPer
278
Table A-8. Functions in the Financial Category Function Nominal Syntax Nominal(Rate, NumberPeriods) Description Returns the nominal annual interest rate, given the effective rate and the number of compounding periods per year. Returns the present value of an investment. The present value is the lump-sum amount that a series of future payments is worth now. Rate is the interest rate earned in each period. FutureValue is the cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the PV function assumes it to be 0. For example, the future value of a loan is 0. Returns the number of periods per year, given the frequency of payments. Use this function to pass the period value to other financial functions. Returns the payment for a loan based on constant payments and a constant interest rate. The Rate argument is the interest rate for the loan for each period. The PresentValue is the principal for the loan. The FutureValue is cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the Pmt function assumes it to be 0. Returns the price per $100 face value of a security that pays periodic interest.
PV
PeriodsPerYear
PeriodsPerYear([Frequency])
Pmt
Price
Price(SettlementDate, MaturityDate, Rate, Yield, Redemption [, Frequency, DayCountBasis, CurrencyDecimals]) PriceDisc(SettlementDate, MaturityDate, Discount, Redemption [, DayCountBasis, CurrencyDecimals]) PriceMat(SettlementDate, MaturityDate, IssueDate, Rate, Yield [, DayCountBasis, CurrencyDecimals]) Rate(NumberPeriods, Payment, PresentValue [, FutureValue, PaymentAtBeginning, CurrencyDecimals])
PriceDisc
PriceMat
Returns the price per $100 face value of a security that pays interest at maturity.
Rate
Returns the interest rate earned per period by a security. PresentValue is the lump-sum amount that a series of future payments is worth now. FutureValue is cash balance you want to attain after the last payment is made. If you omit the FutureValue argument, the Rate function assumes it to be 0. For example, the future value of a loan is 0.
Financial Functions
279
Table A-8. Functions in the Financial Category Function RateToDf Syntax RateToDf(Rate, RateConvention, ElapsedYears) Description Returns the discount factor, given the rate. The discount factor is a number that is multiplied by a monetary value to reduce an expected future sum to its present value. Use the discount factor to evaluate the return on a capital investment, by calculating the present value of future cash flows. This function is the reverse of the DfToRate function. Use the RateToDf function to compute the rate when the discount factor is known. Returns the amount received when a fully invested security matures.
Received
Received(SettlementDate, MaturityDate, Investment, Discount [, DayCountBasis, CurrencyDecimals]) SLn(Cost, Salvage, Life [, CurrencyDecimals]) SYD(Cost, Salvage, Life, Period [, CurrencyDecimals]) TBillEq(SettlementDate, MaturityDate, Discount)
Returns the straight-line depreciation of an asset for one period. Returns the depreciation of an asset using the sum-of-years' digits method for a given period. Returns the bond-equivalent yield for a Treasury bill. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. Returns the price per $100 face value for a Treasury bill. Returns the yield for a USA Treasury bill. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. Returns the variable declining balance. The variable declining balance is the depreciation of an asset for a specified period, using the doubledeclining balance method or any other specified method. Use the VDB function to switch to the straight-line depreciation method when depreciation is greater than the declining balance calculation. By default, the function uses the double-declining balance method for calculating the variable declining balance. Returns the internal rate of return for a series of cash flows, where the cash flows might not occur at periodic intervals of time. Use the Context argument to narrow the scope of specific metric or attribute value.
TBillPrice TBillYield
VDB
XIRR
280
Table A-8. Functions in the Financial Category Function XNPV Syntax XNPV(CashFlows, Dates, Rate [, CurrencyDecimals, Context1, Context2]) Description Returns the net present value for a series of cash flows, where the cash flows might not occur at periodic intervals of time. In the cash flow, negative values represent future payments and positive values represent income. As the value of the Rate argument, pass the rate of discount that applies to the cash flows. Use the Context argument to narrow the scope of specific metric or attribute value. Returns the yield on a security that pays periodic interest. The function returns the yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. Returns the annual yield on a discounted security. The function returns the annual yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100. Returns the annual yield of a security that pays interest at maturity. The function returns the annual yield as a decimal number. To convert the yield to a percentage, multiply the return value by 100.
Yield
Yield(SettlementDate, MaturityDate, Rate, Price, Redemption [, Frequency, DayCountBasis]) YieldDisc(SettlementDate, MaturityDate, Price, Redemption [, DayCountBasis])
YieldDisc
YieldMat
Financial Functions
281
Mathematical Functions
Table A-9 lists the functions in the Mathematical category:
Table A-9. Functions in the Mathematical Category Function Add Divide Factorial Syntax Add(NumericValue1, NumericValue2) Divide(NumericValue1, NumericValue2) Factorial(NumericValue) Description Returns the sum of two numeric values. Returns the result of the first numeric value divided by the second numeric value. Returns the factorial (n!) of a number, where n! equals 1*2*3*...*n. Use this function in mathematical calculations. If the number you pass to the function is not an integer, Data Analyzer truncates the number. Divides one numeric value by another and returns the integer part of the quotient (result of the division). Returns the natural logarithm of a numeric value. The Log function uses E as the base for the logarithm calculation. Returns the base 10 logarithm of a numeric value. Returns the base 2 logarithm of a numeric value. Returns the maximum of two numeric values. Returns the minimum of two numeric values. Returns the modulus, the remainder of a division calculation, for any numeric metric or attribute. Returns the product of one numeric value multiplied by another. Returns the value of a number raised to an exponent. The first argument you pass to the function is the base value. The second argument you pass to the function is the exponent. Returns the square root of a given positive number. The square root of a negative number is not a value. Returns the square of a given number. Returns the result of one numeric value subtracted by another.
IntDivide
IntDivide(NumericValue1, NumericValue2)
Log
Log(NumericValue)
Log10(NumericValue)
Sqrt
Sqrt(NumericValue)
Square Subtract
282
Rounding Functions
Table A-10 lists the functions in the Rounding category:
Table A-10. Functions in the Rounding Category Function Ceiling Syntax Ceiling(NumericValue [, Significance]) Description Returns the value rounded up to the specified number of digits, towards positive infinity. The Data Analyzer Ceiling function differs from the Microsoft Excel Ceiling function. In the Data Analyzer Ceiling function, Significance is the number of digits to the right of the decimal point. In Excel, Significance is the multiple to which you want to round. The Data Analyzer Ceiling function rounds a number towards positive infinity, whereas the Excel Ceiling function rounds a number away from zero. Returns the value rounded down to the specified number of digits, towards positive infinity. The Data Analyzer Floor function differs from the Microsoft Excel Floor function. In the Data Analyzer Floor function, Significance is the number of digits to the right of the decimal point. In the Excel Floor function, Significance is the multiple to which you want to round. The Data Analyzer Floor function rounds a number towards positive infinity, whereas the Excel Floor function rounds a number away from zero. Returns all values rounded to the specified number of digits. Returns a value rounded down N number of places to the right of the decimal point. If N is a negative number, rounds down N places left of the decimal point. Returns a value rounded up N number of places to the right of the decimal point. If N is a negative number, rounds up N places left of the decimal point. Returns the value truncated to a specific digit.
Floor
Floor(NumericValue [, Significance])
Round RoundDown
RoundUp
RoundUp(NumericValue [, Significance])
Trunc
Trunc(NumericValue [, Significance])
Rounding Functions
283
Running Functions
Table A-11 lists the functions in the Running category:
Table A-11. Functions in the Running Category Function MovingAvg Syntax MovingAvg(List, Size [, Context]) Description Returns the average (row-by-row) of a specified set of values. The Size argument defines the row set, or window, for which you want to calculate the moving average. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. Returns the cumulative sum (row-by-row) of a specified set of values. The Size argument defines the row set, or window, for which you want to calculate the moving sum. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. For a set of values, returns each value as the percentage of the sum of all values in the set. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. Returns the average of the current value and all previous values in a row or column. Running average is different than moving average, because moving average is always for a specified group of values (Size argument). The MovingAvg function performs the calculation for each group of values at a time. RunningAvg function starts at the beginning and runs through the entire set of values, recalculating at each value. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report. Returns the total of the current value and all previous values in a row or column. Running sum is different than moving sum, because moving sum is always for a specified group of values (Size argument). The MovingSum function performs the calculation for each group of values at a time. RunningSum function starts at the beginning and runs through the entire set of values, recalculating at each value. Use the Context argument to perform the calculation for the row, the column, or a time attribute used in the report.
MovingSum
PercentContribution
PercentContribution(List [, Context])
RunningAvg
RunningAvg(List [, Context])
RunningSum
RunningSum(List [, Context])
284
Statistical Functions
Table A-12 lists the functions in the Statistical category:
Table A-12. Functions in the Statistical Category Function BinomDist Syntax BinomDist(X, Trials, ProbabilityOfSuccess, Cumulative) Description Returns the value for the statistical binomial distribution. Binomial distribution is the probability of observing X number of successes in a fixed number of independent trials. Returns the number (integer) for which the cumulative binomial distribution is greater than or equal to a criterion value. The cumulative binomial distribution is the first argument (Probability) that you pass to the function. The BinomInv function is the statistical inverse of binomial distribution (BinomDist) function. Returns the probability of the chi-squared distribution. The chi-squared distribution is associated with a chi-squared test and a certain number of degrees of freedom. Use the chisquared test to compare observed and expected values. Returns the inverse of the probability associated with a chi-squared distribution. The ChiInv (Probability, DegressofFreedom) function returns the value X, where Probability is the return value of the ChiDist(X, DegressofFreedom) function. Returns the confidence range for the mean of a population. The confidence range is a value on either side of a sample mean, which determines the standard deviation with a particular level of confidence. The level of confidence determines the value of the Alpha argument. Alpha equals (1-confidence level/100). For example, for an 80 percent confidence level, Alpha equals 0.2. Returns the exponential distribution. Exponential distribution is used to determine the time between consecutive, rare, and random events in a process with no memory. For example, you can use the ExponDist function to determine the time you have to wait before you get your next phone call. If you pass TRUE as the value of the Cumulative argument, ExponDist returns the cumulative distribution calculation. If you pass FALSE as the value of the Cumulative argument, the function returns the probability density calculation.
BinomInv
ChiDist
ChiDist(X, DegreesOfFreedom)
ChiInv
ChiInv(Probability, DegreesOfFreedom)
Confidence
ExponDist
Statistical Functions
285
Table A-12. Functions in the Statistical Category Function FDist Syntax FDist(X, DegreesOfFreedomNum, DegreesOfFreedomDenom) Description Returns the F probability distribution. The F probability distribution is typically used to develop hypothesis tests. Use the FDist function to calculate the one-sided probability of the likelihood that two variances are different. Returns the inverse of the probability associated with a F distribution. The Probability argument passed to the FInv function is the probability associated with the F distribution. The F probability distribution is typically used to develop hypothesis tests. Returns the Fisher transformation for a given value. Fisher returns a value that is an approximately normally distributed value rather than a skewed one. Use the Fisher transformation to test hypothesis on the correlation coefficient. Returns the statistical inverse of the Fisher transformation. Use this function when determining the relationship between ranges or arrays of data. Returns the gamma distribution. The return value of the GammaDist function is the probability that a gamma-distributed random variable with arguments alpha and beta is less than or equal to x. Use this function to study variables that may have a skewed distribution. Returns the inverse of the gamma cumulative distribution. The Probability argument passed to the GammaInv function is the probability associated with the gamma cumulative distribution. Use this function to test a variable whose distribution may be skewed. Returns the natural logarithm of the gamma function. Returns the value of the statistical hypergeometric distribution. Hypergeometric distribution is the probability of a given number of sample successes, where the sample size, population successes, and population size is known. Use this function for experiments in which each observation is either a success or a failure, and where each subset of a given size is chosen with equal likelihood.
FInv
Fisher
Fisher(X)
FisherInv
FisherInv(X)
GammaDist
GammaInv
GammaLog HypGeomDist
GammaLog(X)
286
Table A-12. Functions in the Statistical Category Function NormDist Syntax NormDist(X, Mean, StdDev, Cumulative) Description Returns the normal distribution for a number, given the mean and standard deviation. Normal distributions have a wide range of applications in statistics. Use the NormDist function to derive many kinds of statistical tests. If you pass TRUE as the value of the Cumulative argument, NormDist returns the cumulative distribution calculation. If you pass FALSE as the value of the Cumulative argument, the function returns the probability mass calculation. Returns the inverse of the normal cumulative distribution, given the mean and standard deviation. The Probability argument passed to the NormInv function is the probability associated with the normal distribution. Returns the standard normal cumulative distribution, where the mean is zero and the standard deviation is one. Returns the inverse of the standard normal cumulative distribution. In a standard normal cumulative distribution the mean is zero and the standard deviation is one. The Probability argument passed to the NormSInv function is the probability associated with the standard normal cumulative distribution. Calculates the value that falls at a given percentile in a group of numbers. Optionally, you can use the Context argument to limit the values you want to pass to the function to calculate the percentile. Returns the statistical skewness of a distribution. Skewness is the degree of asymmetry of a distribution around its mean. A distribution is symmetric if it looks the same to the left and right of the center point. Positive skewness means the distribution has an asymmetric tail towards more positive values. Negative skewness means the distribution has an asymmetric tail towards more negative values. Returns the normalized value for a distribution, given the mean and standard deviation.
NormInv
NormSDist
NormSDist(X)
NormSInv
NormSInv(Probability)
Percentile
Skew
Skew(List [, Context])
Standardize
Statistical Functions
287
Table A-12. Functions in the Statistical Category Function Steyx Syntax Steyx(ListY, ListX [, Context, Context]) Description Returns the statistical standard error of linear regression between two lists of values (ListY and ListX). The standard error is a measure of the amount of error in the prediction of a Y value for an X value. Use metric or numeric attribute names as values of the ListY and ListX arguments. Use the Context argument to narrow the scope of specific metric or attribute value. The first Context argument corresponds to the ListY argument and the second Context argument corresponds to the ListX argument. Returns the probability for the Student tdistribution. Use the t-distribution in the hypothesis testing of small sets of sample data. The numeric value (X) that you pass to the function is a calculated value of t for which the probability is to be computed. Returns the t-value of the Student's t-distribution, given the probability and the degrees of freedom. The TInv function is the statistical inverse of the TDist function. Returns the statistical Weibull distribution. Use this function to perform reliability analysis. The value of the Cumulative argument determines the form of the function. If you pass TRUE as the value of the Cumulative argument, Data Analyzer calculates the Weibull cumulative distribution. If you pass FALSE, Data Analyzer calculates the Weibull probability density.
TDist
TInv
Weibull
288
String Functions
Table A-13 lists the functions in the String category:
Table A-13. Functions in the String Category Function Clean Syntax Clean(String) Description Cleans a string of control characters. Removes all nonprintable characters from a string. Use this function to remove control characters from a string. These control characters are characters that may not print with your operating system. Concatenates two strings. If one of the strings is NULL, the Concat function ignores it and returns the other string. If both strings are NULL, the Concat function returns NULL. Compares two strings and returns TRUE if the strings are identical or FALSE if the strings are not identical. The function ignores the case of the letters in the two strings. Use this function to compare two attributes in a report. You can also compare an attribute with a given string value. Finds a text string (Find argument) within another text string (String argument), and returns the number of the starting position of the Find argument text within the String argument text. By default, Data Analyzer searches the string from beginning to end. You can have the Find string search from the end of the string to the beginning by passing TRUE to the FromEnd argument. If the Find argument is not found within the String argument text, Data Analyzer returns NULL. Returns the number of characters in a text string. Converts uppercase string characters to lowercase. Converts a number into a string. Use this function to pass values to other functions that take string arguments. Replaces a character string, or a part of a character string, with a new character string that you specify. You can specify where to start the replacement and the number of characters to replace. Use the Replace function when you want to replace any text that occurs in a specific location in a character string.
Concat
Concat(String1, String2)
EqualsIgnoreCase
EqualsIgnoreCase(String1, String2)
Find
Len(String) Lower(String)
NumberString(X)
Replace
String Functions
289
Table A-13. Functions in the String Category Function Rept Syntax Rept(String, RepeatCount) Description Repeats text a given number of times. Use the Rept function for formatting purposes. For example, you can display an attribute value multiple times within a single cell in the report. Replaces a string of text with a new string of text that you specify. You can specify where to start the replacement and the number of characters to replace. Use the Substitute function when you want to replace specific text in a text string. Returns a portion of a string. The Substring function counts all characters, including blanks, starting at the beginning of the string. Removes blanks from the end of a string. Converts lowercase string characters to uppercase. Compares a given value to all values in a list and returns TRUE if the given value is the same as the value in the list. The function returns FALSE if the given value is different than the value in the list. The Compare1 argument is the given value, which can be a metric or attribute. The CompareList argument is a comma-separated list of values. Use this function to compare metric or attribute values to a list of dates, strings, or numbers. The list of dates, strings, or numbers must be enclosed within quotation marks.
Substitute
Substring
Trim(String) Upper(String)
Within(Compare1, CompareList)
290
Trigonometric Functions
Table A-14 lists the functions in the Trigonometric category:
Table A-14. Functions in the Trigonometric Category Function ArcCos Syntax ArcCos(NumericValue) Description Returns the arc cosine of a numeric value. The arc cosine is the trigonometric inverse of a cosine. The arc cosine is the angle whose cosine is the passed numeric value. As the argument for the ArcCos function, you must pass a value that is between -1 and 1. Returns the inverse hyperbolic cosine of a numeric value. The inverse hyperbolic cosine is the trigonometric inverse of a hyperbolic cosine. As the argument for the ArcCosh function, you must pass a real number that is greater than or equal to 1. Returns the arc cotangent of a numeric value. The arc cotangent is the trigonometric inverse of a cotangent. The arc cotangent is the angle whose cotangent is the passed numeric value. Returns the inverse hyperbolic cotangent of a numeric value. The inverse hyperbolic cotangent is the trigonometric inverse of a hyperbolic cotangent. As the argument for the ArcCoth function, you must pass a value that is outside the range of -1 and 1. Returns the arc cosecant of a numeric value. The arc cosecant is the trigonometric inverse of a cosecant. The arc cosecant is the angle whose cosecant is the passed numeric value. As the argument for the ArcCsc function, you must pass a value that is outside the range of -1 and 1. Returns the inverse hyperbolic cosecant of a numeric value. The inverse hyperbolic cosecant is the trigonometric inverse of a hyperbolic cosecant. Returns the arc secant of a numeric value. The arc secant is the trigonometric inverse of a secant. The arc secant is the angle whose secant is the passed numeric value. Returns the inverse hyperbolic secant of a numeric value. The inverse hyperbolic secant is the trigonometric inverse of a hyperbolic secant. As the argument for the ArcSec function, you must pass a value that is outside the range of -1 and 1. Returns the arc sine of a numeric value. The arc sine is the trigonometric inverse of a sine. The arc sine is the angle whose sine is the passed numeric value. As the argument for the ArcSin function, you must pass a value that is between -1 and 1.
ArcCosh
ArcCosh(NumericValue)
ArcCot
ArcCot(NumericValue)
ArcCoth
ArcCoth(NumericValue)
ArcCsc
ArcCsc(NumericValue)
ArcCsch
ArcCsch(NumericValue)
ArcSec
ArcSec(NumericValue)
ArcSech
ArcSech(NumericValue)
ArcSin
ArcSin(NumericValue)
Trigonometric Functions
291
Table A-14. Functions in the Trigonometric Category Function ArcSinh Syntax ArcSinh(NumericValue) Description Returns the inverse hyperbolic sine of a numeric value. The inverse hyperbolic sine is the trigonometric inverse of a hyperbolic sine. Returns the arc tangent of a numeric value. The arc tangent is the trigonometric inverse of a tangent. The arc tangent is the angle whose tangent is the passed numeric value. Returns the inverse hyperbolic tangent of a numeric value. The inverse hyperbolic tangent is the trigonometric inverse of a hyperbolic tangent. As the argument for the ArcTanh function, you must pass a number that is between -1 and 1. Returns the cosine of a numeric value. Returns the hyperbolic cosine of a numeric value. Returns the cotangent of a numeric value. Returns the hyperbolic cotangent of a numeric value. Returns the cosecant of a numeric value. Returns the hyperbolic cosecant of a numeric value. Returns the secant of a numeric value. Returns the hyperbolic secant of a numeric value. Returns the sine of a numeric value. Returns the hyperbolic sine of a numeric value. Returns the tangent of a given angle. Returns the hyperbolic tangent of a numeric value.
ArcTan
ArcTan(NumericValue)
ArcTanh
ArcTanh(NumericValue)
Cos Cosh Cot Coth Csc Csch Sec Sech Sin Sinh Tan Tanh
Cos(Angle) Cosh(Angle) Cot(Angle) Coth(Angle) Csc(Angle) Csch(Angle) Sec(Angle) Sech(Angle) Sin(Angle) Sinh(Angle) Tan(Angle) Tanh(Angle)
292
Unary Functions
Table A-15 lists the functions in the Unary category:
Table A-15. Functions in the Unary Category Function Abs Exp Syntax Abs(NumericValue) Description Returns the absolute value of a number. Use this function with a numeric metric, numeric attribute, or a calculated numeric value. Returns E raised to the specified power (exponent), where E=2.71828183. For example, EXP(2) returns 7.38905609893065. Most often, you use this function to analyze scientific and technical data, rather than business data. Exp is the opposite of the Log function, which returns the natural logarithm of a numeric value. Use the Exp function with a numeric metric, numeric attribute, or a calculated numeric value. Adds the minus sign to a positive number or removes the minus sign from a negative number. Use the Negate function with a numeric metric, numeric attribute, or a calculated numeric value. You can also use this function within other functions, where you need to change the sign of a numeric value. Removes the plus sign from a given numeric value. If the given value does not have a plus sign, the function returns the same value. Use this function with a numeric metric, numeric attribute, or a calculated numeric value. Returns whether a numeric value is positive, negative, or 0. Use this function with a numeric metric, numeric attribute, or a calculated numeric value.
Exp(NumericValue)
Negate
Negate(NumericValue)
Plus
Plus(NumericValue)
Sign
Sign(NumericValue)
Unary Functions
293
294
Index
A
ABS function description 35 AccrInt function description 36 AccrIntM function description 38 ADD function description 39 AddToDate function description 40 AmorDegrC function description 41 AmorLinC function description 43 And function description 45 ArcCos function description 46, 47 ArcCot function description 48 ArcCoth function description 49 ArcCsc function description 50 ArcCsch function description 51
ArcSec function description 52 ArcSech function description 53 ArcSin function description 54 ArcSinh function description 55 ArcTan function description 56 ArcTanh function description 57 arithmetic operators description 15 using strings in expressions 15 AveDev function description 58 Avg function description 59
B
BinomDist function description 60 BinomInv function description 61
295
C
calculated metrics using functions 4 calculations precision 7 Ceiling function description 62 ChiDist function description 64 ChiInv function description 65 ChiTest function description 66 Clean function description 68 comparison operators description 15 using strings in expressions 15 Concat function description 69 Confidence function description 70 constants E 13 expressions 13 FALSE 13 PI 13 TRUE 13 Context argument attributes 24 equal to operator 24 functions of Running category 29 keywords 26 null values 11 separators 24 syntax 24 using 22 variables 27 Correl function description 71 Cos function description 73 Cosh function description 74 Cot function description 75 Coth function description 76 CountAll function description 77
296 Index
CountUnique function description 78 CoupDayBS function description 79 CoupDayS function description 80 CoupDaySNC function description 81 CoupNCD function description 82 CoupNum function description 83 CoupPCD function description 84 Covar function description 85 Csc function description 87 Csch function description 88 CumIPmt function description 89 CumPrinc function description 91 currency decimals arguments using 7 custom aggregates using functions 4 using variables in expressions 27 custom attributes using functions 5 custom metrics using functions 3
D
date format strings format letters 18 using in expressions 17 using in functions 18 Date function description 95 dates using in expressions 17 DateString function description 96 DateValue function description 97 Day Count Basis argument using 32
Day function description 99 DB function description 93 DDB function description 94 DevSq function description 100 DfToRate function description 101 Disc function description 102 Divide function description 103
F
Factorial function description 117 FALSE constant defined 13 FDist function description 114 Find function description 118 FInv function description 115 Fisher function description 119 FisherInv function description 120 Floor function description 121 Forecast function description 123 functions currency decimals 7 in calculated metrics 4 in custom aggregates 4 in custom attributes 5 in custom metrics 3 null handling 11 supported units of measure 34 syntax 12 using date format strings 18 FV function description 116
E
E constant defined 13 Effect function description 104 ElapsedDays function description 105 ElapsedHours function description 107 ElapsedYears function description 108 EndOfMonth function description 109 Equals function description 110 EqualsIgnoreCase function description 111 Exp function description 112 ExponDist function description 113 expression syntax constants 13 date format strings 17 dates 17 functions 12 general rules 10 null values 10 operators 14 supported units of measure 34
G
GammaDist function description 125 GammaInv function description 126 GammaLog function description 127 GeoMean function description 128 GreaterThan function description 129 GreaterThanEquals function description 130
Index
297
H
HarMean function description 131 Hour function description 132 HypGeomDist function description 133
M
Max function description 147 Max2 function description 148 Median function description 149 Min function description 150 Min2 function description 151 Minute function description 152 Mod function description 153 Mode function description 154 Month function description 155 MovingAvg function description 156 MovingSum function description 158 Multiply function description 160
I
If function description 135 IfNull function description 136 IntDivide function description 137 IntRate function description 138 IRR function description 134
K
Kurt function description 139
N L
layout context using 23 layout keywords using in expressions 26 Len function description 140 LessThan function description 141 LessThanEquals function description 142 Log function description 143 Log10 function description 144 Log2 function description 145 logical operators description 16 Lower function description 146
298 Index
Negate function description 164 Next function description 165 NextDate function description 166 Nominal function description 167 NormDist function description 168 NormInv function description 169 NormSDist function description 170 NormSInv function description 171 Not function description 172 NotEquals function description 173
Now function description 174 NPer function description 163 NPV function description 161 null values Context argument 11 expressions 10 NumberString function description 175
PriceMat function description 191 Product function description 193 PV function description 177
R
Rate function description 194 RateToDf function description 195 Received function description 196 Replace function description 197 Rept function description 198 Round function description 199 RoundDown function description 200 RoundUp function description 201 running category functions using Context argument 29 RunningAvg function description 202 RunningSum function description 203
O
operators arithmetic 15 comparison operators 15 expression syntax 14 logical operators 16 using strings in arithmetic 15 using strings in comparison 15 Or function description 176
P
Pearson function description 178 PercentContribution function description 180 Percentile function description 181 PeriodsPerYear function description 183 PI constant defined 13 Plus function description 184 Pmt function description 185 Power function description 186 precision calculations 7 Previous function description 187 Price function description 188 PriceDisc function description 190
S
Sec function description 206 Sech function description 207 Second function description 208 Sign function description 209 Sin function description 210 Sinh function description 211 Skew function description 212 SLn function description 204
Index 299
Slope function description 213 Sqrt function description 215 Square function description 216 Standardize function description 217 Stdev function description 218 StdevP function description 219 Steyx function description 220 Substitute function description 222 Substring function description 223 Subtract function description 224 Sum function description 225 SYD function description 205 syntax expressions 10
Trim function description 238 TriMean function description 237 TRUE constant defined 13 Trunc function description 239 TTest function description 231
U
Units function description 240 units of measure supported in expressions 34 Upper function description 241
V
value context using 23 value keywords using in expressions 26 Var function description 245, 246 VDB function description 242, 244
T
Tan function description 233 Tanh function description 234 TBillEq function description 226 TBillPrice function description 227 TBillYield function description 228 TDist function description 229 time attributes using in Context argument 25 Time function description 235 TInv function description 230 Today function description 236
W
Weekday function description 248 WeekNum function description 247 Weibull function description 249 Within function description 250
X
XIRR function description 252 XNPV function description 254
300
Index
Y
Year function description 256 Yield function description 257, 259 YieldMat function description 260
Z
ZTest function description 261
Index
301
302
Index