Math Functions in DIAL
The following calc functions perform mathematical operations in DIAL.
Returns the absolute value of the specified numeric expression.
For example:
calc.abs(-25); returns 25
calc.abs(0); returns 0
calc.abs(Actual Dollars); where Actual Dollars contains -5, returns 5
calc.abs(-0.87); returns 0.87
Standard trigonometric Arc Cosine function. Returns the angle for the specified value.
For example:
calc.arccos(0.55); returns 0.988432
Standard trigonometric Arc Sine function. Returns the angle for the specified value.
For example:
calc.arcsin(0.55); returns 0.582364
Standard trigonometric Arc Tangent function. Returns the angle for the specified value.
For example:
calc.arctan(0.55); returns 0.502843
Standard trigonometric Cosine function. Returns the value for the specified angle.
For example:
calc.cos(100); returns 0.862319
calc.cos(1000); returns 0.562379
Returns an exponential value (raises x to the y power).
For example:
calc.exp(2,6); returns 64
calc.exp(.5,2); returns .25
calc.exp(-3,4); returns 81
calc.exp(-11,5); returns -161051
Returns a formatted number. See Calc Format Number in DIAL.
If a value is the result of a mathematical error or a blank ELSE clause in a calculation, the function of that value returns a "1"; otherwise it returns a "0".
Returns "1" if value is null or blank, otherwise it returns a "0".
Returns a natural logarithm value.
For example:
calc.ln(64); returns 4.158883
calc.ln(1000); returns 6.907755
calc.ln(0.25); returns -1.386294
calc.ln(-64); returns null value
calc.ln(1); returns 0
calc.ln(0); returns null value
Returns a log base 10 value.
For example:
calc.log10(64); returns 1.80618
calc.log10(1000); returns 3
calc.log10(0.25); returns -0.60206
calc.log10(-64); returns null value
calc.log10(1); returns 0
calc.log10(0); returns null value
calc.log10(10); returns 1
Returns the distance, in miles, between two latitude-longitude pairs. Latitude and longitude are specified using either of the following decimal degree formats:
calc.miles(lat1,long1,lat2,long2)
calc.miles(lat1-long1,lat2-long2)
This function makes determining the distance between two points on the Earth, specified by latitude and longitude, a one-step process instead of using multiple trigonometric functions to do the same calculation.
For example:
City A is at latitude N and longitude W, in decimal degrees: 42.37 , 71.03 . (Divide minutes by 60 to get decimal degrees.) City B is at latitude N and longitude W, in decimal degrees: 42.27, 71.87 . The distance between city A and city B can be determined with the following function:
calc.miles(42.37, 71.03, 42.27, 71.87); returns 43.48 miles
Strips off the decimal parts of the arguments and returns the remainder when dividing a number by a divisor. Returns zero if the number divides evenly. For example, calc.mod(10,3) returns 1 because 10/3=3 with a remainder of 1.
For example:
calc.mod(100,3); returns 1 (100/3=33, remainder 1)
calc.mod(120,5); returns 0 (120/5=24, no remainder)
calc.mod(25,6); returns 1 (25/6=4, remainder 1)
calc.mod(36.01,12); returns 0.01 (36.01/12=3 no remainder .01)
calc.mod(28.55,3); returns 1.55 (28.55/3=9 remainder 1.55)
calc.mod(11.90,6); returns 5.9 (11.90/6=1 remainder 5.9)
calc.mod(6.6,6); returns 0.6 (6.6/6=1 no remainder.6)
Returns the percent variation between two values.
For example:
calc.pct_var(Total[Revenue,Month="Q1"],Total[Revenue,Month="Q2"])
Standard trigonometric Sine function. Returns the value for the specified sine angle.
For example:
calc.sin(100); returns -0.506366
Standard trigonometric Tangent function. Returns the value for the specified angle.
For example:
calc.tan(100); returns -0.587214
Returns the value as an integer, ignoring any non-integer component of the number. Positive numbers are rounded down and negative numbers are rounded up.
For example:
calc.trunc(23.3); returns 23
calc.trunc(-1.5); returns -1
calc.trunc(Actual Dollars); where Actual Dollars contains 5.25, returns 5