0% found this document useful (0 votes)
231 views

Manual Informatica Powercenter

Manual e GUIDE do informatica powercenter 8.11

Uploaded by

Eder Geraldo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views

Manual Informatica Powercenter

Manual e GUIDE do informatica powercenter 8.11

Uploaded by

Eder Geraldo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 318

Data Analyzer Calculation and

Function Reference

Informatica PowerCenter®
(Version 8.1.1)
PowerCenter Data Analyzer Calculation and Function Reference
Version 8.1.1
September 2006
Copyright © 2001-2006 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, PowerCenter, PowerCenterRT, PowerCenter Connect, PowerCenter Data Analyzer, PowerMart, Superglue, Metadata Manager, Informatica Data
Quality and Informatica Data Explorer are trademarks or registered trademarks of Informatica Corporation in the United States and in jurisdictions throughout
the world. All other company and product names may be trade names or trademarks of their respective owners. U.S. Patent Pending.

BEA and WebLogic are registered trademarks of BEA Systems, Inc.

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 © GoAmerica Communications 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-2006 The
Apache Software Foundation. All rights reserved.

This product includes software developed by the Indiana University Extreme! Lab. For further information please visit http://www.extreme.indiana.edu/.
Copyright © 2002 The Trustees of Indiana University. All rights reserved.

The Qexo software (with related files and documentation) included with this Informatica software are copyright (C) 1996-2006 Per Bothner. Permission is
hereby granted, free of charge, to any person obtaining a copy of the Qexo software and associated documentation files (the "Qexo Software"), to deal in the
Qexo Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Qexo Software, and to permit persons to whom the Qexo Software is furnished to do so.

The Kawa software included with this Informatica software are copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore. Permission to use,
copy, modify, and distribute this Kawa software and its documentation for any purpose and without fee is hereby granted.

The iText Library included with this Informatica software are copyright (C) 1999-2006 by Bruno Lowagie and Paulo Soares. All Rights Reserved. Your right to
use such materials is set forth in the GNU Library General Public License or the Mozilla Public License which may be found, along with the source code, at
http://www.lowagie.com/. The iText Library 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.

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
About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvi
Other Informatica Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Visiting Informatica Customer Portal . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Visiting the Informatica Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Visiting the Informatica Developer Network . . . . . . . . . . . . . . . . . . . . xvii
Visiting the Informatica Knowledge Base . . . . . . . . . . . . . . . . . . . . . . xvii
Obtaining Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

Chapter 1: Using Calculations in Data Analyzer . . . . . . . . . . . . . . . . . 1


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Types of Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Custom Metric Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Custom Aggregate Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Calculated Metric Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Custom Attribute Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Precision for a Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Currency Decimals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Chapter 2: Expression Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
General Rules of Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Nulls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Function Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

iii
Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Date Format Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Chapter 3: Setting the Context for a Function . . . . . . . . . . . . . . . . . .21


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Types of Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Layout Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Value Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Syntax for the Context Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Equal (=) Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Separators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
$AGGREGATE_BY$ Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Setting the Context for Functions of Running Category . . . . . . . . . . . . . . . . 29

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

iv Table of Contents
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
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

Table of Contents v
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
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

vi Table of Contents
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
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

Table of Contents vii


PeriodsPerYear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Pmt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Previous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Price . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
PriceDisc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
PriceMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
RateToDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Received . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Replace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Rept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Round . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
RoundDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
RoundUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
RunningAvg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
RunningSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
SLn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
SYD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Sec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Sech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Second . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Sin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Sinh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Skew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Slope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Sqrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Square . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Standardize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Stdev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
StdevP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Steyx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Substitute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

viii Table of Contents


Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
TBillEq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
TBillPrice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
TBillYield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
TDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
TInv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
TTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Tan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Tanh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Today . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
TriMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Trim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Trunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Upper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
VDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
ValueOf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
VarP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
WeekNum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Weekday . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Weibull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Within . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
XIRR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
XNPV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Yield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
YieldDisc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
YieldMat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
ZTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

Appendix A: Function Quick Reference . . . . . . . . . . . . . . . . . . . . . . 261


Aggregate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Comparative Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Conditional Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

Table of Contents ix
Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Date & Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Fetch Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Financial Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Rounding Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Running Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Statistical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Unary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

x Table of Contents
List of Figures
Figure 1-1. Custom Metrics Page in Advanced Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 1-2. Custom Aggregates Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 1-3. Calculated Metric Properties Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 1-4. Custom Attribute Page in Advanced Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

List of Figures xi
xii List of Figures
List of Tables
Table 2-1. Expression Syntax . . . . . . . . . . . . . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 10
Table 2-2. Operators in Expressions . . . . . . . . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 14
Table 2-3. Arithmetic Operators in Expressions . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 15
Table 2-4. Comparison Operators in Expressions . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 15
Table 2-5. Logical Operators in Expressions . . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 16
Table 2-6. Date Format Letters in Data Analyzer Functions . .. . .. . . .. . . .. . .. . . .. . .. . . 18
Table 3-1. Time Attributes Used in Setting Context . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 25
Table 3-2. Keywords for Specifying the Context Argument . . .. . .. . . .. . . .. . .. . . .. . .. . . 26
Table 4-1. Values of the DayCountBasis Argument . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 33
Table 4-2. Arguments for the Units Function . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . . 34
Table A-1. Functions in the Aggregate Category . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 262
Table A-2. Functions in the Boolean Category . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 267
Table A-3. Functions in the Comparative Category . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 268
Table A-4. Functions in the Conditional Category . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 269
Table A-5. Function in the Conversion Category . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 270
Table A-6. Functions in the Date & Time Category . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 271
Table A-7. Functions in the Fetch Category . . . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 273
Table A-8. Functions in the Financial Category . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 274
Table A-9. Functions in the Mathematical Category . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 280
Table A-10. Functions in the Rounding Category . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 281
Table A-11. Functions in the Running Category . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 282
Table A-12. Functions in the Statistical Category . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 283
Table A-13. Functions in the String Category . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 287
Table A-14. Functions in the Trigonometric Category . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 289
Table A-15. Functions in the Unary Category . . . . . . . . . . . .. . .. . . .. . . .. . .. . . .. . .. . 291

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
About This Book
The Data Analyzer Calculation and Function Reference is written for information providers
who want to perform advanced calculations on metrics and attributes. The Calculation and
Function Reference provides information on writing mathematical expressions to create metric
and attribute calculations in Data Analyzer. The Calculation and Function Reference also
provides information on the syntax and usage of the functions available for the expressions.
The material in this book is also available online.

Document Conventions
This guide uses the following formatting conventions:

If you see… It means…

italicized text The word or set of words are especially emphasized.

boldfaced text Emphasized subjects.

italicized monospaced text 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.

Note: The following paragraph provides additional facts.

Tip: The following paragraph provides suggested uses.

Warning: The following paragraph notes situations where you can overwrite
or corrupt data, unless you follow the specified procedure.

monospaced text This is a code example.

bold monospaced text This is an operating system command you enter from a prompt to
run a task.

xvi Preface
Other Informatica Resources
In addition to the product manuals, Informatica provides these other resources:
♦ Informatica Customer Portal
♦ Informatica web site
♦ Informatica Developer Network
♦ Informatica Knowledge Base
♦ Informatica Technical Support

Visiting Informatica Customer Portal


As an Informatica customer, you can access the Informatica Customer Portal site at
http://my.informatica.com. The site contains product information, user group information,
newsletters, access to the Informatica customer support case management system (ATLAS),
the Informatica Knowledge Base, Informatica Documentation Center, and access to the
Informatica user community.

Visiting the Informatica Web Site


You can access the Informatica corporate web site at http://www.informatica.com. The site
contains information about Informatica, its background, upcoming events, and sales offices.
You will also find product and partner information. The services area of the site includes
important information about technical support, training and education, and implementation
services.

Visiting the Informatica Developer Network


You can access the Informatica Developer Network at http://devnet.informatica.com. The
Informatica Developer Network is a web-based forum for third-party software developers.
The site contains information about how to create, market, and support customer-oriented
add-on solutions based on interoperability interfaces for Informatica products.

Visiting the Informatica Knowledge Base


As an Informatica customer, you can access the Informatica Knowledge Base at
http://my.informatica.com. Use the Knowledge Base to search for documented solutions to
known technical issues about Informatica products. You can also find answers to frequently
asked questions, technical white papers, and technical tips.

Obtaining Technical Support


There are many ways to access Informatica Technical Support. You can contact a Technical
Support Center by using the telephone numbers listed the following table, you can send
email, or you can use the WebSupport Service.

Preface xvii
Use the following email addresses to contact Informatica Technical Support:
[email protected] for technical inquiries
[email protected] 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 Europe / Middle East / Africa Asia / Australia

Informatica Corporation Informatica Software Ltd. Informatica Business Solutions


Headquarters 6 Waltham Park Pvt. Ltd.
100 Cardinal Way Waltham Road, White Waltham Diamond District
Redwood City, California Maidenhead, Berkshire Tower B, 3rd Floor
94063 SL6 3TN 150 Airport Road
United States United Kingdom Bangalore 560 008
India

Toll Free Toll Free Toll Free


877 463 2435 00 800 4632 4357 Australia: 00 11 800 4632 4357
Singapore: 001 800 4632 4357

Standard Rate Standard Rate Standard Rate


United States: 650 385 5800 Belgium: +32 15 281 702 India: +91 80 4112 5738
France: +33 1 41 38 92 26
Germany: +49 1805 702 702
Netherlands: +31 306 022 797
United Kingdom: +44 1628 511 445

xviii Preface
Chapter 1

Using Calculations in Data


Analyzer
This chapter includes the following topics:
♦ Overview, 2
♦ Types of Calculations, 3
♦ Precision for a Calculation, 7

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:
♦ Functions
♦ Metrics
♦ Attributes
♦ Constants
♦ Variables
♦ Keywords
♦ Operators
The following custom metric expression uses some of the preceding components:
ROUND({Revenue},1) + ABS({Sales Qty})/SUM({Cost})

The expression contains the following components:


♦ Metrics: Revenue, Cost, and Sales Qty
♦ Functions: ROUND(), ABS(), and SUM()
♦ Operators: / and +

2 Chapter 1: Using Calculations in Data Analyzer


Types of Calculations
You can write expressions to create the following calculations:
♦ Custom metrics
♦ Custom aggregates
♦ Calculated metrics
♦ Custom attributes

Custom Metric Calculations


You can create custom metrics for reports on the Create Report wizard or the Analyze tab.
When you create a custom metric in advanced mode, you can use Data Analyzer functions. In
custom metric expressions, you can use metrics, attributes, or constants with functions.
Figure 1-1 shows the Custom Metrics page, in advanced mode, where you can enter the
custom metric expression:

Figure 1-1. Custom Metrics Page in Advanced Mode

For more information about custom metrics, see “Adding Calculations to a Report” in the
Data Analyzer User Guide.

Types of Calculations 3
Custom Aggregate Calculations
You can create custom aggregates for reports on the Create Report wizard or the Analyze tab.
When you create a custom aggregate, you can use Data Analyzer functions. In custom
aggregate expressions, you can use metrics, attributes, or constants with functions.
Figure 1-2 shows the Custom Aggregates page where you can enter the custom metric
expression:

Figure 1-2. Custom Aggregates Page

For more information about custom aggregates, see “Adding Calculations to a Report” in the
Data Analyzer User Guide.

Calculated Metric Calculations


You can create calculated metrics in the Schema Directory on the Administration tab. When
you create a calculated metric, you can use Data Analyzer functions. In calculated metric
expressions, you can use metrics or constants with functions.

4 Chapter 1: Using Calculations in Data Analyzer


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.

Custom Attribute Calculations


You can create custom attributes for reports on the Analyze tab or in the Schema Directory on
the Administration tab. When you create a custom attribute in advanced mode, you can use
Data Analyzer functions.
When you create a custom attribute expression in a report, you can use attributes, metrics, or
constants with functions.
When you create a custom attribute expression in the Schema Directory, you can use
attributes or constants with functions.

Types of Calculations 5
Figure 1-4 shows the advanced mode of the Custom Attribute page in the Schema Directory
where you can enter the custom attribute expression:

Figure 1-4. Custom Attribute Page in Advanced Mode

For more information about custom attributes in a report, see “Adding Custom Attributes to
a Report” in the Data Analyzer User Guide. For more information about custom attributes in
the Schema Directory, see “Working with Custom Attributes” in the Data Analyzer Schema
Designer Guide.

6 Chapter 1: Using Calculations in Data Analyzer


Precision for a Calculation
Precision is the number of digits after the decimal point in a numeric value. When any of the
values in an expression has a precision of two or more, Data Analyzer assigns the return value
the same precision as that of the value with the highest precision. For example, you have the
metric Sales Price with a value of 402.86 in the custom metric expression:
{Sale Price} + .2586)

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.

Precision for a Calculation 7


8 Chapter 1: Using Calculations in Data Analyzer
Chapter 2

Expression Syntax

This chapter includes the following topics:


♦ Overview, 10
♦ Function Syntax, 12
♦ Constants, 13
♦ Operators, 14
♦ Dates, 17

9
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.

General Rules of Syntax


Table 2-1 lists the general rules of syntax that apply when writing all expressions:

Table 2-1. Expression Syntax

Syntax Rule Syntax Rule

Enclose metric or attribute names in curly brackets as follows: {Sales}


{metric_name}

When a metric or attribute name occurs more than once in the {Sales|Sales}
repository, clarify which to use with the folder name and a pipe, as
follows:
{folder_name|metric_name}
Note: Unnecessary use of the pipe may produce unexpected
results.

Use parentheses to define the order of execution. Data Analyzer To find the sum, then the product:
evaluates the innermost set of parentheses before proceeding to (6*(4+8))
the next.

Surround arguments in parentheses as follows: ABS({Profit})


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 For the AmorDegrC function, if you pass the
pass any other optional arguments that occur ahead of it in the CurrencyDecimals argument, you must also pass
function syntax. the DayCountBasis argument.

Data Analyzer does not support nested statistical functions. The following functions are not supported:
STDEV(ABS({Sales Qty}))
VAR(ROUND({Sales Qty},2))

Do not nest functions within aggregate functions. Functions not supported:


SUM(ABS({Sales Qty}))
MEDIAN(ROUND({Profit}))

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 Chapter 2: Expression Syntax


and the value of Product Price is NULL, the value of the custom metric is NULL.

Null Handling in Functions


If you use a function in the expression, null handling depends on the function being used. For
most functions, if you pass a null value, the function returns a NULL.
For aggregate functions, by default, Data Analyzer ignores null values. For example, in the
following custom metric expression:
Avg(Sale Price)

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.

Null Values in the Context Argument


You can pass the Context argument to certain functions to set a scope for the function. If a
value of the Context argument evaluates to NULL, the function does not select the row or
column. If the Context evaluates to NULL for all rows or columns for a metric or attribute,
the function returns NULL. The exceptions to this rule are the CountAll and CountUnique
functions, which return zero.

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 Chapter 2: Expression Syntax


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 convert 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)

Use the following constants as the arguments for certain functions:


♦ 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. Arithmetic operators
2. Comparison operators
3. 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 Return Value

8+5-2*8 -3

8 + (5 - 2) * 8 32

14 Chapter 2: Expression Syntax


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 about comparing 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

Equivalent
Operator Meaning
SQL Operator

! NOT 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.

& AND Joins two conditions and returns TRUE if both conditions evaluate to TRUE. Returns
FALSE if one condition is not true.

| OR Connects two conditions and returns TRUE if any condition evaluates to TRUE.
Returns FALSE if both conditions are not true.

Expressions that combine a null value with a Boolean expression produce results that are
ANSI-compliant. For example, Data Analyzer produces the following results:
♦ NULL AND TRUE = NULL
♦ NULL AND FALSE = FALSE

16 Chapter 2: Expression Syntax


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 about 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.

Date Format Strings


The date format string defines the structure of a date. Use date format strings to convert input
dates into other date formats.
Date format strings used in Data Analyzer functions are derived from the Java programming
language. You must enter a date format string using certain date format letters, as specified in
Java. Date format strings are case sensitive and must be enclosed within quotation marks.

Dates 17
Using Date Format Strings in Functions
You can pass the DateFormat argument to certain functions. The value of the DateFormat
argument is a case-sensitive date format string that defines the structure of a date. Use the
DateFormat argument to pass the date format string to the following functions:
♦ 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")

Date Format Letters


Use the date format letters to specify a date format string. You can also use the date format
letters to change how date and timestamp attributes display in your reports. For more
information, see “Managing Account Information” in the Data Analyzer User Guide.
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.
Table 2-6 lists the date format letters you can use to specify a part of a date. The examples in
the table are based on the following date:
August 20, 2004 4:35 PM GMT

Table 2-6. Date Format Letters in Data Analyzer Functions

Format Letter Description Examples

G Era designator. G returns AD.

y Year portion of date. yyyy returns 2004.


yy returns 04.

M Month portion of date. If the number of letters is 3 or more, Data M returns 8.


Analyzer interprets the month as text, otherwise, Data Analyzer MM returns 08.
interprets the month as a number. MMM returns Aug.
MMMM returns August.

w Week number in year. w returns 34.

W Week number in month. W returns 3.

D Day number in year. D returns 233.

d Day number in month. d returns 20.

18 Chapter 2: Expression Syntax


Table 2-6. Date Format Letters in Data Analyzer Functions

Format Letter Description Examples

E Day of week, returned as text. E, EE, and EEE return Fri.


EEEE returns Friday.

a AM or PM marker, returned as text. a returns PM.

H Hour of day (0 to 23), where zero is 12 AM (midnight). H and HH return 16.

h Hour number in AM or PM (1 to 12). hh returns 4.


hh returns 04.

m Minute number in hour. m and mm returns 35.

s Second portion of date. s returns 0.


ss returns 00.

S Millisecond portion of date. S returns 000.

z Time zone, returned as text. 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 2: Expression Syntax
Chapter 3

Setting the Context for a


Function
This chapter includes the following topics:
♦ Overview, 22
♦ Types of Contexts, 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 Chapter 3: Setting the Context for a Function


Types of Contexts
Context can be one of the following types:
♦ Layout context
♦ Value context

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 called a
layout-dependent custom metric. You cannot create filters or set rankings for layout-
dependent metric calculations. For more information about layout-dependent metric
calculations, see “Adding Calculations to a Report” in the Data Analyzer User Guide.
When you use a layout context in a custom attribute expression, the custom attribute is called
a layout-dependent custom attribute. When you use layout-dependent custom attributes in a
report, the following restrictions apply:
♦ The report cannot use cross tabular or sectional report tables.
♦ The report cannot use time settings.
For more information about layout-dependent custom attributes, see “Adding Custom
Attributes 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 Contexts 23
Syntax for the Context Argument
You must enclose the context within double quotation marks. You must enclose an attribute
or metric value within single quotation marks.
The syntax for the Context argument can include any combination of the following elements:
♦ Equal (=) operator
♦ Separators
♦ Attributes
♦ Keywords
♦ $AGGREGATE_BY$ variable

Equal (=) Operator


Use the equal (=) operator when setting the context for a function. The Data Analyzer equal
(=) operator is the same as the SQL IN operator. The function performs the calculation on
any of the data values that match the condition. The following expression is an example of the
equal (=) operator where Sales is a metric in the report and State is an attribute in the report:
Sum({Sales}, "{State}='CA', 'AZ'")

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
calendar attributes, see “Working with Time Dimensions” in the Data Analyzer Schema
Designer Guide.

24 Chapter 3: Setting the Context for a Function


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
Meaning Example
Name

HOUR_NUM Refers to the hour number in To calculate the total sales made between 10:00 and 11:00
day. am, use the following expression:
Sum({Sales}, "{@HOUR_NUM}=10")

YEAR_DAY_NUM Refers to the day number in To calculate the total sales made on the first day of the year,
year. use the following expression:
Sum({Sales}, "{@YEAR_DAY_NUM}=1")

YEAR_WEEK_NUM Refers to the week number To calculate the total sales made in the fourth week of the
in year. year, use the following expression:
Sum({Sales}, "{@YEAR_WEEK_NUM}=4")

YEAR_MONTH_NUM Refers to the month number To calculate the total sales made in the month of June, use
in year. the following expression:
Sum({Sales}, "{@YEAR_MONTH_NUM}=6")

QUARTER_NUM Refers to the quarter To calculate the average sales made in the first quarter, use
number. 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 Refers to the year number. To calculate the total sales made in 2003, use the following
expression:
Sum({Sales}, "{@YEAR_NUM}=2003")

Syntax for the Context Argument 25


Table 3-1. Time Attributes Used in Setting Context

Time Attribute
Meaning Example
Name

DATE_TIME Refers to the date and time To calculate the total sales made on February 14, 2004 at
values. In the expression, 11:00 am, use the following expression:
the value of the DATE_TIME Sum({Sales}, "{@DATE_TIME}=2004-02-14
time attribute must be in the 11:00:00")
following format:
yyyy-MM-dd HH:mm:ss
Note: The above is the ISO
date format.

DATE_NO_TIME Refers to the date value. In To calculate the total sales made on February 14, 2004, use
the expression, the value of the following expression:
the DATE_NO_TIME time Sum({Sales}, "{@DATE_TIME}=2004-02-14")
attribute must be in the
following format:
yyyy-MM-dd
Note: The above is the ISO
date format.

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.

Table 3-2 lists the keywords you can use:

Table 3-2. Keywords for Specifying the Context Argument

Type of
Keyword Meaning Example
Keyword

COLUMN Layout Refers to all the column To calculate the sum for the Sales column in a simple report
attributes. table, use the following expression:
Sum({Sales}, "@COLUMN")

ROW Layout Refers to all the row You have a report that displays as a cross tabular report
attributes. Use ROW in table. The report displays the Sales for each product
reports with cross tabular category for each state. Category is the column attribute and
report tables. State is the row attribute. To calculate the sum for the Sales
values for each row, use the following expression:
Sum({Sales}, "@ROW")

26 Chapter 3: Setting the Context for a Function


Table 3-2. Keywords for Specifying the Context Argument

Type of
Keyword Meaning Example
Keyword

SECTION Layout Refers to all the section You have a report that displays as a sectional report table.
attributes. Use SECTION The report displays the Sales for each product category by
in reports with sectional region. Region is the section attribute and Category is the
report tables. 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 You have a report that displays the sales for each state and
current position in the each category. State and Category are row attributes. To
processing of the calculate what percent of sales for each row contributed to
function. You cannot use the total sales for that state, use the following expression:
THIS in a custom {Sales}/Sum({Sales},
aggregate expression. "{State}=THIS")*100

CURRENT Value Refers to the current To calculate the total sales made in the current quarter, use
calendar. Use this the following expression:
keyword in reports with Sum({Sales}, "{@QUARTER_NUM}=CURRENT")
time settings. You cannot
use CURRENT in a
report with time settings
that displays Hour by
Hour granularity.

NULL Value Checks whether a value You have a report that displays sales made in the current
is NULL. 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")

Performing a Calculation on a Set of Values


When you use the COLUMN, ROW, or SECTION keywords, you can perform the
calculation on a set of values. You can specify this set of values by entering the start and end
positions. Use 1 for the first row or column, 2 for the second row or column, and so on. For
example, if you want the Sum function to perform the calculation on rows two through six
and columns five through seven, you can use the following expression:
Sum({Sales}, "@ROW=2,6; @COLUMN=5,7")

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 variables in custom aggregates, see “Adding Calculations to
a Report” in the Data Analyzer User Guide.

28 Chapter 3: Setting the Context for a Function


Setting the Context for Functions of Running Category
Functions in the Running category allow you to perform calculations that display trends
within a set of values. The following functions belong to the Running category:
♦ MovingAvg
♦ MovingSum
♦ PercentContribution
♦ RunningAvg
♦ RunningSum
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 more information about 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.

Setting the Context for Functions of Running Category 29


30 Chapter 3: Setting the Context for a Function
Chapter 4

Functions

This chapter includes information on Data Analyzer functions that you can use in
expressions. Each function description includes:
♦ Syntax
♦ Return Value
♦ Example
♦ Notes (optional)

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.

Day Count Basis Argument


You can pass the DayCountBasis argument to certain financial functions. Day count basis is a
method of interest calculation using a day count fraction, where the numerator is the elapsed
days between two dates and the denominator is the number of days in a year.
Different countries and financial institutions use different day count fractions. Data Analyzer
provides the commonly used day count fractions for use in expressions.

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 Meaning

ACT/360 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.

ACT/365 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.

ACT/365L 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.

ACT/ACT 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.

NASD 30/360 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.

30/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 and if first date is the 30th or 31st, second date is adjusted to 30th of
the same month.

30E/360 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 the 30th of the same month.

30E+/360 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 the 1st of the next month.

Note: Values of the DayCountBasis argument are not case sensitive and must be enclosed
within quotation marks.

Function Categories 33
Supported Units of Measure
The Units function converts the value you specify in one unit of measure to another unit of
measure.
Table 4-2 lists the units of measure you can use as arguments for the Units function:

Table 4-2. Arguments for the Units Function

Type of Unit Supported Units

Angles gradient, grad, degree, deg, radian, rad

Area square millimeter, mm2, square centimetercm2, square decimeter, dm2, square meter, m2,
hectare, square kilometer, km2, square inch, in2, square foot, square feet, ft2, square yard, yd2,
square rod, acre, square mile

Computer storage byte, kilobyte, megabyte, gigabyte, terabyte, petabyte, exabyte

Length angstrom, nanometer, nm, micrometer, millimeter, mm, centimeter, cm, decimeter, dm, meter, m,
kilometer, km, inch, in, foot, feet, ft, yard, yd, fathom, rod, chain, furlong, mile, mi, nautical mile,
league, astronomical unit, au, light year, parsec

Mass milligram, mg, centigram, cg, decigram, dg, gram, g, kilogram, kg, grain, carat, pennyweight,
dram, ounce, ou, newton, pound, lb, stone, quarter, cental, hundredweight, ton, tonne, long ton

Metric yocto, zepto, atto, femto, pico, nano, micro, milli, centi, deci, base, deka, hecto, kilo, mega, giga,
tera, peta, exa, zetta, yotta

Semantic millionth, thousandth, hundredth, eighth, quarter, half, tenth, one, pair, two, three, five, half dozen,
measures ten, dozen, hundred, gross (equals 144), thousand, grand, million, billion, trillion

Speed cm/sec, m/min, km/h, ft/sec, mph, knot, yd/sec, m/sec, mi/min, mach, km/sec, mi/sec, light

Temperature F, fahrenheit, C, celcius, centigrade, K, kelvin

Time nanosecond microsecond, millisecond, ms, second, sec, minute, min, hour, hr, day, dy, week, wk,
fortnight, month, year, decade, century, millennium

Volume cubic millimeter, mm3, milliliter, ml, cubic centimeter, cm3, centiliter, cl, liter, l, kiloliter, kl, cubic
meter, m3, cubic inch, in3, cubic foot, cubic feet, ft3, cubic yard, yd3, tablespoon, tblsp, fluid
ounce, cup, pint, pt, quart, qt, gallon, gal, UK ounce, UK pint, UK quart, UK gallon

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 Datatype Description

NumericValue Numeric 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 Return Value
-------- ------------
-1.56 1.56
-3.99 3.99
0.99 0.99
-3.49 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 Datatype Description

IssueDate Date Required. Date when the security was issued. Must be less than
SettlementDate.

FirstInterestDate Date Required. Date when the security will make its first interest payment.

SettlementDate Date 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.

Rate Numeric 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.

ParValue Numeric Optional. Par value of a security. Default is 1,000. Must be greater than
or equal to 0.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

Return Value
Numeric

Examples
The following expression returns 25.42 as the accrued interest for a government savings bond:
AccrInt(Date(2000,3,31), Date(2000,9,30), Date(2000,6,1), 0.15, 1000,
"semiannual", "30E+/360")

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 Datatype Description

IssueDate Date Required. Date when the security was issued. Must be less than
SettlementDate.

SettlementDate Date 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.

Rate Numeric 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.

ParValue Numeric Optional. Par value of a security. Default is 1,000. Must be greater than
or equal to 0.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Quantity in Stock Return Value
------------- ----------------- ------------
200 252 452
9855 566 10421
6.89 3.52 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 Datatype Description

Date Date Required. Date value you want to pass to the function.

Years Numeric Required. Number of years.

Months Numeric Required. Number of months.

Days Numeric 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 Return Value
------------ ------------
1/12/2001 2/17/2001
10/9/2002 11/14/2002
1/29/2004 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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

PurchaseDate Date Required. Date asset was purchased. Must be less than
FirstPeriodDate.

FirstPeriodDate Date 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.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Period Numeric 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.

Rate Numeric 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.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

Return Value
Numeric

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 41
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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

PurchaseDate Date Required. Date asset was purchased. Must be less than
FirstPeriodDate.

FirstPeriodDate Date 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.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Period Numeric 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.

Rate Numeric 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.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

BooleanValue1 Boolean Required. Boolean condition you want to pass to the function.

BooleanValue2 Boolean Required. Boolean condition you want to pass to the function.

Return Value
Boolean

Examples
The following expression returns TRUE:
And(TRUE, TRUE)

The following expression returns FALSE:


And(TRUE, FALSE)

The following expression returns TRUE:


And(Equals(2+2, 4), Equals(2+3, 5))

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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

NumericValue Numeric 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Amount Sold
-------- -----------
Drinks 13253.74
Drinks 6392.94
Drinks 10502.07
Snacks 550.05
Drinks 5420.59
Drinks 6974.26
Snacks 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be between 0 and Trials, inclusive.

Trials Numeric Required. Number of independent trials.

ProbabilityOfSuccess Numeric Required. Probability of a success on a single trial. Must be between 0


and 1, inclusive.

Cumulative Boolean 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 Datatype Description

Probability Numeric Required. Probability associated with the distribution. Must be between
0 and 1, inclusive.

Trials Numeric Required. Number of independent trials.

ProbabilityOfSuccess Numeric 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 Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Significance Return Value
------ ------------ ------------
2.425 1 2.5
-2.425 1 -2.4
2.425 2 2.43
-2.425 2 -2.42
2.425 3 2.425
-2.425 3 -2.424
2.425 0 3
-2.425 0 -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 chi-
squared test allows you to compare observed and expected values.
This function belongs to the Statistical category.

Syntax
ChiDist(X, DegreesOfFreedom)

Argument Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be greater than or equal to 0.

DegreesOfFreedom Numeric 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 Datatype Description

Probability Numeric Required. Probability associated with the distribution. Must be between
0 and 1, inclusive.

DegreesOfFreedom Numeric 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 Datatype Description

ListObserved Numeric List Required. List of observed values. Use a metric or attribute name.

ListExpected Numeric List Required. List of expected results. Use a metric or attribute name.

Context1 String 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.

Context2 String 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.

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 Expected Rating Actual Rating
--------- --------------- -------------
30-39 5.5 6
30-39 3 3.5
20-29 8.5 9.9
30-39 6 6
20-29 7 12
30-39 7 7

66 Chapter 4: Functions
30-39 4.3 5
30-39 2 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 Datatype Description

String String 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 Datatype Description

String1 String Required. String value you want to pass to the function.

String2 String 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 Last Name Return Value
---------- --------- ------------
Beth Kelley BethKelley
Marin Jones MarinJones
george cash georgecash
Ally NULL 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 Datatype Description

Alpha Numeric Required. The alpha variable.

StdDev Numeric Required. Standard deviation of a list of numbers.

Size Numeric 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 Datatype Description

List1 Numeric List Required. Name of a metric or attribute.

List2 Numeric List Required. Name of a metric or attribute.

Context1 String 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.

Context2 String 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.

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 2004 Sales 2003 Sales
-------- ---------- ----------
Drinks 1500 2500
Drinks 5000 2250
Food 38088 10502
Drinks 6200 800
Drinks 750 150
Drinks 2000 750

Correl 71
Food 28195 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 Datatype Description

Angle Numeric 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 Return Value
------- -----------------
0 1.0
90 0.0
70 0.342020143325593
NULL NULL

Cos 73
COSH
Returns the hyperbolic cosine of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Cosh(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------- ----------------
1.0 1.54308063481524
3.66 19.4435376920294
0 1.0
NULL NULL

74 Chapter 4: Functions
COT
Returns the cotangent of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Cot(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------- ------------
1.0 0.64
0.52 1.74653
5 -0.30
NULL NULL

Cot 75
COTH
Returns the hyperbolic cotangent of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Coth(Angle)

Argument Datatype Description

Angle Numeric 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Region
------------ --------
Roger Northern
Sean Eastern
Tim Northern
Pearce 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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 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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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 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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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 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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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
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 Datatype Description

List1 Numeric List Required. Name of a metric or attribute.

List2 Numeric List Required. Name of a metric or attribute.

Context1 String 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.

Context2 String 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.

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 Quantity Sold Quantity on Hand

----------- ------------- ----------------

Perishables 1500 2500

Perishables 5000 2250

Apparel 38088 10502

Perishables 6200 800

Covar 85
Perishables 750 150

Perishables 2000 750

Apparel 28195 6974

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 Datatype Description

Angle Numeric 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 Datatype Description

Angle Numeric 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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

PresentValue Numeric Required. Current value of an asset or liability. Must be greater than 0.

StartPeriod Numeric Required. Starting period for the calculation. Must be between 1 and
EndPeriod, inclusive.

EndPeriod Numeric Required. Ending period for the calculation. Must be greater than or
equal to 1.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

PresentValue Numeric Required. Current value of an asset or liability. Must be greater than 0.

StartPeriod Numeric Required. Starting period for the calculation. Must be between 1 and
EndPeriod, inclusive.

EndPeriod Numeric Required. Ending period for the calculation. Must be greater than or
equal to 1.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Life Numeric Required. Number of periods over which an asset is being depreciated.
Must be greater than 0.

Period Numeric 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.

FirstYearMonths Numeric Optional. Number of months in the first year of life. Default is 12. Must
be between 1 and 12, inclusive.

CurrencyDecimals Numeric 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 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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Life Numeric Required. Number of periods over which an asset is being depreciated.
Must be greater than 0.

Period Numeric 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.

RateFactor Numeric Optional. Factor used in calculating the rate. Default is 2. Must be
greater than 0.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

Year Numeric Required. Number representing the year. Must be between 1,000 and
3,000, inclusive.

Month Numeric Required. Number representing the month of the year. Must be between
1 and 12, inclusive.

Day Numeric 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 Datatype Description

Date Date Required. Date value you want to pass to the function.

DateFormat String 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))

The following expression returns the string 26/5/2004:


DateString(Date(2004, 5, 26), "d/M/yyyy")

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 Datatype Description

DateString String Required. Date being specified as string. You must enclose the date
string within quotation marks.

DateFormat String 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 Date Format

---------------- ------------

"6-APR-1984" d-MMM-yyyy
"06-APR-1984" dd-MMM-yyyy

"April 6, 1984" MMM d, yyyy

"April 06, 1984" MMM dd, yyyy


"1984/4/6" yyyy/M/d

"1984/04/6" yyyy/MM/d

"1984/4/06" yyyy/M/dd
"1984/04/06" yyyy/MM/dd

"1984.APR.6" yyyy.MMM.d

"1984.APR.06" yyyy.MMM.dd
"4/6/1984" M/d/yyyy

"04/6/1984" MM/d/yyyy

"4/06/1984" M/dd/yyyy
"04/06/1984" MM/dd/yyyy

"1984-APR-6" yyyy-MMM-d

"1984-APR-06" yyyy-MMM-dd
"6.APR.1984" d.MMM.yyyy

"06.APR.1984" dd.MMM.yyyy

"1984-04-06" yyyy-MM-dd
"1984-4-6" 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 Datatype Description

Date Date 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

DiscountFactor Numeric Required. Discount factor of rate. Must be greater than or equal to 0.

RateConvention String 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.

ElapsedYears Numeric Required. Elapsed years, expressed as a decimal number. Must be


greater than or equal to 0.

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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Price Numeric Required. Security price per $100 face value. Must be greater than 0.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

DayCountBasis String 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Return Value
------ ------------
1000 500
520.75 260.375
6511 3255.5
0 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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

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 Datatype Description

Date1 Date Required. Date value you want to pass to the function.

Date2 Date Required. Date value you want to pass to the function.

DayCountBasis String 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 End Date Return Value
---------- --------- ------------
1/13/2004 3/20/2004 67
3/20/2004 5/5/2004 46
5/5/2004 5/9/2004 4
5/9/2004 9/10/2004 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")

To get the same result as the Microsoft Excel days360(start_date, end_date, true) function,
use the following expression:

ElapsedDays 105
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 Datatype Description

Date1 Date Required. Date value you want to pass to the function.

Date2 Date 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 End Date Return Value
---------- --------- ------------
1/13/2004 3/20/2004 1608
3/20/2004 5/5/2004 1103
5/5/2004 5/9/2004 96
5/9/2004 9/10/2004 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 Datatype Description

Date1 Date Required. Date value you want to pass to the function.

Date2 Date Required. Date value you want to pass to the function.

DayCountBasis String 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 End Date Return Value
---------- --------- ------------
1/13/2000 3/20/2001 1.186
3/20/2001 5/5/2002 1.125
5/5/2002 5/9/2003 1.011
5/9/2002 9/10/2004 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 Datatype Description

Date Date 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Return Value
----- ------------
200 FALSE
120 TRUE
122 FALSE
50 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 Datatype Description

String1 String Required. String value you want to pass to the function.

String2 String 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 Product Category Return Value
--------------- ---------------- ------------
Big Can Drinks Drinks FALSE
drinks Drinks TRUE
National Bottle Drinks FALSE
drinks Supplies 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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
10 22026.46579
-2 0.135334
8.55 5166.75443
NULL 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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation.

Lambda Numeric Required. The lambda variable.

Cumulative Boolean 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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation.
Must be greater than or equal to 0.

DegreesOfFreedomNum Numeric Required. Whole number representing the numerator degrees of


freedom numerator. Must be between 1 and 10,000, inclusive.

DegreesOfFreedomDenom Numeric 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 Datatype Description

Probability Numeric Required. Probability associated with the distribution. Must be


between 0 and 1, inclusive.

DegreesOfFreedomNum Numeric Required. Whole number representing the numerator degrees of


freedom numerator. Must be between 1 and 10,000, inclusive.

DegreesOfFreedomDenom Numeric 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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

Payment Numeric Required. Payment amount due.

PresentValue Numeric Optional. Current value of an asset or liability.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

NumericValue Numeric 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 Return Value
------- ------------
6 720
1 1
5 120
2.2 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 Datatype Description

String String Required. String value you want to pass to the function.

Find String Required. String to find within other string.

FromEnd Boolean 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 Return Value
-------------- ------------
Now, on stock 6
Not available NULL
On Stock 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 Datatype Description

X Numeric 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 Datatype Description

X Numeric 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 Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Significance Return Value
------ ------------ ------------
2.425 1 2.4
-2.425 1 -2.5
2.425 2 2.42
-2.425 2 -2.43
2.425 3 2.424
-2.425 3 -2.425
2.425 0 2
245 -1 240
245 -2 200
245 -3 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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation.

ListY Numeric List Required. Name of a metric or attribute representing known dependent
values.

ListX Numeric List Required. Name of a metric or attribute representing known


independent values.

Context1 String 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.

Context2 String 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.

Return Value
Numeric

Examples
The following expression returns 4534.59 as the forecasted sales for the year 2004 for T-
shirts, 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
------------- ---------- ----------
Women 1500 2500

Forecast 123
Women 5000 2250
Men 38088 10502
Women 6200 800
Women 750 150
Women 2000 750
Men 28195 6974

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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be greater than or equal to 0.

Alpha Numeric Required. The alpha variable. Must be greater than 0.

Beta Numeric 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 Datatype Description

Probability Numeric Required. Probability associated with the distribution. Must be between
0 and 1, inclusive.

Alpha Numeric Required. The alpha variable. Must be greater than 0.

Beta Numeric 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 Datatype Description

X Numeric 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Percent Growth
-------- --------------
Drinks 5.5
Food 7
Drinks 4
Snacks 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Western Sales Return Value
------------- ------------- ------------
200 220 FALSE
120 121 FALSE
122 122 FALSE
250 205 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Western Sales Return Value
------------- ------------- ------------
200 220 FALSE
120 121 FALSE
122 122 TRUE
250 205 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Percent Growth
-------- --------------
Drinks 13
Food 12
Drinks 20
Snacks 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 Datatype Description

Date Date 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 Return Value
---------------- ------------
2004-03-10 2:15 2
2004-06-06 14:53 14
2004-06-01 7:20 7
2003-12-15 0:37 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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be between 0 and Successes, inclusive.

SampleSize Numeric Required. Number of elements in the sample. Must be between 0 and
PopulationSize, inclusive.

Successes Numeric Required. Number of successes in the population. Must be less than or
equal to PopulationSize.

PopulationSize Numeric 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 Datatype Description

CashFlows Numeric List Required. Name of a metric or attribute representing a series of cash
flows.

Context String 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 Datatype Description

If Boolean Required. Boolean input for conditional test.

True Varies Required. Object to be returned if test results are true.

False Varies 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 Return Value
----- ------------
45.50 7
69.99 10
5.59 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 Datatype Description

List Varies Required. Name of a metric or attribute.

ReturnValue Varies Required. Return value if a the metric or attribute value is NULL.

OtherValue Varies 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 Return Value
----- ------------
5000 5000
NULL 1000
NULL 1000
2300 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Return Value
------ ------------
18 2
24 3
20.25 2
26 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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Investment Numeric Required. Amount invested in the security. Must be greater than 0.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

DayCountBasis String 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Percent Growth
-------- --------------
Drinks 3
Food 2
Drinks 5
Snacks 7
Drinks 7
Snacks 9
Food 3

Kurt 139
LEN
Returns the number of characters in a text string.
This function belongs to the String category.

Syntax
Len(String)

Argument Datatype Description

String String 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 Return Value
-------- ------------
Ohio 4
Hawaii 6
New York 8
Oregon 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Western Sales Return Value
------------- ------------- ------------
200 220 TRUE
120 121 TRUE
122 122 FALSE
250 205 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Western Sales Return Value
------------- ------------- ------------
200 220 TRUE
120 121 TRUE
122 122 TRUE
250 205 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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
10 2.30
100 4.61
835.92 6.73
2 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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
10 1.00
100 2.00
835.92 2.92
2 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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
10 3.32
100 6.64
835.92 9.71
2 1.00

Log2 145
LOWER
Converts uppercase string characters to lowercase.
This function belongs to the String category.

Syntax
Lower(String)

Argument Datatype Description

String String 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 Return Value
------------- ------------
ruby ruby
Rachel rachel
MATTHEW matthew
LeBron 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Overseas Sales Return Value
-------------- -------------- ------------
500865 200000 500865
8000 20000 20000
45000 1000 45000
1000 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Overseas Sales Return Value
-------------- -------------- ------------
500865 200000 200000
8000 20000 8000
45000 1000 1000
1000 45000 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 Datatype Description

Date Date 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 Return Value
---------------- ------------
2004-03-10 2:15 15
2004-06-06 14:53 53
2004-06-01 7:20 20
2003-12-15 0:37 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Return Value
----- ------------
1500 0
7125 5
3500 0
1095 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Datatype Description

Date Date 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Size Numeric Required. Number of elements for which you want to perform the
calculation.

Context String 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 Return Value
----- ------------
600 600
504 504
36 36
100 100
550 358
39 245.8
490 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Size Numeric Required. Number of elements for which you want to perform the
calculation.

Context String 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 Return Value
----- ------------
600 600
504 504
36 36
100 100
550 1790
39 1229
490 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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Quantity Sold Return Value
--------------- ------------- ------------
5 600 3000
2 504 1008
0 36 0
3 100 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 Datatype Description

CashFlows Numeric List Required. Name of a metric or attribute representing a series of cash
flows.

Rate Numeric 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

Context String 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 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 Cash Flows
--------- ----------
January 13253.74
February 6392.94
March 10502.07
April 5420.59
May 6974.26

NPV 161
June 89114.60
July 9174.55
August 6974.26
September 10502.07
October 6974.26
November 13253.74
December 7774.11

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 Datatype Description

Rate Numeric 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.

PresentValue Numeric Required. Current value of an asset or liability.

Payment Numeric Required. Payment amount due. Must not equal 0.

FutureValue Numeric Optional. Worth of an asset in the future.

PaymentAtBeginning Boolean 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 Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function.

Return Value
Numeric

Examples
The following expression returns -10:
Negate(10)

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 Datatype Description

Metric Varies 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 Return Value
------- ------------
1500 7125
7125 3500
3500 1090
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 Datatype Description

Date Date Required. Date value you want to pass to the function.

Frequency String Required. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

NumberPeriods Numeric Optional. Number of periods or payments. Must be greater than 0.

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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation.

Mean Numeric Required. Average of a list of numbers.

StdDev Numeric Required. Standard deviation of a list of numbers. Must be greater than
0.

Cumulative Boolean 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 Datatype Description

Probability Numeric Required. Probability associated with the distribution.

Mean Numeric Required. Average of a list of numbers.

StdDev Numeric 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 Datatype Description

X Numeric 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 Datatype Description

Probability Numeric 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 Datatype Description

BooleanValue Boolean 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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

Compare2 Varies 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 Price in 2003 Return Value
------------- ------------- ------------
2.01 3.66 TRUE
5.2 7.85 TRUE
12 12 FALSE
9.5 8 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 Datatype Description

X Numeric 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 Return Value
--------------- ------------
6 5
5.2 5.2
3 3
9.5 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 Datatype Description

BooleanValue1 Boolean Required. Boolean condition you want to pass to the function.

BooleanValue2 Boolean 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 Cost Return Value
----- ----- ------------
22000 5500 TRUE
52820 25000 TRUE
9000 6000 FALSE
19000 9500 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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

Payment Numeric Required. Payment amount due.

FutureValue Numeric Optional. Worth of an asset in the future.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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 Datatype Description

List1 Numeric List Required. Name of a metric or attribute.

List2 Numeric List Required. Name of a metric or attribute.

Context1 String 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.

Context2 String 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.

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 2004 Sales 2003 Sales
------------- ---------- ----------
Women 1500 2500
Women 5000 2250
Men 38088 10502
Women 6200 800

178 Chapter 4: Functions


Women 750 150
Women 2000 750
Men 28195 6974

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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Return Value
-------- ------------
25661.79 17.76
25597.34 17.71
38088.29 26.35
26977.24 18.67
28195.74 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Percentile Numeric Required. Percentile you want to calculate. Must be between 0 and 100,
inclusive.

Context String 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

Notes
If a value is NULL, the function ignores the row.

Percentile 181
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 Datatype Description

Frequency String 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")

182 Chapter 4: Functions


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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
+600 600
520 520
-35 -35
950 950

Plus 183
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 Datatype Description

Rate Numeric 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.

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

PresentValue Numeric Required. Current value of an asset or liability.

FutureValue Numeric Optional. Worth of an asset in the future.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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.

184 Chapter 4: Functions


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 Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Return Value
------- ------------
10 100
220 48400
-3 9
8.5 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.

Power 185
PREVIOUS
Returns the previous value for the specified metric or attribute.
This function belongs to the Fetch category.

Syntax
Previous(Metric)

Argument Datatype Description

Metric Varies 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 Return Value
----------------- ------------
1500 NULL
7125 1500
3500 7125
1090 3500

Notes
PowerAnalyzer returns NULL if the specified value is the first value in the metric or attribute.

186 Chapter 4: Functions


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Rate Numeric 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.

Yield Numeric 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.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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")

Price 187
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.

188 Chapter 4: Functions


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Discount Numeric 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.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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.

PriceDisc 189
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

IssueDate Date Required. Date when the security was issued. Must be less than or
equal to SettlementDate.

Rate Numeric 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.

Yield Numeric 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.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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")

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.

190 Chapter 4: Functions


When you pass an optional argument, you must also pass all other optional arguments that
occur before it in the function syntax.

PriceMat 191
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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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.

192 Chapter 4: Functions


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 Datatype Description

NumberPeriods Numeric Required. Number of periods or payments. Must be greater than 0.

Payment Numeric Required. Payment amount due.

PresentValue Numeric Required. Current value of an asset or liability.

FutureValue Numeric Optional. Worth of an asset in the future.

PaymentAtBeginning Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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.

Rate 193
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 Datatype Description

Rate Numeric 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.

RateConvention String 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.

ElapsedYears Numeric Required. Elapsed years, expressed as a decimal number. Must be


greater than or equal to 0.

Return Value
Numeric

Examples
The following expression returns 0.3 as the discount factor:
RateToDf(0.054, "annual", 5)

194 Chapter 4: Functions


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Investment Numeric Required. Amount invested in the security. Must be greater than 0.

Discount Numeric 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.

DayCountBasis String 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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.

Received 195
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 Datatype Description

String String Required. String value you want to pass to the function.

Start Numeric Required. Position where you want to start. For example, 1 represents
the first position. Must not equal 0.

Count Numeric Required. Number of characters. Must be greater than or equal to 0.

Replace String Required. Replacement string.

Return Value
String

Examples
The following expression:
Replace("I left my heart in San Francisco.", 11, 5, "lung")

returns the following string:


I left my lung in San Francisco.

Notes
Use the Substitute function when you want to replace specific text in a text string.

196 Chapter 4: Functions


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 Datatype Description

String String Required. String value you want to pass to the function.

RepeatCount Numeric 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 Return Value
---------------- ------------
Boys BoysBoys
Girls GirlsGirls
Men MenMen
Women WomenWomen

Rept 197
ROUND
Returns all values rounded to the specified number of digits.
This function belongs to the Rounding category.

Syntax
Round(NumericValue [, Significance])

Argument Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Return Value
----------- ------------
15.846 15.85
8.43333333 8.43
9.0623 9.06
11.193 11.19

Notes
Returns the same value if the significance is greater than the scale of the value.

198 Chapter 4: Functions


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 Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Significance Return Value
------- ------------ ------------
25.4469 3 25.446
8.85676 2 8.85
149.42 -2 100
42.2131 2 42.21
4.23 5 4.23001
4.23 0 4

Notes
Returns the same value if the significance is greater than the scale of the value.

RoundDown 199
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 Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Significance Return Value
------- ------------ ------------
25.4469 3 25.447
8.85676 2 8.86
149.42 -2 200
42.2131 2 42.22
4.23 5 4.23
4.23 0 5

200 Chapter 4: Functions


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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Monthly Sales Return Value
-------- ------------- ------------
January 25661.79 25661.79
February 25597.34 25629.57
March 38088.29 29782.47
April 26977.24 29081.17
May 28195.74 28904.08

Notes
This function ignores NULLs when performing the calculation.

RunningAvg 201
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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Monthly Sales Return Value
-------- ------------- ------------
January 25661.79 25661.79
February 25597.34 51259.13
March 38088.29 89347.42
April 26977.24 116324.66
May 28195.74 144520.40

Notes
This function ignores NULLs when performing the calculation.

202 Chapter 4: Functions


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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Life Numeric Required. Number of periods over which an asset is being depreciated.
Must be greater than 0.

CurrencyDecimals Numeric 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)

SLn 203
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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Life Numeric Required. Number of periods over which an asset is being depreciated.
Must be greater than 0.

Period Numeric 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

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)

204 Chapter 4: Functions


SEC
Returns the secant of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Sec(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------ ------------
10 -1.19
0.5 1.14
-2.5 -1.25
NULL NULL

Sec 205
SECH
Returns the hyperbolic secant of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Sech(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------- ------------
1.0 0.65
2.51 0.16
0 1.00
-0.2 0.98

206 Chapter 4: Functions


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 Datatype Description

Date Date 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 Return Value
------------------- ------------
2004-03-10 2:15:15 15
2004-06-06 14:53:22 22
2004-06-01 7:20:00 00
2003-12-15 0:37:05 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.

Second 207
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 Datatype Description

NumericValue Numeric 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 Return Value
------ ------------
1584 1
-843 -1
0 0
NULL NULL

208 Chapter 4: Functions


SIN
Returns the sine of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Sin(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------ ------------
0.92 0.80
1.5 1.00
3.25 -0.11
NULL NULL

Sin 209
SINH
Returns the hyperbolic sine of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Sinh(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------- ------------
1.0 1.18
5.45 116.38
0.32 0.33
2.89 8.97

210 Chapter 4: Functions


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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Sales Growth
------- ------------
Books -2846.15
Apparel -375.88
Toys 2179.39
Bicyles 569.74
Shoes 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.

Skew 211
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 Datatype Description

ListY Numeric List Required. Name of a metric or attribute representing known dependent
values.

ListX Numeric List Required. Name of a metric or attribute representing known


independent values.

Context1 String 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.

Context2 String 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.

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 Cost
-------- --------
25661.79 13253.74
25597.34 6392.94
38088.29 10502.07
26977.24 5420.59

212 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.

Slope 213
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 Datatype Description

NumericValue Numeric 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)

The following expression returns 12:


Sqrt(144)

214 Chapter 4: Functions


SQUARE
Returns the square of a given number.
This function belongs to the Mathematical category.

Syntax
Square(NumericValue)

Argument Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function.

Return Value
Numeric

Examples
The following expression returns 100.00:
Square(10)

The following expression returns 144.00:


Square(-12)

Square 215
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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation.

Mean Numeric Required. Average of a list of numbers.

StdDev Numeric 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)

216 Chapter 4: Functions


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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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.

Stdev 217
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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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.

218 Chapter 4: Functions


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 Datatype Description

ListY Numeric List Required. Name of a metric or attribute representing known dependent
values.

ListX Numeric List Required. Name of a metric or attribute representing known


independent values.

Context1 String 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.

Context2 String 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.

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 Cost
-------- --------
25661.79 13253.74
25597.34 6392.94
38088.29 10502.07
26977.24 5420.59
28195.74 6974.26

Steyx 219
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.

220 Chapter 4: Functions


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 Datatype Description

String String Required. String value you want to pass to the function.

Find String Required. String to find within other string.

Replace String Required. Replacement string.

Instance Numeric 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...", ".", "!")

returns the following string:


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)

returns the following string:


The product sales are low.!.

Notes
Use the Replace function when you want to replace any text that occurs in a specific location
in a text string.

Substitute 221
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 Datatype Description

String String Required. String value you want to pass to the function.

Start Numeric Required. Position where you want to start. For example, 1 represents
the first position. Must not equal 0.

Count Numeric 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 Return Value
------------ ------------
809-555-0269 809
650-593-3851 650
415-385-5391 415
720-780-7993 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.

222 Chapter 4: Functions


SUBTRACT
Returns the result of one numeric value subtracted by another.
This function belongs to the Mathematical category.

Syntax
Subtract(NumericValue1, NumericValue2)

Argument Datatype Description

NumericValue1 Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

NumericValue2 Numeric 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 Cost Return Value
-------- -------- ------------
25661.79 13253.74 12408.05
25597.34 6392.94 19204.40
38088.29 10502.07 27586.22
26977.24 5420.59 21556.65
28195.74 6974.26 21221.48

Subtract 223
SUM
Returns the sum of all values
This function belongs to the Aggregate category.

Syntax
Sum(List [, Context])

Argument Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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

224 Chapter 4: Functions


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Discount Numeric 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.

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.

TBillEq 225
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Discount Numeric 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.

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.

226 Chapter 4: Functions


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Price Numeric Required. Security price per $100 face value. Must be greater than 0.

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.

TBillYield 227
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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be greater than or equal to 0.

DegreesOfFreedom Numeric 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.

Tails Numeric 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.

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)

228 Chapter 4: Functions


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 Datatype Description

Probability Numeric Required. Probability associated with the distribution. Must be between
0 and 1, inclusive.

DegreesOfFreedom Numeric 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.

Tails Numeric 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.

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)

TInv 229
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 Datatype Description

List1 Numeric List Required. Name of a metric or attribute.

List2 Numeric List Required. Name of a metric or attribute.

Context1 String 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.

Context2 String 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.

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 Canada List price
-------------- -----------------
15 16.5
8 9.25
9 10
11 11.75

230 Chapter 4: Functions


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.

TTest 231
TAN
Returns the tangent of a given angle.
This function belongs to the Trigonometric category.

Syntax
Tan(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------ ------------
0.55 0.61
0.75 0.93
1 1.56
NULL NULL

232 Chapter 4: Functions


TANH
Returns the hyperbolic tangent of a numeric value.
This function belongs to the Trigonometric category.

Syntax
Tanh(Angle)

Argument Datatype Description

Angle Numeric 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 Return Value
------- ------------
2.89 0.99
5.45 1.00
1.0 0.76
0 0.00

Tanh 233
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 Datatype Description

Date Date Required. Date value you want to pass to the function.

Hour Numeric Required. Number representing the hour of the day. Must be between 0
and 23, inclusive.

Minute Numeric Optional. Number representing the minute of the hour. Must be between
0 and 59, inclusive.

Second Numeric 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 Return Value
---------------- ---------------
2004-03-10 2:15 2004-03-10 5:30
2004-06-06 14:53 2004-06-06 5:30
2004-06-01 7:20 2004-06-01 5:30
2003-12-15 0:37 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.

234 Chapter 4: Functions


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())

Today 235
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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Revenue
-------- --------
Drinks 13253.74
Food 6392.94
Drinks 10502.07
Snacks 550
Food 5420.59
Drinks 6974.26

236 Chapter 4: Functions


TRIM
Removes blanks from the end of a string.
This function belongs to the String category.

Syntax
Trim(String)

Argument Datatype Description

String String 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 Return Value
---------------- ------------
" Boys" "Boys"
"Girls " "Girls"
" Women " "Women"
"Men" "Men"

Trim 237
TRUNC
Returns the value truncated to a specific digit.
This function belongs to the Rounding category.

Syntax
Trunc(NumericValue [, Significance])

Argument Datatype Description

NumericValue Numeric Required. Numeric value you want to pass to the function. You can
enter a numeric literal, numeric metric name, or numeric attribute name.

Significance Numeric 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 Return Value
---------------- ------------
15.846 15.845
8.43333333333333 8.433
9.0623 9.062
11.2 11.199

Notes
Returns the same value if you specify a significance that is greater than the scale of the value.

238 Chapter 4: Functions


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 Datatype Description

Units1 String Required. Units to convert from.

Units2 String Required. Units to convert to.

NumericValue Numeric 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.

Units 239
UPPER
Converts lowercase string characters to uppercase.
This function belongs to the String category.

Syntax
Upper(String)

Argument Datatype Description

String String 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 Return Value
------------- ------------
ruby RUBY
Rachel RACHEL
MATTHEW MATTHEW
LeBron LEBRON

240 Chapter 4: Functions


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 Datatype Description

Cost Numeric Required. Cost of the asset. Must be greater than or equal to 0.

Salvage Numeric Required. Value or worth of the asset after depreciation. Must be
between 0 and Cost, inclusive.

Life Numeric Required. Number of periods over which an asset is being depreciated.
Must be greater than 0.

StartPeriod Numeric Required. Starting period for the calculation. Must be greater than or
equal to 0.

EndPeriod Numeric Required. Ending period for the calculation.

RateFactor Numeric Optional. Factor used in calculating the rate. Default is 2. Must be
greater than 0.

NoSwitch Boolean 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

Return Value
Numeric

VDB 241
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.

242 Chapter 4: Functions


VALUEOF
Returns the value of a given metric for a given context.
This function belongs to the Aggregate category.

Syntax
ValueOf(List, Context)

Argument Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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 Amount Sold
------------- -----------
Toys 500,000
Clothes 250,555
Bicycles 125,000
Scooters 4300

ValueOf 243
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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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.

244 Chapter 4: Functions


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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

Context String 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.

VarP 245
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 Datatype Description

Date Date 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 Return Value
--------- ------------
9/10/2004 37
9/22/2004 39
10/1/2004 40
11/5/2004 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.

246 Chapter 4: Functions


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 Datatype Description

Date Date 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 Return Value
--------- ------------
9/10/2004 5
9/22/2004 3
10/1/2004 5
10/5/2004 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.

Weekday 247
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 Datatype Description

X Numeric Required. Number for which you want to perform the calculation. Must
be greater than or equal to 0.

Alpha Numeric Required. The alpha variable. Must be greater than 0.

Beta Numeric Required. The beta variable. Must be greater than 0.

Cumulative Boolean 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)

The following expression returns 0.00 as the Weibull probability density:


Weibull(121, 10, 15, FALSE)

248 Chapter 4: Functions


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 Datatype Description

Compare1 Varies Required. Value you want to compare. You can pass a numeric, date, or
string value.

CompareList String 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 comma-
separated 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 Return Value
---------------- ------------
2004-03-10 FALSE
2004-06-06 FALSE
2004-06-01 TRUE
2003-12-15 FALSE

Notes
When comparing a date attribute to the values in a list, you must enter values in the yyyy-
MM-dd format.

Within 249
When comparing a given string value to the values in the list, the Within function ignores the
case of the letters.

250 Chapter 4: Functions


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 Datatype Description

CashFlows Numeric List Required. Name of a metric or attribute representing a series of cash
flows.

Dates Date List Required. List of dates passed to the function. Use a date attribute
name.

Context1 String 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.

Context2 String 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.

Return Value
Numeric

Examples
The following expression returns 0.801 as the internal rate of return:
XIRR({Cash Flows}, {Payment Date})
Payment Date Cash Flows
------------ ----------
1/1/2004 -15000
3/1/2004 10000
5/30/2004 5000
8/15/2004 2000
11/4/2004 1000

Notes
The cash flows must include at least one positive and at least one negative value.

XIRR 251
To calculate the internal rate of return for periodic cash flows, use the IRR function.

252 Chapter 4: Functions


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 Datatype Description

CashFlows Numeric List Required. Name of a metric or attribute representing a series of cash
flows.

Dates Date List Required. List of dates passed to the function. Use a date attribute
name.

Rate Numeric 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.

CurrencyDecimals Numeric Optional. Currency places to the right of the decimal point. Default is 2.
Must be between 0 and 3, inclusive.

Context1 String 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.

Context2 String 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.

Return Value
Numeric

Examples
The following expression returns 2000.14 as the net present value:
XNPV({Cash Flows}, {Payment Date}, 0.12)
Payment Date Cash Flows
------------ ----------
1/1/1998 -15000
3/1/1998 10000

XNPV 253
10/30/1998 5000
2/15/1999 2000
4/1/1999 1000

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.

254 Chapter 4: Functions


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 Datatype Description

Date Date 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.

Year 255
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Rate Numeric 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.

Price Numeric Required. Security price per $100 face value. Must be greater than 0.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

Frequency String Optional. Frequency of payments. The frequency can be "annual",


"semiannual", "quarterly", "monthly", "weekly", or "daily". Default is
"annual". Enclose the frequency within quotation marks.

DayCountBasis String 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.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")

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


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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

Price Numeric Required. Security price per $100 face value. Must be greater than 0.

Redemption Numeric Required. Amount to be received at maturity per $100 face value. Must
be greater than 0.

DayCountBasis String 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 257
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 Datatype Description

SettlementDate Date 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.

MaturityDate Date Required. Date when the security matures or expires.

IssueDate Date Required. Date when the security was issued. Must be less than or
equal to SettlementDate.

Rate Numeric 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.

Price Numeric Required. Security price per $100 face value. Must be greater than 0.

DayCountBasis String 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.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.

258 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 Datatype Description

List Numeric List Required. Name of a metric or attribute.

X Numeric Required. Number for which you want to perform the calculation.

StdDev Numeric Optional. Standard deviation of a list of numbers. Must be greater than 0.

Context String 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 Defective Parts
------------- ---------------
Widgets 10
Widgets 15
Tools 3
Widgets 20
Tools 1
Widgets 18
Widgets 13

ZTest 259
260 Chapter 4: Functions
Appendix A

Function Quick Reference

This appendix provides a quick reference for all functions available in Data Analyzer:
♦ Aggregate Functions, 262
♦ Boolean Functions, 267
♦ Comparative Functions, 268
♦ Conditional Functions, 269
♦ Conversion Functions, 270
♦ Date & Time Functions, 271
♦ Fetch Functions, 273
♦ Financial Functions, 274
♦ Mathematical Functions, 280
♦ Rounding Functions, 281
♦ Running Functions, 282
♦ Statistical Functions, 283
♦ String Functions, 287
♦ Trigonometric Functions, 289
♦ Unary Functions, 291

261
Aggregate Functions
Table A-1 lists functions in the Aggregate category:

Table A-1. Functions in the Aggregate Category

Function Syntax Description

AveDev AveDev(List [, Context]) 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.

Avg Avg(List [, Context]) Returns the average of all values in a list.

ChiTest ChiTest(ListObserved, Returns the chi-squared goodness of fit


ListExpected [, Context1, between expected and observed lists. Use this
Context2]) 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.

Correl Correl(List1, List2 [, Returns the correlation coefficient of two sets of


Context1, Context2]) 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.

CountAll CountAll(List [, Context]) 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.

CountUnique CountUnique(List [, Context]) 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.

262 Appendix A: Function Quick Reference


Table A-1. Functions in the Aggregate Category

Function Syntax Description

Covar Covar(List1, List2 [, Context1, Returns covariance of two sets of values.


Context2]) 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.

DevSq DevSq(List [, Context]) 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.

Forecast Forecast(X, ListY, ListX [, Predicts a future value based on existing


Context1, Context2]) 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.

GeoMean GeoMean(List [, Context]) 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.

HarMean HarMean(List [, Context]) 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.

Kurt Kurt(List [, Context]) 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.

Aggregate Functions 263


Table A-1. Functions in the Aggregate Category

Function Syntax Description

Max Max(List [, Context]) Returns the maximum value of a numeric metric


or attribute.

Median Median(List [, Context]) 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.

Min Min(List [, Context]) Returns the minimum value of a numeric metric


or attribute.

Mode Mode(List [, Context]) 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.

Pearson Pearson(List1, List2 [, Returns the Pearson product moment


Context1, Context2]) 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.

Product Product(List [, Context]) Returns the result of multiplying values in a


numeric metric or attribute.

Skew Skew(List [, Context]) 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.

264 Appendix A: Function Quick Reference


Table A-1. Functions in the Aggregate Category

Function Syntax Description

Slope Slope(ListY, ListX [, Context1, Returns the slope of the linear regression line
Context2]) 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.

Stdev Stdev(List [, Context]) 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.

StdevP StdevP(List [, Context]) 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.

Steyx Steyx(ListY, ListX [, Context1, Returns the statistical standard error of linear
Context2]) 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.

Sum Sum(List [, Context]) Returns the sum of all values.

TTest TTest(List1, List2 [, Context1, Returns the two-tailed probability associated


Context2]) 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.

Aggregate Functions 265


Table A-1. Functions in the Aggregate Category

Function Syntax Description

TriMean TriMean(List [, Context]) 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.

ValueOf ValueOf(List, Context) Returns the value of a given metric for a given
context.

Var Var(List [, 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.

VarP VarP(List [, Context]) 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.

ZTest ZTest(List, X [, StdDev, Returns the two-tailed probability of a z-test for


Context]) 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.

266 Appendix A: Function Quick Reference


Boolean Functions
Table A-2 lists functions in the Boolean category:

Table A-2. Functions in the Boolean Category

Function Syntax Description

And And(BooleanValue1, Joins two conditions and returns TRUE if both conditions are
BooleanValue2) true. Returns FALSE if any condition or both conditions are not
true.

Not Not(BooleanValue) 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.

Or Or(BooleanValue1, Compares two conditions and returns TRUE if either of the two
BooleanValue2) conditions is TRUE. Returns FALSE if both conditions are
FALSE. Use metric and attribute names in the arguments.

Boolean Functions 267


Comparative Functions
Table A-3 lists functions in the Comparative category:

Table A-3. Functions in the Comparative Category

Function Syntax Description

Equals Equals(Compare1, Compare2) 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.

GreaterThan GreaterThan(Compare1, Compares two numeric values. Use this


Compare2) function to compare metrics or attributes to
other metrics, attributes, or constant values.

GreaterThanEquals GreaterThanEquals(Compare1, Compares two numeric values. Use this


Compare2) function to compare metrics or attributes to
other metrics, attributes, or constant values.

LessThan LessThan(Compare1, Compare2) Compares two numeric values. Use this


function to compare metrics or attributes to
other metrics, attributes, or constant values.

LessThanEquals LessThanEquals(Compare1, Compares two numeric values. Use this


Compare2) function to compare metrics or attributes to
other metrics, attributes, or constant values.

NotEquals NotEquals(Compare1, Compare2) Compares two numeric values. Use this


function to compare metrics or attributes to
other metrics, attributes, or constant values.

Within Within(Compare1, CompareList) 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.

268 Appendix A: Function Quick Reference


Conditional Functions
Table A-4 lists functions in the Conditional category:

Table A-4. Functions in the Conditional Category

Function Syntax Description

If If(If, True, False) Returns one of two specified values based on the results
of a condition.

IfNull IfNull(List, ReturnValue [, Returns the specified value if a condition returns NULL.
OtherValue] Use to replace NULL in a metric or attribute.

Conditional Functions 269


Conversion Functions
Table A-5 lists the function in the Conversion category:

Table A-5. Function in the Conversion Category

Function Syntax Description

Units Units(Units1, Units2, NumericValue) Converts the value you specify in one unit of
measure (Units1) to another unit of measure
(Units2), and returns the new value.

270 Appendix A: Function Quick Reference


Date & Time Functions
Table A-6 lists the functions in the Date & Time category:

Table A-6. Functions in the Date & Time Category

Function Syntax Description

AddToDate AddToDate(Date, Years, Adds years, months, and days to a date, and returns
Months, Days) the adjusted date. Use this function to pass a date
value to another function.

Date Date(Year, Month, Day) Returns a date given the year, month, and day values
you pass to the function. Use this function to pass a
date value to another function.

DateString DateString(Date [, Converts a date to a string. By default, the function


DateFormat]) 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.

DateValue DateValue(DateString [, Converts a string to a date. You can pass the date
DateFormat]) 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. Use this function to pass a date value
to another function.

Day Day(Date) Returns the day of a date value. The Day function
returns the day as an integer, with values ranging from
1 to 31.

ElapsedDays ElapsedDays(Date1, Date2 [, Returns the number of days in the period between the
DayCountBasis]) specified start time and end time, given a day count
basis. Use this function with date attributes.

ElapsedHours ElapsedHours(Date1, Date2) Returns the number of hours in the period between the
specified start time and end time. Use this function
with date attributes. The ElapsedHours function
precision is milliseconds (expressed as a decimal
number).

ElapsedYears ElapsedYears(Date1, Date2 Returns the number of years in the period between the
[, DayCountBasis]) specified start time and end time, given a day count
basis. The elapsed number of years is expressed as a
decimal number. Use this function with date attributes.

Date & Time Functions 271


Table A-6. Functions in the Date & Time Category

Function Syntax Description

EndOfMonth EndOfMonth(Date) 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.

Hour Hour(Date) 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.

Minute Minute(Date) 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.

Month Month(Date) Returns the month of a date value. The function


returns the month as an integer, with values ranging
from 1 (January) to 12 (December).

NextDate NextDate(Date, Frequency [, Returns the next date in a period or payment schedule.
NumberPeriods])

Now Now() Returns the value of the current date and time. Use
this function to pass a date value to another function.

Second Second(Date) 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.

Time Time(Date, Hour [, Minute, Sets the time of day for a date. Use this function to set
Second]) 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.

Today Today() Returns the value of the current date. Use this function
to pass a date value to another function.

WeekNum WeekNum(Date) Returns the number of the week within a year for a
date value. The function returns the number of the
week as an integer.

Weekday Weekday(Date) 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).

Year Year(Date) Returns the year of a date value. The Year function
returns the year as an integer.

272 Appendix A: Function Quick Reference


Fetch Functions
Table A-7 lists the functions in the Fetch category:

Table A-7. Functions in the Fetch Category

Function Syntax Description

Next Next(Metric) Returns the next value for the specified metric.

Previous Previous(Metric) Returns the previous value for the specified metric or attribute.

Fetch Functions 273


Financial Functions
Table A-8 lists the functions in the Financial category:

Table A-8. Functions in the Financial Category

Function Syntax Description

AccrInt AccrInt(IssueDate, Returns the accrued interest for a security that


FirstInterestDate, pays periodic interest. The interest rate (Rate
SettlementDate, Rate [, argument) must be adjusted for the frequency of
ParValue, Frequency, payments. To adjust the interest rate for
DayCountBasis, frequency, divide the annual rate by the number
CurrencyDecimals]) 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.

AccrIntM AccrIntM(IssueDate, Returns the accrued interest for a security that


SettlementDate, Rate [, pays interest at maturity. The interest rate (Rate
ParValue, DayCountBasis, argument) must be adjusted for the frequency of
CurrencyDecimals]) payments. To adjust the interest rate for
frequency, divide the annual rate by the number
of payments made in an year.

AmorDegrC AmorDegrC(Cost, PurchaseDate, Returns the depreciation for each accounting


FirstPeriodDate, Salvage, period, based on a depreciation coefficient. If an
Period, Rate [, DayCountBasis, asset is purchased in the middle of the
CurrencyDecimals]) 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.

AmorLinC AmorLinC(Cost, PurchaseDate, Returns the depreciation for each accounting


FirstPeriodDate, Salvage, period. If an asset is purchased in the middle of
Period, Rate [, DayCountBasis, the accounting period, the function prorates the
CurrencyDecimals]) depreciation.

CoupDayBS CoupDayBS(SettlementDate, Returns the total number of coupon days from


MaturityDate [, Frequency, the beginning of a coupon period to the
DayCountBasis]) settlement date.

CoupDayS CoupDayS(SettlementDate, Returns the total number of coupon days in the


MaturityDate [, Frequency, coupon period that contains the settlement date.
DayCountBasis])

CoupDaySNC CoupDaySNC(SettlementDate, Returns the total number of coupon days from


MaturityDate [, Frequency, the settlement date to the next coupon date.
DayCountBasis])

CoupNCD CoupNCD(SettlementDate, Returns the next coupon date after the


MaturityDate [, Frequency, settlement date of a security.
DayCountBasis])

274 Appendix A: Function Quick Reference


Table A-8. Functions in the Financial Category

Function Syntax Description

CoupNum CoupNum(SettlementDate, Returns the number of coupons payable


MaturityDate [, Frequency, between the settlement date and maturity date.
DayCountBasis]) Data Analyzer rounds the number of coupons to
the nearest whole number.

CoupPCD CoupPCD(SettlementDate, Returns the previous coupon date before the


MaturityDate [, Frequency, settlement date of a security.
DayCountBasis])

CumIPmt CumIPmt(Rate, NumberPeriods, Returns the cumulative interest paid for a loan
PresentValue, StartPeriod, between two specified periods of time. The Rate
EndPeriod, PaymentAtBeginning argument represents the interest rate for each
[, CurrencyDecimals]) period. Calculate NumberPeriods by multiplying
the term of the loan by number of payments per
year.

CumPrinc CumPrinc(Rate, NumberPeriods, Returns the cumulative principal paid on a loan


PresentValue, StartPeriod, between two specified periods of time. The Rate
EndPeriod, PaymentAtBeginning argument represents the interest rate for each
[, CurrencyDecimals]) period. Calculate NumberPeriods by multiplying
the term of the loan by number of payments per
year.

DB DB(Cost, Salvage, Life, Period Returns the depreciation of an asset for a


[, FirstYearMonths, specified period using the fixed-declining
CurrencyDecimals]) 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.

DDB DDB(Cost, Salvage, Life [, Returns the depreciation of an asset for a


Period, RateFactor, specified period using the double-declining
CurrencyDecimals]) 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.

DfToRate DfToRate(DiscountFactor, Returns the rate, given the discount factor. The
RateConvention, ElapsedYears) 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.

Disc Disc(SettlementDate, Returns the discount rate for a security,


MaturityDate, Price, expressed as a decimal number. To convert it to
Redemption [, DayCountBasis]) a percentage, multiply the discount rate by 100.

Financial Functions 275


Table A-8. Functions in the Financial Category

Function Syntax Description

Effect Effect(Rate, NumberPeriods) 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.

FV FV(Rate, NumberPeriods, Returns the future value of an investment, where


Payment [, PresentValue, you make periodic, constant payments and the
PaymentAtBeginning, investment earns a constant interest rate. The
CurrencyDecimals]) 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.

IRR IRR(CashFlows [, Context]) 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.

IntRate IntRate(SettlementDate, Returns the interest rate for a fully-invested


MaturityDate, Investment, security. The interest rate is expressed as a
Redemption [, DayCountBasis]) decimal number. To convert it to a percentage,
multiply the interest rate by 100.

NPV NPV(CashFlows, Rate [, Calculates the net present value of an


CurrencyDecimals, Context]) 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.

NPer NPer(Rate, PresentValue, Returns the number of periods for an investment


Payment [, FutureValue, based on a constant interest rate and periodic,
PaymentAtBeginning]) 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.

276 Appendix A: Function Quick Reference


Table A-8. Functions in the Financial Category

Function Syntax Description

Nominal Nominal(Rate, NumberPeriods) Returns the nominal annual interest rate, given
the effective rate and the number of
compounding periods per year.

PV PV(Rate, NumberPeriods, Returns the present value of an investment. The


Payment [, FutureValue, present value is the lump-sum amount that a
PaymentAtBeginning, series of future payments is worth now. Rate is
CurrencyDecimals]) 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.

PeriodsPerYear PeriodsPerYear([Frequency]) Returns the number of periods per year, given


the frequency of payments. Use this function to
pass the period value to other financial
functions.

Pmt Pmt(Rate, NumberPeriods, Returns the payment for a loan based on


PresentValue [, FutureValue, constant payments and a constant interest rate.
PaymentAtBeginning, The Rate argument is the interest rate for the
CurrencyDecimals]) loan for each period. The PresentValue is the
principal for the loan. The FutureValue is the
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.

Price Price(SettlementDate, Returns the price per $100 face value of a


MaturityDate, Rate, Yield, security that pays periodic interest.
Redemption [, Frequency,
DayCountBasis,
CurrencyDecimals])

PriceDisc PriceDisc(SettlementDate, Returns the price per $100 face value of a


MaturityDate, Discount, discounted security.
Redemption [, DayCountBasis,
CurrencyDecimals])

PriceMat PriceMat(SettlementDate, Returns the price per $100 face value of a


MaturityDate, IssueDate, Rate, security that pays interest at maturity.
Yield [, DayCountBasis,
CurrencyDecimals])

Rate Rate(NumberPeriods, Payment, Returns the interest rate earned per period by a
PresentValue [, FutureValue, security. PresentValue is the lump-sum amount
PaymentAtBeginning, that a series of future payments is worth now.
CurrencyDecimals]) 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 277


Table A-8. Functions in the Financial Category

Function Syntax Description

RateToDf RateToDf(Rate, RateConvention, Returns the discount factor, given the rate. The
ElapsedYears) 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.

Received Received(SettlementDate, Returns the amount received when a fully


MaturityDate, Investment, invested security matures.
Discount [, DayCountBasis,
CurrencyDecimals])

SLn SLn(Cost, Salvage, Life [, Returns the straight-line depreciation of an asset


CurrencyDecimals]) for one period.

SYD SYD(Cost, Salvage, Life, Returns the depreciation of an asset using the
Period [, CurrencyDecimals]) sum-of-years' digits method for a given period.

TBillEq TBillEq(SettlementDate, Returns the bond-equivalent yield for a Treasury


MaturityDate, Discount) bill. The function returns the yield as a decimal
number. To convert the yield to a percentage,
multiply the return value by 100.

TBillPrice TBillPrice(SettlementDate, Returns the price per $100 face value for a
MaturityDate, Discount) Treasury bill.

TBillYield TBillYield(SettlementDate, Returns the yield for a USA Treasury bill. The
MaturityDate, Price) function returns the yield as a decimal number.
To convert the yield to a percentage, multiply the
return value by 100.

VDB VDB(Cost, Salvage, Life, Returns the variable declining balance. The
StartPeriod, EndPeriod [, variable declining balance is the depreciation of
RateFactor, NoSwitch, an asset for a specified period, using the double-
CurrencyDecimals]) declining 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.

XIRR XIRR(CashFlows, Dates [, Returns the internal rate of return for a series of
Context1, Context2]) 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.

278 Appendix A: Function Quick Reference


Table A-8. Functions in the Financial Category

Function Syntax Description

XNPV XNPV(CashFlows, Dates, Rate [, Returns the net present value for a series of
CurrencyDecimals, Context1, cash flows, where the cash flows might not
Context2]) 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.

Yield Yield(SettlementDate, Returns the yield on a security that pays periodic


MaturityDate, Rate, Price, interest. The function returns the yield as a
Redemption [, Frequency, decimal number. To convert the yield to a
DayCountBasis]) percentage, multiply the return value by 100.

YieldDisc YieldDisc(SettlementDate, Returns the annual yield on a discounted


MaturityDate, Price, security. The function returns the annual yield as
Redemption [, DayCountBasis]) a decimal number. To convert the yield to a
percentage, multiply the return value by 100.

YieldMat YieldMat(SettlementDate, Returns the annual yield of a security that pays


MaturityDate, IssueDate, Rate, interest at maturity. The function returns the
Price [, DayCountBasis]) annual yield as a decimal number. To convert
the yield to a percentage, multiply the return
value by 100.

Financial Functions 279


Mathematical Functions
Table A-9 lists the functions in the Mathematical category:

Table A-9. Functions in the Mathematical Category

Function Syntax Description

Add Add(NumericValue1, NumericValue2) Returns the sum of two numeric values.

Divide Divide(NumericValue1, Returns the result of the first numeric value


NumericValue2) divided by the second numeric value.

Factorial Factorial(NumericValue) 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.

IntDivide IntDivide(NumericValue1, Divides one numeric value by another and


NumericValue2) returns the integer part of the quotient (result of
the division).

Log Log(NumericValue) Returns the natural logarithm of a numeric value.


The Log function uses E as the base for the
logarithm calculation.

Log10 Log10(NumericValue) Returns the base 10 logarithm of a numeric


value.

Log2 Log2(NumericValue) Returns the base 2 logarithm of a numeric value.

Max2 Max2(NumericValue1, Returns the maximum of two numeric values.


NumericValue2)

Min2 Min2(NumericValue1, Returns the minimum of two numeric values.


NumericValue2)

Mod Mod(NumericValue1, NumericValue2) Returns the modulus, the remainder of a division


calculation, for any numeric metric or attribute.

Multiply Multiply(NumericValue1, Returns the product of one numeric value


NumericValue2) multiplied by another.

Power Power(NumericValue1, Returns the value of a number raised to an


NumericValue2) exponent. The first argument you pass to the
function is the base value. The second argument
you pass to the function is the exponent.

Sqrt Sqrt(NumericValue) Returns the square root of a given positive


number. The square root of a negative number is
not a value.

Square Square(NumericValue) Returns the square of a given number.

Subtract Subtract(NumericValue1, Returns the result of one numeric value


NumericValue2) subtracted by another.

280 Appendix A: Function Quick Reference


Rounding Functions
Table A-10 lists the functions in the Rounding category:

Table A-10. Functions in the Rounding Category

Function Syntax Description

Ceiling Ceiling(NumericValue [, Returns the value rounded up to the specified number of


Significance]) 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.

Floor Floor(NumericValue [, Returns the value rounded down to the specified number
Significance]) 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.

Round Round(NumericValue [, Returns all values rounded to the specified number of


Significance]) digits.

RoundDown RoundDown(NumericValue [, Returns a value rounded down N number of places to the


Significance]) right of the decimal point. If N is a negative number,
rounds down N places left of the decimal point.

RoundUp RoundUp(NumericValue [, Returns a value rounded up N number of places to the


Significance]) right of the decimal point. If N is a negative number,
rounds up N places left of the decimal point.

Trunc Trunc(NumericValue [, Returns the value truncated to a specific digit.


Significance])

Rounding Functions 281


Running Functions
Table A-11 lists the functions in the Running category:

Table A-11. Functions in the Running Category

Function Syntax Description

MovingAvg MovingAvg(List, Size [, Returns the average (row-by-row) of a


Context]) 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.

MovingSum MovingSum(List, Size [, Returns the cumulative sum (row-by-row) of a


Context]) 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.

PercentContribution PercentContribution(List [, For a set of values, returns each value as the


Context]) 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.

RunningAvg RunningAvg(List [, Context]) 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.

RunningSum RunningSum(List [, Context]) 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.

282 Appendix A: Function Quick Reference


Statistical Functions
Table A-12 lists the functions in the Statistical category:

Table A-12. Functions in the Statistical Category

Function Syntax Description

BinomDist BinomDist(X, Trials, Returns the value for the statistical binomial
ProbabilityOfSuccess, distribution. Binomial distribution is the
Cumulative) probability of observing X number of successes
in a fixed number of independent trials.

BinomInv BinomInv(Probability, Trials, Returns the number (integer) for which the
ProbabilityOfSuccess) 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.

ChiDist ChiDist(X, DegreesOfFreedom) 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 chi-
squared test to compare observed and expected
values.

ChiInv ChiInv(Probability, Returns the inverse of the probability associated


DegreesOfFreedom) 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.

Confidence Confidence(Alpha, StdDev, Size) 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.

ExponDist ExponDist(X, Lambda, Returns the exponential distribution. Exponential


Cumulative) 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.

Statistical Functions 283


Table A-12. Functions in the Statistical Category

Function Syntax Description

FDist FDist(X, DegreesOfFreedomNum, Returns the F probability distribution. The F


DegreesOfFreedomDenom) 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.

FInv FInv(Probability, Returns the inverse of the probability associated


DegreesOfFreedomNum, with a F distribution. The Probability argument
DegreesOfFreedomDenom) passed to the FInv function is the probability
associated with the F distribution. The F
probability distribution is typically used to
develop hypothesis tests.

Fisher Fisher(X) 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.

FisherInv FisherInv(X) Returns the statistical inverse of the Fisher


transformation. Use this function when
determining the relationship between ranges or
arrays of data.

GammaDist GammaDist(X, Alpha, Beta) 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.

GammaInv GammaInv(Probability, Alpha, Returns the inverse of the gamma cumulative


Beta) 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.

GammaLog GammaLog(X) Returns the natural logarithm of the gamma


function.

HypGeomDist HypGeomDist(X, SampleSize, Returns the value of the statistical


Successes, PopulationSize) 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.

284 Appendix A: Function Quick Reference


Table A-12. Functions in the Statistical Category

Function Syntax Description

NormDist NormDist(X, Mean, StdDev, Returns the normal distribution for a number,
Cumulative) 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.

NormInv NormInv(Probability, Mean, Returns the inverse of the normal cumulative


StdDev) distribution, given the mean and standard
deviation. The Probability argument passed to
the NormInv function is the probability associated
with the normal distribution.

NormSDist NormSDist(X) Returns the standard normal cumulative


distribution, where the mean is zero and the
standard deviation is one.

NormSInv NormSInv(Probability) 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.

Percentile Percentile(List, Percentile [, Calculates the value that falls at a given


Context]) 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.

Skew Skew(List [, Context]) 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.

Standardize Standardize(X, Mean, StdDev) Returns the normalized value for a distribution,
given the mean and standard deviation.

Statistical Functions 285


Table A-12. Functions in the Statistical Category

Function Syntax Description

Steyx Steyx(ListY, ListX [, Context, Returns the statistical standard error of linear
Context]) 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.

TDist TDist(X, DegreesOfFreedom [, Returns the probability for the Student t-


Tails]) distribution. 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.

TInv TInv(Probability, Returns the t-value of the Student's t-distribution,


DegreesOfFreedom [, Tails]) given the probability and the degrees of freedom.
The TInv function is the statistical inverse of the
TDist function.

Weibull Weibull(X, Alpha, Beta, Returns the statistical Weibull distribution. Use
Cumulative) 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.

286 Appendix A: Function Quick Reference


String Functions
Table A-13 lists the functions in the String category:

Table A-13. Functions in the String Category

Function Syntax Description

Clean Clean(String) 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.

Concat Concat(String1, String2) 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.

EqualsIgnoreCase EqualsIgnoreCase(String1, Compares two strings and returns TRUE if the


String2) 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.

Find Find(String, Find [, Finds a text string (Find argument) within another
FromEnd]) 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.

Len Len(String) Returns the number of characters in a text string.

Lower Lower(String) Converts uppercase string characters to


lowercase.

NumberString NumberString(X) Converts a number into a string. Use this function


to pass values to other functions that take string
arguments.

Replace Replace(String, Start, Replaces a character string, or a part of a


Count, Replace) 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.

String Functions 287


Table A-13. Functions in the String Category

Function Syntax Description

Rept Rept(String, RepeatCount) 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.

Substitute Substitute(String, Find, Replaces a string of text with a new string of text
Replace [, Instance]) 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.

Substring Substring(String, Start [, Returns a portion of a string. The Substring


Count]) function counts all characters, including blanks,
starting at the beginning of the string.

Trim Trim(String) Removes blanks from the end of a string.

Upper Upper(String) Converts lowercase string characters to


uppercase.

Within Within(Compare1, Compares a given value to all values in a list and


CompareList) 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.

288 Appendix A: Function Quick Reference


Trigonometric Functions
Table A-14 lists the functions in the Trigonometric category:

Table A-14. Functions in the Trigonometric Category

Function Syntax Description

ArcCos ArcCos(NumericValue) 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.

ArcCosh ArcCosh(NumericValue) 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.

ArcCot ArcCot(NumericValue) 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.

ArcCoth ArcCoth(NumericValue) 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.

ArcCsc ArcCsc(NumericValue) 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.

ArcCsch ArcCsch(NumericValue) Returns the inverse hyperbolic cosecant of a numeric value.


The inverse hyperbolic cosecant is the trigonometric inverse of
a hyperbolic cosecant.

ArcSec ArcSec(NumericValue) 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.

ArcSech ArcSech(NumericValue) 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.

ArcSin ArcSin(NumericValue) 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.

ArcSinh ArcSinh(NumericValue) Returns the inverse hyperbolic sine of a numeric value. The
inverse hyperbolic sine is the trigonometric inverse of a
hyperbolic sine.

Trigonometric Functions 289


Table A-14. Functions in the Trigonometric Category

Function Syntax Description

ArcTan ArcTan(NumericValue) 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.

ArcTanh ArcTanh(NumericValue) 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.

Cos Cos(Angle) Returns the cosine of a numeric value.

Cosh Cosh(Angle) Returns the hyperbolic cosine of a numeric value.

Cot Cot(Angle) Returns the cotangent of a numeric value.

Coth Coth(Angle) Returns the hyperbolic cotangent of a numeric value.

Csc Csc(Angle) Returns the cosecant of a numeric value.

Csch Csch(Angle) Returns the hyperbolic cosecant of a numeric value.

Sec Sec(Angle) Returns the secant of a numeric value.

Sech Sech(Angle) Returns the hyperbolic secant of a numeric value.

Sin Sin(Angle) Returns the sine of a numeric value.

Sinh Sinh(Angle) Returns the hyperbolic sine of a numeric value.

Tan Tan(Angle) Returns the tangent of a given angle.

Tanh Tanh(Angle) Returns the hyperbolic tangent of a numeric value.

290 Appendix A: Function Quick Reference


Unary Functions
Table A-15 lists the functions in the Unary category:

Table A-15. Functions in the Unary Category

Function Syntax Description

Abs Abs(NumericValue) Returns the absolute value of a number. Use this function with a
numeric metric, numeric attribute, or a calculated numeric value.

Exp Exp(NumericValue) 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.

Negate Negate(NumericValue) 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.

Plus Plus(NumericValue) 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.

Sign Sign(NumericValue) Returns whether a numeric value is positive, negative, or 0. Use


this function with a numeric metric, numeric attribute, or a
calculated numeric value.

Unary Functions 291


292 Appendix A: Function Quick Reference
Index

A ArcSec function
description 52
ABS function ArcSech function
description 35 description 53
AccrInt function ArcSin function
description 36 description 54
AccrIntM function ArcSinh function
description 38 description 55
ADD function ArcTan function
description 39 description 56
AddToDate function ArcTanh function
description 40 description 57
AmorDegrC function arithmetic operators
description 41 description 15
AmorLinC function using strings in expressions 15
description 43 AveDev function
And function description 58
description 45 Avg function
ArcCos function description 59
description 46, 47
ArcCot function
description 48 B
ArcCoth function
BinomDist function
description 49
description 60
ArcCsc function
BinomInv function
description 50
description 61
ArcCsch function
description 51

293
C CountUnique function
description 78
calculated metrics CoupDayBS function
using functions 4 description 79
calculations CoupDayS function
precision 7 description 80
Ceiling function CoupDaySNC function
description 62 description 81
ChiDist function CoupNCD function
description 64 description 82
ChiInv function CoupNum function
description 65 description 83
ChiTest function CoupPCD function
description 66 description 84
Clean function Covar function
description 68 description 85
comparison operators Csc function
description 15 description 87
using strings in expressions 15 Csch function
Concat function description 88
description 69 CumIPmt function
Confidence function description 89
description 70 CumPrinc function
constants description 91
E 13 currency decimals arguments
expressions 13 using 7
FALSE 13 custom aggregates
PI 13 using functions 4
TRUE 13 using variables in expressions 27
Context argument custom attributes
attributes 24 layout-dependent restrictions 23
equal to operator 24 using functions 5
functions of Running category 29 custom metrics
keywords 26 layout-dependent restrictions 23
null values 11 using functions 3
separators 24
syntax 24
using 22 D
variables 27
date format strings
Correl function
format letters 18
description 71
using in expressions 17
Cos function
using in functions 18
description 73
Date function
Cosh function
description 95
description 74
dates
Cot function
using in expressions 17
description 75
DateString function
Coth function
description 96
description 76
DateValue function
CountAll function
description 97
description 77

294 Index
Day Count Basis argument
using 32
F
Day function Factorial function
description 99 description 117
DB function FALSE constant
description 93 defined 13
DDB function FDist function
description 94 description 114
DevSq function Find function
description 100 description 118
DfToRate function FInv function
description 101 description 115
Disc function Fisher function
description 102 description 119
Divide function FisherInv function
description 103 description 120
Floor function
description 121
E Forecast function
description 123
E constant
functions
defined 13
currency decimals 7
Effect function
in calculated metrics 4
description 104
in custom aggregates 4
ElapsedDays function
in custom attributes 5
description 105
in custom metrics 3
ElapsedHours function
null handling 11
description 107
supported units of measure 34
ElapsedYears function
syntax 12
description 108
using date format strings 18
EndOfMonth function
FV function
description 109
description 116
Equals function
description 110
EqualsIgnoreCase function
description 111
G
Exp function GammaDist function
description 112 description 125
ExponDist function GammaInv function
description 113 description 126
expression syntax GammaLog function
constants 13 description 127
date format strings 17 GeoMean function
dates 17 description 128
functions 12 GreaterThan function
general rules 10 description 129
null values 10 GreaterThanEquals function
operators 14 description 130
supported units of measure 34

Index 295
H Lower function
description 146
HarMean function
description 131
Hour function M
description 132
Max function
HypGeomDist function
description 147
description 133
Max2 function
description 148
I Median function
description 149
If function Min function
description 135 description 150
IfNull function Min2 function
description 136 description 151
IntDivide function Minute function
description 137 description 152
IntRate function Mod function
description 138 description 153
IRR function Mode function
description 134 description 154
Month function
description 155
K MovingAvg function
Kurt function description 156
description 139 MovingSum function
description 158
Multiply function
L description 160

layout context
using 23 N
layout keywords
using in expressions 26 Negate function
layout-dependent description 164
custom attribute restrictions 23 Next function
custom metric restrictions 23 description 165
Len function NextDate function
description 140 description 166
LessThan function Nominal function
description 141 description 167
LessThanEquals function NormDist function
description 142 description 168
Log function NormInv function
description 143 description 169
Log10 function NormSDist function
description 144 description 170
Log2 function NormSInv function
description 145 description 171
logical operators Not function
description 16 description 172

296 Index
NotEquals function PriceDisc function
description 173 description 189
Now function PriceMat function
description 174 description 190
NPer function Product function
description 163 description 192
NPV function PV function
description 161 description 177
null values
Context argument 11
expressions 10 R
NumberString function
Rate function
description 175
description 193
RateToDf function
O description 194
Received function
operators description 195
arithmetic 15 Replace function
comparison operators 15 description 196
expression syntax 14 Rept function
logical operators 16 description 197
using strings in arithmetic 15 Round function
using strings in comparison 15 description 198
Or function RoundDown function
description 176 description 199
RoundUp function
description 200
P running category functions
using Context argument 29
Pearson function
RunningAvg function
description 178
description 201
PercentContribution function
RunningSum function
description 180
description 202
Percentile function
description 181
PeriodsPerYear function
description 182
S
PI constant Sec function
defined 13 description 205
Plus function Sech function
description 183 description 206
Pmt function Second function
description 184 description 207
Power function Sign function
description 185 description 208
precision Sin function
calculations 7 description 209
Previous function Sinh function
description 186 description 210
Price function Skew function
description 187 description 211

Index 297
SLn function Trim function
description 203 description 237
Slope function TriMean function
description 212 description 236
Sqrt function TRUE constant
description 214 defined 13
Square function Trunc function
description 215 description 238
Standardize function TTest function
description 216 description 230
Stdev function
description 217
StdevP function U
description 218
Units function
Steyx function
description 239
description 219
units of measure
Substitute function
supported in expressions 34
description 221
Upper function
Substring function
description 240
description 222
Subtract function
description 223
Sum function
V
description 224 value context
SYD function using 23
description 204 value keywords
syntax using in expressions 26
expressions 10 Var function
description 244, 245
VDB function
T description 241, 243
Tan function
description 232
Tanh function
W
description 233 Weekday function
TBillEq function description 247
description 225 WeekNum function
TBillPrice function description 246
description 226 Weibull function
TBillYield function description 248
description 227 Within function
TDist function description 249
description 228
time attributes
using in Context argument 25 X
Time function XIRR function
description 234 description 251
TInv function XNPV function
description 229 description 253
Today function
description 235

298 Index
Y
Year function
description 255
Yield function
description 256, 257
YieldMat function
description 258

Z
ZTest function
description 259

Index 299
300 Index

You might also like