• No results found

D ATE V ALUE

In document DA_FunctionReference (Page 125-133)

D ATE V ALUE

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

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

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.

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

Day 99

D AY

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)

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.

Argument Datatype Description

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

D EV S Q

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

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.

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.

DfToRate 101

D F T O R ATE

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)

Return Value

Numeric

Examples

The following expression returns 0.055 as the rate:

DfToRate(0.3, "annual", 5)

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.

D ISC

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

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.

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.

Divide 103

D IVIDE

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)

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

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.

E FFECT

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)

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.

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.

In document DA_FunctionReference (Page 125-133)

Related documents