General Mathematics

Function/Property

Example

Description

+

#A# + #B#

Addition

-

#A# - #B#

Subtraction

/

#A# / #B#

Division

*

#A# * #B#

Multiplication

 %

#A# % #B#

A modulo B

Write the constant with decimal places --> 7.0 if an operation is supposed to yield a number with decimal places and you are working with constants.

Example:

The result is defined as a number with decimal places

Case 1: 10 / 3 results in 3.0

Case 2: 10 / 3.0 results in 3.33

Built-In C# Functions of System.Math

Function

Return Value

Result

System.Math.Abs(d)

Number with decimal places

Number without algebraic sign (absolute value of d)

System.Math.Floor(d)

Integer

Yields the largest integer equal to or less than the input value (d).

System.Math.Ceiling(d)

Integer

Yields the smallest integer equal to or greater than the input value (d).

System.Math.Round(a,n)

Number with decimal places

Rounds a double-precision floating-point value (a) to a specified number (n) of fractional digits. 

See also MSDN

Please note: to round half away from zero (e.g., round 23.5 to 24, and 23.4 to 23) use

System.Math.Round((double)#C#, System.MidpointRounding.AwayFromZero)
System.Math.IEEERemainder(a,n)

Remainder of a division

Divides a by n and returns the remainder

System.Math.Log(a)

Number with decimal places

Yields the logarithm of a

System.Math.Log10(a)

Number with decimal places

Yields the base 10 logarithm of a

System.Math.Log(a,b)

Number with decimal places

Yields the base b logarithm of a

System.Math.Max(a,b)

Number with decimal places

Yields the maximum of a and b

System.Math.Min(a,b)

Number with decimal places

Yields the minimum of a and b

System.Math.Pow(x,y)

Number with decimal places

Calculates the exponentiation of base x and exponent y (xy)

System.Math.Sqrt(d)

Number with decimal places

Calculates the square root of d

System.Math.Sign(d)

Number with decimal places

Yields the algebraic sign of d

System.Math.Sin(d)

Number with decimal places

Sinus of d

System.Math.Cos(d)

Number with decimal places

Cosinus of d

System.Math.Truncate(d)

Number with decimal places

Yields the integral portion of d

Additionally, Sin, Cos, Tan, Sing, Cosh, Tanh, Asin, Acos, Atan, PI and E are available, see also MSDN

More Examples

Question

Code

Number of values in pivot

7 times single field in e.g.

"N Mo" with #Mo# > 0 ? 1:0 

and then field for total with

#N MON# + #N TUE# + #N WED# + #N THU# + #N FRI# + #N SAT# + #N SUN#

Calculate sum in pivot table

#MON# + #TUE# + #WED# + #THU# + #FRI# + #SAT# + #SUN# ...