# Calculated columns

**Calculated Column** formulas can be used to perform a wide range of operations on data, from simple arithmetic to complex logical and statistical computations. Whether you're rounding numbers, extracting portions of dates, calculating averages, or transforming texts, these formulas provide the versatility to generate the data you need.

Here are some typical use cases for **Calculated Column** functions:

1. **Data Cleaning and Transformation**: Effortlessly clean and reformat data, such as trimming whitespace, changing text casing, or converting date formats.
2. **Statistical Analysis**: Perform statistical calculations like averages, variances, or standard deviations to derive insights from numerical data sets.
3. **Logical Operations**: Apply logical tests to data to create flags, indicators, or to filter and categorize data based on specific criteria.
4. **Mathematical Operations**: Execute a variety of mathematical operations, enabling complex calculations like financial modelling or engineering calculations.
5. **Text and Date Manipulation**: Extract or transform portions of text and date fields, which is particularly useful in data preparation for reporting or further analysis.

Note that when a calculated column is applied to generated data, it is processed last. This ensures that all generated data and applied mockers are considered before the calculation occurs, preserving the intended transformations and logic.

## Syntax

**Calculated Columns** are composed of a library of functions and operators used to build formulas and expressions in Syntho. When creating **calculated columns** in Syntho, you must follow specific syntax rules and best practices. Here are the fundamental syntax rules for **Calculated Column** expressions when creating **calculated columns**:

### **Formula Structure**

Formulas are expressions made from:

* **Functions** like `ROUND(...)` or `DATEADD(...)`
* **Column references** like `[AMOUNT]`
* **Constants** like `2`, `"US"`, or `DATE(2024, 12, 31)`
* **Operators** like `+`, `-`, `*`, `/`, `=`, `<>`
* **Mockers** like `MOCK_FIRST_NAME` or `MOCK_FREE_EMAIL_DOMAIN`

### **Column references**

When referring to a column within the same table, you can just use the column name in square brackets: `[ColumnName]`. Only references to columns within the same tables are supported.

### **Functions**

**Calculated Column** includes a wide range of functions that can be used in your expressions, such as time intelligence functions (`DATE`, `DATEADD`), logical functions (`IF`, `AND`, `OR`), and many more. Functions follow the syntax of `FUNCTION_NAME(arguments)`.

### **Mock generators**

If you would like to add a mocker to a calculated column formula, type "`MOCK_`" and you will see the names of mockers in the dropdown list. Either choose from the list or add the name of the mocker to the end of "`MOCK_`", with whitespaces replaced by underscores. Therefore, mockers like "**First name female**" and "**Company Email**" should be entered as "`MOCK_FIRST_NAME_FEMALE`" and "`MOCK_COMPANY_EMAIL`," respectively. A complete list of mockers can be found in the [Mockers ](https://docs.syntho.ai/configure-a-data-generation-job/configure-column-settings/mockers)section.

When you add a mock generator inside a Calculated Column formula, the settings for that mock generator can be configured in the right-hand screen.

Each mock generator you insert into a formula is automatically given a unique identifier by appending an underscore followed by a number (e.g., `MOCK_FIRST_NAME_1`). This identifier allows you to **reuse** the same mock generator value multiple times within the same formula by referring to it via the assigned identifier.

<figure><img src="https://content.gitbook.com/content/U61B9DqtWCNO3Z30vnjh/blobs/ruf8kayOZedaOJmAD9eR/image.png" alt=""><figcaption></figcaption></figure>

### **Operators**

**Calculated Column** supports various operators for arithmetic calculations (`+`, `-`, `*`, `/`), and comparison (`<`, `>`, `<=`, `>=`, `=`, `<>`) operations.

### **Constants**

You can use constants like numbers (`123`), strings (`"text"`), and dates (`DATE(2020, 12, 31)`).

### **Whitespace and Line Breaks**

Whitespace and line breaks do not affect the interpretation of the formula but can make your formulas easier to read.

### Comments

Certain sections in a formula can be commented out by encapsulating them with `(*` and `*)`. These sections will be ignored when processing the formula. This can be useful when you want to add comments to a formula or when are creating larger complex formulas, for which you want to evaluate that certain sections result in the expected output. If you select a formula section and press `CTRL` + `/` the selected section will be commented out.

### Examples

#### 1) `ROUND` — round numbers to a fixed number of digits

Use `ROUND` when you need consistent decimal precision (for example, currency).

```dax
ROUND(
  [AMOUNT],
  2
)
```

* `number` (number | numeric column): value to round. Example: `[AMOUNT]`.
* `count` (integer): number of digits to keep.
  * `2` keeps two decimals.
  * `0` rounds to whole numbers.
  * `-1` rounds to tens, `-2` to hundreds, etc.

#### 2) `IF` — return one value when a condition is true, else another

Use `IF` to map rows into labels based on a boolean test.

```dax
IF(
  [COUNTRY] = "US",
  "domestic",
  "international"
)
```

* `test` (boolean expression): must evaluate to `TRUE` or `FALSE`. Example: `[COUNTRY] = "US"`.
* `then_value` (any type): returned when `test` is `TRUE`. Example: `"domestic"`.
* `otherwise_value` (any type, optional): returned when `test` is `FALSE`. Example: `"international"`. If omitted, `IF` returns `FALSE`.

#### 3) `DATEADD` — shift a date forward or backward

Use `DATEADD` to create derived dates like “due date” or “follow-up date”.

```dax
DATEADD(
  [ORDER_DATE],
  14,
  "day"
)
```

* `dates` (date/datetime column): base date to shift. Example: `[ORDER_DATE]`.
* `number_of_intervals` (integer): how many units to add or subtract. Example: `14`. Use negative values to subtract.
* `interval` (string): unit for the shift. Use `"year"`, `"quarter"`, `"month"`, or `"day"`.

#### 4) Invoice total (combined) — tax + discount with null-safe inputs

Compute an invoice total that still works when tax rate or discount is missing.

```dax
ROUND(
  ([AMOUNT] * (
    1 + IFNULL(
      [TAX_RATE],
      0
    )
  ))
    - IFNULL(
      [DISCOUNT],
      0
    ),
  2
)
```

* `IFNULL([TAX_RATE], 0)` falls back to `0` when `[TAX_RATE]` is `NULL`.
* `IFNULL([DISCOUNT], 0)` falls back to `0` when `[DISCOUNT]` is `NULL`.
* `ROUND(..., 2)` rounds to 2 decimals for currency-like output.

#### 5) Normalized email (combined) — conditional separators + normalization + generated domain

Build a stable email-like value from name columns, even with missing parts.

```dax
SUBSTITUTE(
  CONCATENATE(
    LOWER(
      TRIM(
        IFNULL(
          [FIRSTNAME],
          ""
        )
      )
    ),
    IF(
      ISNULL([LASTNAME]),
      "",
      "."
    ),
    LOWER(
      TRIM(
        IFNULL(
          [LASTNAME],
          ""
        )
      )
    ),
    "@",
    MOCK_FREE_EMAIL_DOMAIN
  ),
  " ",
  ""
)
```

* `IFNULL(..., "")` prevents `NULL` from nulling the entire result.
* `IF(ISNULL([LASTNAME]), "", ".")` only inserts `.` when a last name exists.
* `TRIM(...)` removes leading and trailing whitespace.
* `LOWER(...)` standardizes casing.
* `SUBSTITUTE(..., " ", "")` removes remaining spaces (for double names).

{% hint style="info" %}
If you want **one generated value reused multiple times** inside a single formula, insert a mocker once and reuse the auto-suffixed name (for example: `MOCK_FREE_EMAIL_DOMAIN_1`).
{% endhint %}

Examples use existing columns and mockers. Results depend on each input row.

<figure><img src="https://content.gitbook.com/content/U61B9DqtWCNO3Z30vnjh/blobs/y6bLImwuZfmxbtI55fhm/image.png" alt="" width="353"><figcaption><p>Using calculated column feature</p></figcaption></figure>

### Limitations & considerations

* Column names that begin with an underscore (e.g., `_MyColumn`) will cause “Invalid formula” errors. Rename any columns that start with an underscore so that they begin with a letter or digit instead.
* You can only reference columns within the same table as the calculated column formula. Referencing columns in other tables is not supported.

## Supported data types

| Generator          | Supported data types                    |
| ------------------ | --------------------------------------- |
| Calculated Columns | Categorical, Discrete, Continuous, Date |

## Supported calculated column functions

## ABS

Returns the absolute value of a number.

### Syntax

```dax
ABS(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>Any number, column or mock value.</td></tr></tbody></table>

### Return value

An absolute value of the number.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ABS(
  [HEALTHCARE_COVERAGE]
)
</code></pre></td><td>Returns the absolute value of the <code>[HEALTHCARE_COVERAGE]</code> column for each row.</td><td>Varies by row (e.g., <code>[HEALTHCARE_COVERAGE]=-20</code> → <code>20</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ABS(
  -5
)
</code></pre></td><td>Returns the absolute value of a literal number.</td><td><code>5</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ABS(
  MOCK_RANDOM_DIGIT
)
</code></pre></td><td>Returns the absolute value of a generated random digit.</td><td>Varies by row (e.g., <code>MOCK_RANDOM_DIGIT=7</code> → <code>7</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ABS(
  [HEALTHCARE_COVERAGE] - [HEALTHCARE_EXPENSES]
)
</code></pre></td><td>Returns the absolute difference between <code>[HEALTHCARE_COVERAGE]</code> and <code>[HEALTHCARE_EXPENSES]</code> for each row.</td><td>Varies by row (e.g., <code>[HEALTHCARE_COVERAGE]=250</code> and <code>[HEALTHCARE_EXPENSES]=100</code> → <code>150</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ABS([HEALTHCARE_COVERAGE] - [HEALTHCARE_EXPENSES]) > 100,
  "outlier",
  "ok"
)
</code></pre></td><td>Flags rows where the absolute difference between coverage and expenses exceeds <code>100</code>.</td><td>Either <code>"outlier"</code> or <code>"ok"</code> per row.</td></tr></tbody></table>

## AND

The `AND` function returns `TRUE` if all provided arguments evaluate to `TRUE`, and `FALSE` if any argument evaluates to `FALSE`.

A common use case for the `AND` function is enhancing other functions that perform logical tests. For instance, the `IF` function tests a condition and returns one value if the condition is `TRUE` and another value if it is `FALSE`. By using `AND` as the `logical_test` argument in the `IF` function, you can test multiple conditions simultaneously rather than just one.

### Syntax

```dax
AND(
  Logicalvalue1,
  Logicalvalue2,
  ...Logicalvalue30
)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Logicalvalue1</td><td>The first condition to evaluate, which must result in either <code>TRUE</code> or <code>FALSE</code>.</td></tr><tr><td>Logicalvalue2</td><td>Additional conditions to evaluate, up to a maximum of 30, each of which must result in either <code>TRUE</code> or <code>FALSE</code>.</td></tr></tbody></table>

### Return value

Returns TRUE if all arguments are TRUE.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">AND(
  [GENDER] = "M",
  [HEALTHCARE_COVERAGE] > 100
)
</code></pre></td><td>Checks if gender is male <strong>and</strong> healthcare coverage exceeds <code>100</code>.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">AND(
  [STATE] = "Massachusetts",
  [HEALTHCARE_COVERAGE] > 100,
  [HEALTHCARE_EXPENSES] &#x3C; 500
)
</code></pre></td><td>Checks three conditions at once: state, minimum coverage, and maximum expenses.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  AND(
    [AGE] >= 18,
    [AGE] &#x3C; 65
  ),
  "adult",
  "senior_or_minor"
)
</code></pre></td><td>Classifies rows as <code>"adult"</code> when age is between 18 and 64 inclusive.</td><td>Either <code>"adult"</code> or <code>"senior_or_minor"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">AND(
  NOT([IS_ACTIVE] = 0),
  [STATUS] &#x3C;> "Deleted"
)
</code></pre></td><td>Checks that a row is active and not marked as deleted.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  AND(
    ISNULL([ZIP]),
    [COUNTRY] = "US"
  ),
  "missing_us_zip",
  "ok"
)
</code></pre></td><td>Flags US rows with a missing ZIP code.</td><td>Either <code>"missing_us_zip"</code> or <code>"ok"</code> per row.</td></tr></tbody></table>

## BASE

Converts a number into its text representation in the specified radix (base).

### Syntax

```dataweave
BASE(number, Radix, MinimumLength)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The number, column or mock value to be converted. It must be an integer greater than or equal to 0 and less than 2^53.</td></tr><tr><td>radix</td><td>The base (radix) to convert the number into. It must be an integer between 2 and 36, inclusive.</td></tr><tr><td>MinimumLength</td><td>The minimum length of the returned string. It must be an integer greater than or equal to 0.</td></tr></tbody></table>

### Return value

Converts a positive integer to a specified base into a text from the numbering system.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  5,
  2
)
</code></pre></td><td>Converts the decimal number <code>5</code> to base <code>2</code> (binary).</td><td><code>101</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  5,
  2,
  8
)
</code></pre></td><td>Converts <code>5</code> to base <code>2</code> and left-pads with zeros to length <code>8</code>.</td><td><code>00000101</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  42,
  16
)
</code></pre></td><td>Converts the decimal number <code>42</code> to base <code>16</code> (hexadecimal).</td><td><code>2A</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  [NUMBER],
  [RADIX]
)
</code></pre></td><td>Converts the <code>[NUMBER]</code> column to the base specified in <code>[RADIX]</code> for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  RANDBETWEEN(0, 9),
  RANDBETWEEN(2, 36)
)
</code></pre></td><td>Converts a random digit using a random radix. Radix must be between <code>2</code> and <code>36</code>.</td><td>Varies by row (or errors if radix is out of range).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">BASE(
  [NUMBER],
  36,
  6
)
</code></pre></td><td>Converts <code>[NUMBER]</code> to base <code>36</code> and pads the output to length <code>6</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  "acct_",
  UPPER(
    BASE(
      [ACCOUNT_ID],
      16,
      8
    )
  )
)
</code></pre></td><td>Builds an account-like identifier by converting <code>[ACCOUNT_ID]</code> to padded hex and prefixing with <code>acct_</code>.</td><td>Varies by row.</td></tr></tbody></table>

## CEILING

Rounds a number up, away from zero, to the nearest multiple of a specified significance. The function always rounds a value up, away from zero, regardless of the sign of the number. If the number is an exact multiple of the significance, no rounding is performed. If both the number and significance are negative, the value is rounded down, away from zero. If the number is negative and the significance is positive, the value is rounded up toward zero.

### Syntax

```dax
CEILING(number, Significance)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The column, number or mock value to be rounded.</td></tr><tr><td>significance</td><td>The multiple to which you want to round the number.</td></tr></tbody></table>

### Return value

A number rounded up to the nearest multiple of Significance.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  3.1,
  1
)
</code></pre></td><td>Rounds <code>3.1</code> up to the nearest multiple of <code>1</code>.</td><td><code>4</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  -4.5,
  -2
)
</code></pre></td><td>Rounds <code>-4.5</code> to the nearest multiple of <code>-2</code>, away from zero.</td><td><code>-6</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  -2.5,
  2
)
</code></pre></td><td>Rounds <code>-2.5</code> to the nearest multiple of <code>2</code>, toward zero.</td><td><code>-2</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  5.5,
  0.1
)
</code></pre></td><td>Rounds <code>5.5</code> up to the nearest multiple of <code>0.1</code>.</td><td><code>5.5</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  0.9345,
  0.001
)
</code></pre></td><td>Rounds <code>0.9345</code> up to the nearest multiple of <code>0.001</code>.</td><td><code>0.935</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CEILING(
  ABS([AMOUNT]),
  0.05
)
</code></pre></td><td>Rounds the absolute amount up to the nearest <code>0.05</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  [AMOUNT] &#x3C; 0,
  -CEILING(
    ABS([AMOUNT]),
    1
  ),
  CEILING(
    [AMOUNT],
    1
  )
)
</code></pre></td><td>Rounds amounts to whole numbers while keeping the original sign.</td><td>Varies by row.</td></tr></tbody></table>

## CLEAN

Removes all nonprintable characters from a given text. The `CLEAN` function is useful for cleaning text imported from other applications that may contain characters not supported by your operating system. For example, it can remove low-level computer code that often appears at the beginning or end of data files and cannot be printed.

{% hint style="info" %}
**Important**

The `CLEAN` function is designed to remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31). However, in the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157) that the `CLEAN` function does not remove.
{% endhint %}

### Syntax

```dart
CLEAN(text)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>text</td><td>The text, column or mock values from which you want to remove nonprintable characters.</td></tr></tbody></table>

### Return value

The text that has been "cleaned" of line breaks and other non-printable characters.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">CLEAN(
  CHAR(3)
    &#x26; "Patient Medications"
    &#x26; CHAR(17)
)
</code></pre></td><td>Removes non-printable characters from the string, leaving only readable text.</td><td><code>"Patient Medications"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CLEAN(
  CHAR(3)
    &#x26; [description]
    &#x26; CHAR(17)
)
</code></pre></td><td>Cleans non-printable characters around the <code>[description]</code> column value.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CLEAN(
  CHAR(3)
    &#x26; MOCK_FIRST_NAME
    &#x26; CHAR(17)
)
</code></pre></td><td>Cleans non-printable characters around a generated first name.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CLEAN(
  TRIM([DESCRIPTION])
)
</code></pre></td><td>Trims whitespace and removes non-printable characters from <code>[DESCRIPTION]</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CLEAN(
  CONCATENATE(
    MOCK_FIRST_NAME,
    " ",
    MOCK_LAST_NAME
  )
)
</code></pre></td><td>Joins a generated first and last name and removes any non-printable characters.</td><td>Varies by row.</td></tr></tbody></table>

## CONCATENATE

The `CONCATENATE` function joins two or more text strings into a single string.

### Syntax

```dax
CONCATENATE("Text1", ..., "Text30")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>text1</td><td>The first item to join. This can be a text, column or mock values.</td></tr><tr><td>text2, ...text30</td><td>Additional text items to join. You can include up to 30 items, with a total character limit of 8,192.</td></tr></tbody></table>

### Return value

Several text strings combined into one string.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  [STATE],
  ", ",
  [COUNTY]
)
</code></pre></td><td>Joins state and county into a single string per row.</td><td>Varies by row (e.g., <code>"Massachusetts, Bristol County"</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  MOCK_FIRST_NAME_FEMALE,
  " ",
  MOCK_LAST_NAME_FEMALE
)
</code></pre></td><td>Builds a full name using mock generators.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  "Brittany",
  " ",
  "Jenkins"
)
</code></pre></td><td>Joins literal strings into a full name.</td><td><code>"Brittany Jenkins"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  UPPER([STATE]),
  "-",
  [COUNTY]
)
</code></pre></td><td>Uppercases the state and joins it with the county, separated by <code>-</code>.</td><td>Varies by row (e.g., <code>"MASSACHUSETTS-Bristol County"</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(
  LOWER(
    TRIM([FIRSTNAME])
  ),
  ".",
  LOWER(
    TRIM([LASTNAME])
  ),
  "@",
  MOCK_FREE_EMAIL_DOMAIN
)
</code></pre></td><td>Builds a lowercase email-like string from name columns plus a generated domain.</td><td>Varies by row.</td></tr></tbody></table>

## DATE

The `DATE` function creates a date value by combining individual year, month, and day components. This function is useful for combining separate year, month, and day values into a single date.

### Syntax

```dax
DATE(year, month, day)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>year</td><td>A number, column or mock value representing the year.</td></tr><tr><td>month</td><td>A number, column or mock value column representing the month of the year.</td></tr><tr><td>day</td><td>A number, column or mock value column representing the day of the month.</td></tr></tbody></table>

### Return value

The specified date as the number of full days since nullDate.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following examples build date values from literal values, columns, and other functions.

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">DATE(
  2012,
  8,
  24
)
</code></pre></td><td>Creates the date for August 24, 2012.</td><td><code>2012-08-24</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATE(
  "2012",
  "8",
  "24"
)
</code></pre></td><td>Creates the same date, but from string inputs.</td><td><code>2012-08-24</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATE(
  [year],
  [month],
  [day]
)
</code></pre></td><td>Creates a date per row from the <code>[year]</code>, <code>[month]</code>, and <code>[day]</code> columns.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATE(
  YEAR(TODAY()) - 18,
  1,
  1
)
</code></pre></td><td>Creates January 1st of “current year - 18”.</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATE(
  [YEAR],
  MONTH(TODAY()),
  1
)
</code></pre></td><td>Creates the first day of the current month, using <code>[YEAR]</code> per row.</td><td>Varies by row and run date.</td></tr></tbody></table>

## DATEADD

Returns a column of dates, shifted forward or backward by the specified number of intervals.

### Syntax

```dax
DATEADD(dates, number_of_intervals, interval)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>dates</td><td>A column or mocker that contains dates.</td></tr><tr><td>number_of_intervals</td><td>An integer specifying the number of intervals to add or subtract from the dates.</td></tr><tr><td>interval</td><td>The interval used to shift the dates. Options include: <code>year</code>, <code>quarter</code>, <code>month</code>, or <code>day</code>.</td></tr></tbody></table>

### Return value

A column of date values.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  [Birthdate],
  20,
  "year"
)
</code></pre></td><td>Shifts <code>[Birthdate]</code> 20 years forward.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  [Birthdate],
  -6,
  "month"
)
</code></pre></td><td>Shifts <code>[Birthdate]</code> 6 months backward.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  [OrderDate],
  14,
  "day"
)
</code></pre></td><td>Shifts <code>[OrderDate]</code> 14 days forward.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  DATEVALUE([ORDER_DATE_TEXT]),
  7,
  "day"
)
</code></pre></td><td>Parses a text date first, then shifts it 7 days forward.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  [BIRTHDATE],
  IF(
    [IS_LEAP_YEAR] = 1,
    1,
    0
  ),
  "year"
)
</code></pre></td><td>Shifts <code>[BIRTHDATE]</code> by 0 or 1 year depending on <code>[IS_LEAP_YEAR]</code>.</td><td>Varies by row.</td></tr></tbody></table>

## DATEVALUE

#### Description

The `DATEVALUE` function converts a date stored as text into a date. Note that the results of the `DATEVALUE` function may vary depending on your computer's system date settings. The `DATEVALUE` function is useful when you have dates in a text format that you want to filter, sort, format as dates, or use in date calculations.

### Syntax

```dax
DATEVALUE(date_text)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date_text</td><td>A text column, string or mock representing a date.</td></tr></tbody></table>

### Return value

A date that is converted from text to a date in datetime format.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">DATEVALUE(
  [BIRTHDATE]
)
</code></pre></td><td>Converts <code>[BIRTHDATE]</code> stored as text into a date per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEVALUE("6/24/2012")
</code></pre></td><td>Converts a literal date string into a date value (system locale dependent).</td><td>A date value.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEVALUE("2012/6/24")
</code></pre></td><td>Converts a literal date string into a date value (system locale dependent).</td><td>A date value.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEVALUE("24-JUNE-2024")
</code></pre></td><td>Converts a literal date string into a date value.</td><td><code>2024-06-24</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">YEAR(
  DATEVALUE([BIRTHDATE_TEXT])
)
</code></pre></td><td>Extracts the year after converting a text date column.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(
  DATEVALUE([START_DATE_TEXT]),
  30,
  "day"
)
</code></pre></td><td>Converts <code>[START_DATE_TEXT]</code> to a date, then shifts it 30 days forward.</td><td>Varies by row.</td></tr></tbody></table>

## DAY

The `DAY` function returns the day of a date represented by a serial number, with the day provided as an integer ranging from 1 to 31.

### Syntax

```dax
DAY(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th width="535">Description</th></tr></thead><tbody><tr><td>number</td><td>The date, column or mock date for which you want to find the day. Dates should be entered using the <code>DATE</code> function or as results from other formulas or functions.</td></tr></tbody></table>

### Return value

The day of the given date value.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">DAY("24/6/2012")
</code></pre></td><td>Returns the day-of-month from a literal date string.</td><td><code>24</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DAY([BIRTHDATE])
</code></pre></td><td>Returns the day-of-month for <code>[BIRTHDATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DAY(DATE(2012, 8, 24))
</code></pre></td><td>Returns the day-of-month for a constructed date.</td><td><code>24</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DAY(
  DATEADD(
    [BIRTHDATE],
    1,
    "year"
  )
)
</code></pre></td><td>Returns the day-of-month after shifting <code>[BIRTHDATE]</code> 1 year forward.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  DAY([INVOICE_DATE]) = 1,
  "month_start",
  "other_day"
)
</code></pre></td><td>Flags whether <code>[INVOICE_DATE]</code> falls on the first day of a month.</td><td>Either <code>"month_start"</code> or <code>"other_day"</code> per row.</td></tr></tbody></table>

## DAYS

The `DAYS` function calculates the number of days between two dates.

### Syntax

```dataweave
DAYS(date1, date2)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date1</td><td>The later of the two dates column between which you want to calculate the number of days.</td></tr><tr><td>date2</td><td>The earlier of the two dates column between which you want to calculate the number of days.</td></tr></tbody></table>

### Return value

The difference between two date values.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">DAYS(
  "24/6/2012",
  "14/6/2012"
)
</code></pre></td><td>Returns the number of days between two literal dates.</td><td><code>10</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">DAYS(
  [END_DATE],
  [START_DATE]
)
</code></pre></td><td>Returns days between two date columns per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">DAYS(
  DATE(2024, 12, 31),
  DATE(2024, 1, 1)
)
</code></pre></td><td>Returns the days between Jan 1 and Dec 31, 2024.</td><td><code>365</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ABS(
  DAYS([END_DATE], [START_DATE])
)
</code></pre></td><td>Returns the absolute number of days between two date columns.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  DAYS([END_DATE], [START_DATE]) &#x3C;= 30,
  "short_stay",
  "long_stay"
)
</code></pre></td><td>Classifies stays as short (≤ 30 days) or long.</td><td>Either <code>"short_stay"</code> or <code>"long_stay"</code> per row.</td></tr></tbody></table>

## DATEDIFF

The `DateDiff` function returns the number of interval units between two dates.

### Syntax

```dax
DATEDIFF(date1, date2, interval)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date1, date2</td><td>An integer specifying the number of intervals to add or subtract from the dates.</td></tr><tr><td>interval</td><td><p>A string expression that specifies the time interval you want to use to calculate the difference between <code>date1</code> and <code>date2</code>.</p><p>The value can be one of the following:</p><ul><li>"second"</li><li>"minute"</li><li>"hour"</li><li>"day"</li><li>"week"</li><li>"month"</li><li>"quarter"</li><li>"year"</li></ul></td></tr></tbody></table>

### Return value

The number of units between two dates as defined in the interval.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">DATEDIFF(
  [EXPIRY_DATE],
  [INITIAL_DATE],
  "day"
)
</code></pre></td><td>Returns the number of days between <code>[EXPIRY_DATE]</code> and <code>[INITIAL_DATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEDIFF(
  [BIRTHDATE],
  TODAY(),
  "year"
)
</code></pre></td><td>Returns the age in years, based on <code>[BIRTHDATE]</code>.</td><td>Varies by row and run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEDIFF(
  DATE(2024, 1, 1),
  DATE(2024, 2, 1),
  "month"
)
</code></pre></td><td>Returns the number of months between Jan 1 and Feb 1, 2024.</td><td><code>1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEDIFF(
  DATEVALUE([START_DATE_TEXT]),
  DATEVALUE([END_DATE_TEXT]),
  "day"
)
</code></pre></td><td>Parses two text dates first, then returns the days between them.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  DATEDIFF([SIGNUP_DATE], TODAY(), "day") &#x3C;= 30,
  "new",
  "existing"
)
</code></pre></td><td>Classifies customers as <code>"new"</code> if they signed up in the last 30 days.</td><td>Either <code>"new"</code> or <code>"existing"</code> per row.</td></tr></tbody></table>

## DELTA

The `DELTA` function checks whether two values are equal. It returns `1` if `number1` equals `number2`, and `0` otherwise.

### Syntax

```dataweave
DELTA(number_1, number_2)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number_1</td><td>The first number, column or mocker.</td></tr><tr><td>number_2</td><td>The second number, column or mocker. If omitted, <code>column2</code> is assumed to be zero.</td></tr></tbody></table>

### Return value

Returns TRUE (1) if both numbers are equal, otherwise returns FALSE (0).

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">DELTA(
  [HEALTHCARE_COVERAGE],
  [HEALTHCARE_EXPENSES]
)
</code></pre></td><td>Returns <code>1</code> when <code>[HEALTHCARE_COVERAGE]</code> equals <code>[HEALTHCARE_EXPENSES]</code>, else <code>0</code>.</td><td><code>0</code> or <code>1</code> per row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">DELTA(
  10,
  10
)
</code></pre></td><td>Checks equality of two literal numbers.</td><td><code>1</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">DELTA(
  [COPAY_AMOUNT]
)
</code></pre></td><td>Checks whether <code>[COPAY_AMOUNT]</code> equals <code>0</code> (second argument defaults to <code>0</code>).</td><td><code>0</code> or <code>1</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  DELTA([STATUS_CODE], 0) = 1,
  "unknown",
  "known"
)
</code></pre></td><td>Maps rows to <code>"unknown"</code> when <code>[STATUS_CODE]</code> equals <code>0</code>.</td><td>Either <code>"unknown"</code> or <code>"known"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DELTA(
  ROUND([AMOUNT], 0),
  ROUND([AMOUNT_APPROVED], 0)
)
</code></pre></td><td>Checks equality after rounding <code>[AMOUNT]</code> and <code>[AMOUNT_APPROVED]</code> to whole numbers.</td><td><code>0</code> or <code>1</code> per row.</td></tr></tbody></table>

## EVEN

The `EVEN` function rounds a number up to the nearest even integer. The function always rounds a value up and away from zero, regardless of its sign. If the `number column` is already an even integer, no rounding occurs.

### Syntax

```dax
EVEN(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="209">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The number, column or mocker to be rounded up to the nearest even integer.</td></tr></tbody></table>

### Return value

A positive number rounded up to the next even integer and a negative number rounded down to the next even integer.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">EVEN(
  [HEALTHCARE_COVERAGE]
)
</code></pre></td><td>Rounds <code>[HEALTHCARE_COVERAGE]</code> up (away from zero) to the nearest even integer per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">EVEN(
  3.2
)
</code></pre></td><td>Rounds <code>3.2</code> up to the next even integer.</td><td><code>4</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">EVEN(
  -3.2
)
</code></pre></td><td>Rounds <code>-3.2</code> down (away from zero) to the next even integer.</td><td><code>-4</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">EVEN(
  ROUND([HEALTHCARE_COVERAGE], 0)
)
</code></pre></td><td>Rounds <code>[HEALTHCARE_COVERAGE]</code> to a whole number first, then to the nearest even integer.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ISODD([SEAT_NUMBER]) = 1,
  EVEN([SEAT_NUMBER] + 1),
  [SEAT_NUMBER]
)
</code></pre></td><td>Makes odd <code>[SEAT_NUMBER]</code> values even by adding <code>1</code>; leaves even values unchanged.</td><td>Varies by row.</td></tr></tbody></table>

## FALSE

Returns the logical value FALSE.

### Syntax

```dax
FALSE()
```

### Return value

The logical value FALSE.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">FALSE()
</code></pre></td><td>Returns the logical value <code>FALSE</code>.</td><td><code>FALSE</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  [IS_ACTIVE] = 1,
  TRUE(),
  FALSE()
)
</code></pre></td><td>Returns <code>TRUE</code> when <code>[IS_ACTIVE]</code> equals <code>1</code>; otherwise returns <code>FALSE</code>.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  FALSE(),
  "never",
  "always"
)
</code></pre></td><td>Demonstrates that a constant <code>FALSE()</code> condition always returns the <code>otherwise</code> value.</td><td><code>"always"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">AND(
  FALSE(),
  [IS_ACTIVE] = 1
)
</code></pre></td><td>Shows that <code>AND</code> returns <code>FALSE</code> when any argument is <code>FALSE</code>.</td><td><code>FALSE</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  FALSE(),
  MOCK_FIRST_NAME,
  MOCK_LAST_NAME
)
</code></pre></td><td>Always returns the <code>otherwise</code> branch, so it generates last names.</td><td>Varies by row.</td></tr></tbody></table>

## FLOOR

The `FLOOR` function rounds a number down toward zero to the nearest multiple of a specified significance. When the `number` is positive, it is rounded down and adjusted toward zero. When the `number` is negative, it is rounded down and adjusted away from zero. If the `number` is already an exact multiple of the `significance`, no rounding occurs.

* If either argument is nonnumeric, the function returns an error message.
* If the `number` is positive and the `significance` is negative, the function returns an error message.

### Syntax

```dax
FLOOR(number, significance)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The numeric number, column or mocker you want to round down.</td></tr><tr><td>significance</td><td>The multiple to which you want to round the number.</td></tr></tbody></table>

### Return value

Rounds a number down to the nearest multiple of Significance.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formulas round numbers down to the nearest multiple of Significance.

<table><thead><tr><th width="291">Formula</th><th width="333">Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">FLOOR(
  7.7,
  3
)
</code></pre></td><td>Rounds <code>7.7</code> down to the nearest multiple of <code>3</code>.</td><td><code>6</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">FLOOR(
  -3.4,
  -3
)
</code></pre></td><td>Rounds <code>-3.4</code> down to the nearest multiple of <code>-3</code>.</td><td><code>-3</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">FLOOR(
  1.453,
  0.01
)
</code></pre></td><td>Rounds <code>1.453</code> down to the nearest multiple of <code>0.01</code>.</td><td><code>1.45</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">FLOOR(
  [AMOUNT],
  1
)
</code></pre></td><td>Rounds <code>[AMOUNT]</code> down to the nearest whole number per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">FLOOR(
  ABS([AMOUNT]),
  0.5
)
</code></pre></td><td>Rounds the absolute amount down to the nearest multiple of <code>0.5</code>.</td><td>Varies by row.</td></tr></tbody></table>

## HEX2DEC

The `HEX2DEC` function converts a hexadecimal number to its decimal equivalent. If the input is not a valid hexadecimal number, the function returns an error.

### Syntax

```dataweave
HEX2DEC(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The hexadecimal number, column or mocker column to convert. The number can have up to 10 characters (40 bits). The most significant bit represents the sign, and the remaining 39 bits represent the magnitude. Negative numbers are represented using two's-complement notation.</td></tr></tbody></table>

### Return value

The decimal number for the hexadecimal number entered.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">HEX2DEC(
  "CAB007"
)
</code></pre></td><td>Converts a literal hex string to its decimal value.</td><td><code>13283335</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">HEX2DEC(
  "FF"
)
</code></pre></td><td>Converts <code>"FF"</code> (hex) to decimal.</td><td><code>255</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">HEX2DEC(
  [HEX_VALUE]
)
</code></pre></td><td>Converts the hex value in <code>[HEX_VALUE]</code> to decimal per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">HEX2DEC(
  UPPER([HEX_VALUE])
)
</code></pre></td><td>Uppercases <code>[HEX_VALUE]</code> first, then converts to decimal.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">HEX2DEC(
  RIGHT([HEX_PAYLOAD], 6)
)
</code></pre></td><td>Extracts the last 6 hex characters from <code>[HEX_PAYLOAD]</code>, then converts to decimal.</td><td>Varies by row.</td></tr></tbody></table>

## HOUR

The `HOUR` function returns the hour component of a time value as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). Time values are part of a date value and are represented as decimal numbers (e.g., 12:00 PM is represented as `0.5` because it is half of a day).

### Syntax

```dax
HOUR(time)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>time</td><td>The time number, column or mocker from which you want to extract the hour. This can be entered as a text string within quotation marks (e.g., <code>"6:45 PM"</code>), as a decimal number (e.g., <code>0.78125</code> representing 6:45 PM), or as the result of other formulas or functions (e.g., <code>TIMEVALUE("6:45 PM")</code>).</td></tr></tbody></table>

### Return value

Hour component of given time.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">HOUR(
  "6/24/2012 7:30"
)
</code></pre></td><td>Extracts the hour from a literal datetime string.</td><td><code>7</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">HOUR(
  [START]
)
</code></pre></td><td>Extracts the hour from the <code>[START]</code> datetime column per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">HOUR(
  "6:45 PM"
)
</code></pre></td><td>Extracts the hour from a literal time string.</td><td><code>18</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  HOUR([START]) >= 9,
  "business_hours",
  "off_hours"
)
</code></pre></td><td>Classifies rows based on whether <code>[START]</code> occurs at 09:00 or later.</td><td>Either <code>"business_hours"</code> or <code>"off_hours"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">HOUR(
  DATEADD([START], 1, "day")
)
</code></pre></td><td>Adds one day to <code>[START]</code> and extracts the hour (same hour, shifted date).</td><td>Varies by row.</td></tr></tbody></table>

## IF

The `IF` function performs a logical test and returns one value if the test evaluates to TRUE and another value if it evaluates to FALSE. This function is commonly used to create conditional formulas.

### Syntax

```dax
IF(test, then value, otherwisevalue)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>test</td><td>The condition you want to test. This can be any expression that returns either TRUE or FALSE.</td></tr><tr><td>then value</td><td>The column or mock value that is returned if the <code>logical_test</code> evaluates to TRUE.</td></tr><tr><td>otherwisevalue</td><td>The column or mock value that is returned if the <code>logical_test</code> evaluates to FALSE. If omitted, the function returns FALSE by default.</td></tr></tbody></table>

### Return value

A logical test result.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  AND(
    [STATE] = "Massachusetts",
    [HEALTHCARE_COVERAGE] > 30
  ),
  MOCK_FIRST_NAME_FEMALE,
  MOCK_FIRST_NAME_MALE
)
</code></pre></td><td>Generates a female first name for MA rows with coverage over <code>30</code>; otherwise generates a male first name.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  [HEALTHCARE_COVERAGE] > 0,
  [HEALTHCARE_COVERAGE]
)
</code></pre></td><td>Returns <code>[HEALTHCARE_COVERAGE]</code> when it’s positive; otherwise returns <code>FALSE</code> (default <code>otherwise</code>).</td><td>Either a number or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  [ZIP] = "0000XX",
  "unknown",
  "known"
)
</code></pre></td><td>Maps the sentinel ZIP value <code>"0000XX"</code> to <code>"unknown"</code>, otherwise <code>"known"</code>.</td><td>Either <code>"unknown"</code> or <code>"known"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  DATEDIFF([BIRTHDATE], TODAY(), "year") >= 18,
  "adult",
  "minor"
)
</code></pre></td><td>Classifies rows as <code>"adult"</code> when age is 18+; otherwise <code>"minor"</code>.</td><td>Either <code>"adult"</code> or <code>"minor"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ISNULL([MIDDLE_NAME]),
  CONCATENATE(
    [FIRSTNAME],
    " ",
    [LASTNAME]
  ),
  CONCATENATE(
    [FIRSTNAME],
    " ",
    [MIDDLE_NAME],
    " ",
    [LASTNAME]
  )
)
</code></pre></td><td>Builds a full name, optionally inserting <code>[MIDDLE_NAME]</code> when present.</td><td>Varies by row.</td></tr></tbody></table>

## IFS

The `IFS` function checks multiple conditions and returns a value corresponding to the first condition that evaluates to TRUE. This function simplifies the use of multiple nested `IF` statements, making it easier to read and manage multiple conditions.

To specify a default result, enter `TRUE` as the final condition argument. If none of the other conditions are met, the corresponding value will be returned. For example, if all other conditions fail, a default value can be returned by using `TRUE` as the final condition. If a condition argument is provided without a corresponding value, the function will return an error message. If a condition argument evaluates to something other than TRUE or FALSE, the function returns an error. If none of the conditions evaluate to TRUE, the function returns an error.

### Syntax

```dataweave
IFS(condition1, number1, condition2, number2..., condition_n, number_N)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>condition1</td><td>The condition that is evaluated to determine if it is TRUE or FALSE.</td></tr><tr><td>number1</td><td>The column or mock value returned if <code>condition1</code> evaluates to TRUE. This can be left empty.</td></tr><tr><td>condition2…condition_N</td><td>Additional conditions that are evaluated to determine if they are TRUE or FALSE.</td></tr><tr><td>number2<br>…number_N</td><td>Th column or mock value returned if the corresponding <code>conditionN</code> evaluates to TRUE. Each <code>valueN</code> is associated with its corresponding <code>conditionN</code>. These can also be left empty.</td></tr></tbody></table>

### Return value

A value that corresponds to the first true condition.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">IFS(
  [GENDER] = "F",
  MOCK_NAME_FEMALE,
  [GENDER] = "M",
  MOCK_NAME_MALE
)
</code></pre></td><td>Generates a mock female name for <code>"F"</code> and a mock male name for <code>"M"</code>.</td><td>Varies by row (or errors if no condition matches).</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">IFS(
  [STATE] = "Massachusetts",
  "MA",
  [STATE] = "California",
  "CA",
  TRUE,
  "OTHER"
)
</code></pre></td><td>Maps states to abbreviations, with <code>"OTHER"</code> as a default.</td><td><code>"MA"</code>, <code>"CA"</code>, or <code>"OTHER"</code> per row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">IFS(
  [SCORE] >= 90,
  "A",
  [SCORE] >= 80,
  "B",
  [SCORE] >= 70,
  "C",
  TRUE,
  "D"
)
</code></pre></td><td>Assigns a grade based on score thresholds.</td><td><code>"A"</code>, <code>"B"</code>, <code>"C"</code>, or <code>"D"</code> per row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">IFS(
  AND(
    [COUNTRY] = "US",
    ISNULL([STATE]) = FALSE
  ),
  "US_WITH_STATE",
  [COUNTRY] = "US",
  "US_MISSING_STATE",
  TRUE,
  "NON_US"
)
</code></pre></td><td>Classifies US/non-US rows and whether a US row has a state value.</td><td><code>"US_WITH_STATE"</code>, <code>"US_MISSING_STATE"</code>, or <code>"NON_US"</code> per row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">IFS(
  LEN(TRIM([PHONE])) &#x3C; 10,
  "invalid",
  TRUE,
  "valid"
)
</code></pre></td><td>Validates phone numbers by trimmed length, with a default <code>"valid"</code>.</td><td><code>"invalid"</code> or <code>"valid"</code> per row.</td></tr></tbody></table>

## IFNULL

Returns replacement\_value when value is NULL; otherwise returns value.

### Syntax

```excel-formula
IFNULL(value, replacement_value)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value</td><td>The value, column or generator you want to check for NULL.</td></tr><tr><td>replacement</td><td>The value, column or generator to replace a NULL value with.</td></tr></tbody></table>

### Return value

Returns the specified replacement value if the observed value is NULL.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">IFNULL(
  [ZIP],
  "0000XX"
)
</code></pre></td><td>Replaces missing ZIP codes with <code>"0000XX"</code>.</td><td><code>[ZIP]</code> or <code>"0000XX"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IFNULL(
  [MIDDLE_NAME],
  ""
)
</code></pre></td><td>Replaces a missing middle name with an empty string.</td><td><code>[MIDDLE_NAME]</code> or <code>""</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IFNULL(
  MOCK_POSTCODE,
  "0000XX"
)
</code></pre></td><td>Replaces a missing generated postcode value with a fallback.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IFNULL(
  TRIM([CITY]),
  "Unknown"
)
</code></pre></td><td>Trims <code>[CITY]</code>, then replaces a missing value with <code>"Unknown"</code>.</td><td><code>[CITY]</code> (trimmed) or <code>"Unknown"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ISNULL([ZIP]),
  "0000XX",
  IFNULL([ZIP], "0000XX")
)
</code></pre></td><td>Uses <code>ISNULL</code> and <code>IFNULL</code> together to guarantee a ZIP fallback.</td><td><code>[ZIP]</code> or <code>"0000XX"</code> per row.</td></tr></tbody></table>

## ISNULL

The `ISNULL` function checks whether a value is NULL and returns `TRUE` if the cell is NULL. If the value contains any data, including a formula that returns an empty string (`""`), `ISNULL` returns `FALSE`.

### Syntax

```excel-formula
ISNULL(value)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value</td><td>The value, column or mocker you want to check for NULL.</td></tr></tbody></table>

### Return value

`TRUE` if the value is NULL; `FALSE` if it contains any data.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ISNULL([ZIP])
</code></pre></td><td>Checks whether <code>[ZIP]</code> is NULL.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ISNULL([MIDDLE_NAME])
</code></pre></td><td>Checks whether <code>[MIDDLE_NAME]</code> is NULL.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ISNULL([ZIP]),
  "missing",
  "present"
)
</code></pre></td><td>Maps missing ZIP codes to <code>"missing"</code>, otherwise <code>"present"</code>.</td><td>Either <code>"missing"</code> or <code>"present"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">NOT(ISNULL([EMAIL]))
</code></pre></td><td>Returns <code>TRUE</code> when <code>[EMAIL]</code> is present (not NULL).</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">AND(
  ISNULL([PHONE]),
  ISNULL([MOBILE_PHONE])
)
</code></pre></td><td>Checks whether both phone fields are NULL.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr></tbody></table>

## ISODD

The `ISODD` function checks whether a number is odd. It returns `1` if the number is odd, and `0` if the number is even. This function is useful for determining the parity of a number within a table. If the number is nonnumeric, `ISODD` returns an error.

### Syntax

```dax
ISODD(value)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value</td><td>The value or column to test. If the number is not an integer, it is truncated.</td></tr></tbody></table>

### Return value

`0` if the value is an even integer; `1` if the value is odd.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ISODD([HEALTHCARE_EXPENSES])
</code></pre></td><td>Checks whether <code>[HEALTHCARE_EXPENSES]</code> is odd.</td><td><code>0</code> or <code>1</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ISODD(7)
</code></pre></td><td>Checks whether the literal number <code>7</code> is odd.</td><td><code>1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ISODD([HEALTHCARE_EXPENSES] + 1)
</code></pre></td><td>Adds <code>1</code> to the expenses value, then checks if the result is odd.</td><td><code>0</code> or <code>1</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  ISODD([INVOICE_ID]) = 1,
  "odd_id",
  "even_id"
)
</code></pre></td><td>Labels invoice ids by parity.</td><td>Either <code>"odd_id"</code> or <code>"even_id"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ISODD(
  QUOTIENT(
    [TOTAL_MINUTES],
    60
  )
)
</code></pre></td><td>Converts minutes to whole hours and checks if the hour count is odd.</td><td><code>0</code> or <code>1</code> per row.</td></tr></tbody></table>

## LEFT

The `LEFT` function returns a specified number of characters from the left side of a string. To determine the number of characters in a string, use the `LEN` function.

### Syntax

```dax
LEFT("text", number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>The string, column or mocker from which the leftmost characters are returned. If the string contains <code>Null</code>, the function returns <code>Null</code>.</td></tr><tr><td>number</td><td>A numeric expression or column indicating how many characters to return. If <code>0</code>, a zero-length string (<code>""</code>) is returned. If the length is greater than or equal to the number of characters in the string, the entire string is returned.</td></tr></tbody></table>

### Return value

The input text capped by a specified character length.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LEFT([STATE], MOCK_RANDOM_DIGIT)
</code></pre></td><td>Returns a random-length left substring from <code>[STATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEFT("Massachusetts", 4)
</code></pre></td><td>Returns the first 4 characters of a literal string.</td><td><code>"Mass"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEFT([STATE], 0)
</code></pre></td><td>Returns the first 0 characters, which is an empty string.</td><td><code>""</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEFT(TRIM([STATE]), 2)
</code></pre></td><td>Trims <code>[STATE]</code> first, then returns the first 2 characters.</td><td>Varies by row (e.g., <code>"Ma"</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEFT(CONCATENATE([CITY], ", ", [STATE]), 12)
</code></pre></td><td>Builds <code>"City, State"</code> then returns the first 12 characters.</td><td>Varies by row.</td></tr></tbody></table>

## LEN

The `LEN` function returns a `Long` value representing the number of characters in a string or the number of bytes required to store a variable.

### Syntax

```dax
LEN("text")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>Any valid string expression, column or mocker.</td></tr></tbody></table>

### Return value

Length of a given text.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LEN([BIRTHPLACE])
</code></pre></td><td>Returns the number of characters in <code>[BIRTHPLACE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEN("Syntho")
</code></pre></td><td>Returns the number of characters in a literal string.</td><td><code>6</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEN(CONCATENATE([CITY], ", ", [STATE]))
</code></pre></td><td>Builds <code>"City, State"</code> then returns the character count.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LEN(TRIM([ADDRESS]))
</code></pre></td><td>Trims whitespace from <code>[ADDRESS]</code> then returns the character count.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(LEN([PHONE]) &#x3C; 10, "invalid", "valid")
</code></pre></td><td>Validates phone numbers based on their length.</td><td>Either <code>"invalid"</code> or <code>"valid"</code> per row.</td></tr></tbody></table>

## LN

The `LN` function returns the natural logarithm of a specified number. Natural logarithms are based on the mathematical constant `e` (approximately 2.71828182845904). The `LN` function is the inverse of the `EXP` function.

### Syntax

```dax
LN(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The positive real number, column or mocker for which you want to calculate the natural logarithm.</td></tr></tbody></table>

### Return value

The natural logarithm of the number.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LN([HEALTHCARE_EXPENSES])
</code></pre></td><td>Returns the natural log of <code>[HEALTHCARE_EXPENSES]</code> per row.</td><td>Varies by row (and errors for non-positive values).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LN(10)
</code></pre></td><td>Returns the natural log of a literal number.</td><td><code>~2.3026</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LN([HEALTHCARE_EXPENSES] + 1)
</code></pre></td><td>Adds <code>1</code> to avoid <code>LN(0)</code> for zero values, then logs the result.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LN(ABS([HEALTHCARE_EXPENSES]))
</code></pre></td><td>Takes the absolute value first, then computes the natural log.</td><td>Varies by row (and errors when the absolute value is <code>0</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF([HEALTHCARE_EXPENSES] > 0, LN([HEALTHCARE_EXPENSES]), 0)
</code></pre></td><td>Computes <code>LN</code> only for positive values; otherwise returns <code>0</code>.</td><td>Either <code>0</code> or a log value per row.</td></tr></tbody></table>

## LOG

The `LOG` function returns the logarithm of a specified number to a base that you define.

### Syntax

```dax
LOG(number, base)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The positive real number, column or mocker for which you want to calculate the logarithm.</td></tr><tr><td>base</td><td>The base of the logarithm. If omitted, the base is assumed to be 10.</td></tr></tbody></table>

### Return value

The logarithm of a number to the specified base.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LOG([HEALTHCARE_EXPENSES], 2)
</code></pre></td><td>Returns the base-2 log of <code>[HEALTHCARE_EXPENSES]</code> per row.</td><td>Varies by row (and errors for non-positive values).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOG(100)
</code></pre></td><td>Returns the base-10 log of <code>100</code> (default base).</td><td><code>2</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOG([HEALTHCARE_EXPENSES], [LOG_BASE])
</code></pre></td><td>Returns the log using a per-row base from <code>[LOG_BASE]</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOG([HEALTHCARE_EXPENSES])
</code></pre></td><td>Returns the base-10 log of <code>[HEALTHCARE_EXPENSES]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(LOG([HEALTHCARE_EXPENSES], 2), 3)
</code></pre></td><td>Computes base-2 log and rounds it to 3 decimals.</td><td>Varies by row.</td></tr></tbody></table>

## LOG10

The `LOG10` function returns the base-10 logarithm of a specified number.

### Syntax

```dax
LOG10(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The positive real number, column or mocker for which you want to calculate the base-10 logarithm.</td></tr></tbody></table>

### Return value

The base-10 logarithm of a number.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LOG10([HEALTHCARE_EXPENSES])
</code></pre></td><td>Returns the base-10 log of <code>[HEALTHCARE_EXPENSES]</code> per row.</td><td>Varies by row (and errors for non-positive values).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOG10(1000)
</code></pre></td><td>Returns the base-10 log of <code>1000</code>.</td><td><code>3</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOG10([HEALTHCARE_EXPENSES] + 1)
</code></pre></td><td>Adds <code>1</code> first, then computes the base-10 log.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF([HEALTHCARE_EXPENSES] > 0, LOG10([HEALTHCARE_EXPENSES]), 0)
</code></pre></td><td>Computes <code>LOG10</code> only for positive values; otherwise returns <code>0</code>.</td><td>Either <code>0</code> or a log value per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(LOG10([HEALTHCARE_EXPENSES]), 2)
</code></pre></td><td>Computes base-10 log and rounds it to 2 decimals.</td><td>Varies by row.</td></tr></tbody></table>

## LOWER

The `LOWER` function converts all uppercase letters in a text string to lowercase.

### Syntax

```dax
LOWER("text")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>The text, column or mocker you want to convert to lowercase. The <code>LOWER</code> function does not alter characters in the text that are not letters.</td></tr></tbody></table>

### Return value

Text converted to lowercase.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">LOWER([ADDRESS])
</code></pre></td><td>Converts <code>[ADDRESS]</code> to lowercase per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOWER("John.Doe@Example.com")
</code></pre></td><td>Converts a literal string to lowercase.</td><td><code>"john.doe@example.com"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOWER(CONCATENATE([FIRSTNAME], ".", [LASTNAME]))
</code></pre></td><td>Builds <code>"First.Last"</code> then lowercases it.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOWER(TRIM([EMAIL]))
</code></pre></td><td>Trims whitespace from <code>[EMAIL]</code>, then lowercases it.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(LOWER([FIRSTNAME]), ".", LOWER([LASTNAME]), "@", MOCK_FREE_EMAIL_DOMAIN)
</code></pre></td><td>Builds a lowercase email-like string using name columns plus a generated domain.</td><td>Varies by row.</td></tr></tbody></table>

## MINUTE

The `MINUTE` function returns the minute component of a time value as an integer, ranging from 0 to 59. Time values are a portion of a date value and are represented as a decimal number (e.g., 12:00 PM is represented as `0.5` since it is half of a day).

### Syntax

```dax
MINUTE(time)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>time</td><td>The time, column or mocker from which you want to extract the minute. This can be entered as a text string (e.g., <code>"4:30 PM"</code>), as a decimal number (e.g., <code>0.78125</code> representing 6:45 PM), or as the result of other formulas or functions.</td></tr></tbody></table>

### Return value

Minute component of given time.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">MINUTE("4:30:45 PM")
</code></pre></td><td>Extracts the minute component from a literal time string.</td><td><code>30</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MINUTE([START])
</code></pre></td><td>Extracts the minute component from the <code>[START]</code> time/datetime per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MINUTE("6/24/2012 07:05:00")
</code></pre></td><td>Extracts the minute component from a literal datetime string.</td><td><code>5</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(MINUTE([START]) = 0, "on_the_hour", "off_cycle")
</code></pre></td><td>Flags whether <code>[START]</code> happens exactly on the hour.</td><td>Either <code>"on_the_hour"</code> or <code>"off_cycle"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MINUTE([START]) + (HOUR([START]) * 60)
</code></pre></td><td>Converts a time to minutes since midnight.</td><td>Varies by row.</td></tr></tbody></table>

## MOD

Calculates the remainder of a division and always ensures it matches the sign of the divisor for consistency.

* If the divisor is 0, `MOD` returns the `#DIV/0!` error value.
* The `MOD` function can be expressed using the `INT` function as follows:\
  \&#xNAN;*`MOD(n, d) = n - d*INT(n/d)`*

### Syntax

```dax
MOD(dividend, divisor)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>dividend</td><td>The number, column or mocker for which you want to find the remainder.</td></tr><tr><td>divisor</td><td>The number, column or mocker by which you want to divide the number.</td></tr></tbody></table>

### Return value

The remainder when one integer is divided by another.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formula returns the remainders when integers with different signs is divided by integers with different signs.

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">MOD(5, 2)
</code></pre></td><td>Returns the remainder of <code>5 / 2</code>.</td><td><code>1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MOD(-5, 2)
</code></pre></td><td>Returns the remainder of <code>-5 / 2</code> (same sign as the divisor).</td><td><code>1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MOD(5, -2)
</code></pre></td><td>Returns the remainder of <code>5 / -2</code> (same sign as the divisor).</td><td><code>-1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MOD(-5, -2)
</code></pre></td><td>Returns the remainder of <code>-5 / -2</code> (same sign as the divisor).</td><td><code>-1</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MOD([INVOICE_ID], 10)
</code></pre></td><td>Returns the last digit (mod 10) of <code>[INVOICE_ID]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(MOD([INVOICE_ID], 2) = 0, "even", "odd")
</code></pre></td><td>Classifies invoice ids as even or odd using a mod 2 check.</td><td>Either <code>"even"</code> or <code>"odd"</code> per row.</td></tr></tbody></table>

## MONTH

The `MONTH` function returns the month of a date represented by a serial number. The month is provided as an integer ranging from 1 (January) to 12 (December).

Values returned by the `YEAR`, `MONTH`, and `DAY` functions are based on the Gregorian calendar, regardless of the display format of the provided date.

### Syntax

```dax
MONTH(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The date, column or mocker from which you want to extract the month. Dates should be entered using the <code>DATE</code> function or as results from other formulas or functions (e.g., <code>DATE(2008, 5, 23)</code> for May 23, 2008). Entering dates as text can cause issues.</td></tr></tbody></table>

### Return value

The month for the given date value.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">MONTH([BIRTHDATE])
</code></pre></td><td>Returns the month number from <code>[BIRTHDATE]</code> per row.</td><td>Varies by row (1–12).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MONTH(DATE(2024, 12, 31))
</code></pre></td><td>Returns the month number from a constructed date.</td><td><code>12</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MONTH("24/8/2012")
</code></pre></td><td>Returns the month number from a literal date string.</td><td><code>8</code> (locale dependent).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">MONTH(DATEADD([BIRTHDATE], 6, "month"))
</code></pre></td><td>Adds 6 months to <code>[BIRTHDATE]</code> then extracts the month.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(MONTH([ORDER_DATE]) = 12, "holiday_season", "regular")
</code></pre></td><td>Flags December orders as holiday season.</td><td>Either <code>"holiday_season"</code> or <code>"regular"</code> per row.</td></tr></tbody></table>

## NOT

The `NOT` function reverses the logical value of its argument. If the argument is `TRUE`, `NOT` returns `FALSE`, and if the argument is `FALSE`, `NOT` returns `TRUE`. One common use of the `NOT` function is to enhance the functionality of other logical functions, such as `IF`. By using `NOT` within the logical test of an `IF` function, you can test multiple conditions and control the flow of logic based on reversed outcomes.

### Syntax

```dax
NOT(Logicalvalue)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Logicalvalue</td><td>A column or expression that can be evaluated to <code>TRUE</code> or <code>FALSE</code>.</td></tr></tbody></table>

### Return value

Complements (inverts) a logical value.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">IF(
  AND(
    NOT([GENDER] = "M"),
    NOT([HEALTHCARE_EXPENSES] &#x3C; 100)
  ),
  MOCK_NAME_FEMALE,
  MOCK_NAME_MALE
)
</code></pre></td><td>Generates a female name when gender is not <code>"M"</code> and expenses are not &#x3C; 100; otherwise generates a male name.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">NOT([IS_ACTIVE] = 1)
</code></pre></td><td>Inverts the active flag check.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(NOT([ZIP] = "0000XX"), "valid", "fallback")
</code></pre></td><td>Returns <code>"valid"</code> unless <code>[ZIP]</code> equals the sentinel value <code>"0000XX"</code>.</td><td>Either <code>"valid"</code> or <code>"fallback"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">NOT(ISNULL([ZIP]))
</code></pre></td><td>Returns <code>TRUE</code> when <code>[ZIP]</code> is present (not NULL).</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(NOT(AND([COUNTRY] = "US", LEN([ZIP]) = 5)), "invalid_zip", "ok")
</code></pre></td><td>Validates US ZIPs: must be length 5 when country is <code>"US"</code>.</td><td>Either <code>"invalid_zip"</code> or <code>"ok"</code> per row.</td></tr></tbody></table>

## ODD

The `ODD` function rounds a number up to the nearest odd integer.

* If the `number` is nonnumeric, the function returns an error.
* The function always rounds a value up and away from zero, regardless of its sign. If the `number` is already an odd integer, no rounding occurs.

### Syntax

```dax
ODD(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The number, column or mocker to be rounded up to the nearest odd integer.</td></tr></tbody></table>

### Return value

A positive number rounded up to the nearest odd integer and a negative number rounded down to the nearest odd integer.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formulas return positive numbers rounded up to the nearest odd integers and negative numbers rounded down to the nearest odd integers.

<table><thead><tr><th>DAX Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ODD(3.4)
</code></pre></td><td>Rounds 3.4 up to the nearest odd integer.</td><td>5</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ODD(3)
</code></pre></td><td>Rounds 3 up to the nearest odd integer.</td><td>3</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ODD(6)
</code></pre></td><td>Rounds 6 up to the nearest odd integer.</td><td>7</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ODD(-3)
</code></pre></td><td>Rounds -3 up to the nearest odd integer.</td><td>-3</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ODD(-4)
</code></pre></td><td>Rounds -4 up (away from 0) to the nearest odd integer.</td><td>-5</td></tr></tbody></table>

## OR

The `OR` function returns `TRUE` if any of its arguments evaluate to `TRUE`, and returns `FALSE` if all arguments evaluate to `FALSE`.

* The arguments must evaluate to logical values, such as `TRUE` or `FALSE`, or be arrays that contain logical values.
* If an array or range argument contains text or empty values, those are ignored.
* If no logical values are found in the specified range, `OR` returns an error.
* You can use an `OR` array formula to check if a value occurs within an array.

### Syntax

```dax
OR(Logicalvalue1, Logicalvalue2 ...Logicalvalue30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Logicalvalue1</td><td>The first condition to test, which can evaluate to either <code>TRUE</code> or <code>FALSE</code>.</td></tr><tr><td>Logicalvalue2 ...Logicalvalue30</td><td>Additional conditions to test, up to a maximum of 30 conditions, each of which can evaluate to either <code>TRUE</code> or <code>FALSE</code>.</td></tr></tbody></table>

### Return value

`TRUE` if at least one argument is `TRUE`.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">OR([HEALTHCARE_COVERAGE] &#x3C; 100, [HEALTHCARE_EXPENSES] > 250)
</code></pre></td><td>Returns <code>TRUE</code> when coverage is &#x3C; 100 <strong>or</strong> expenses are > 250.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">OR([GENDER] = "F", [GENDER] = "M", [GENDER] = "X")
</code></pre></td><td>Checks whether gender is one of <code>"F"</code>, <code>"M"</code>, or <code>"X"</code>.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(OR([STATE] = "Massachusetts", [STATE] = "California"), "US", "non-US")
</code></pre></td><td>Labels rows as <code>"US"</code> when state is MA or CA.</td><td>Either <code>"US"</code> or <code>"non-US"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">OR(ISNULL([EMAIL]), ISNULL([PHONE]))
</code></pre></td><td>Returns <code>TRUE</code> when either email or phone is missing.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(OR([COUNTRY] = "US", [COUNTRY] = "CA"), "NA", "OTHER")
</code></pre></td><td>Classifies countries into North America vs other.</td><td>Either <code>"NA"</code> or <code>"OTHER"</code> per row.</td></tr></tbody></table>

## PI

The `PI` function returns the mathematical constant pi (π), accurate to 15 digits, which is approximately 3.14159265358979.

### Syntax

```dax
PI()
```

#### Parameters <a href="#parameters" id="parameters"></a>

The `PI` function does not require any arguments. It simply returns the value of π.

### Return value

Returns 3.14159265358979, the value of the mathematical constant PI to 14 decimal places.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">PI() * (5 ^ 2)
</code></pre></td><td>Computes the area of a circle with radius <code>5</code> (πr²).</td><td><code>~78.5398</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">2 * PI() * 5
</code></pre></td><td>Computes the circumference of a circle with radius <code>5</code> (2πr).</td><td><code>~31.4159</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">PI() * POWER([RADIUS], 2)
</code></pre></td><td>Computes πr² using <code>[RADIUS]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(PI(), 4)
</code></pre></td><td>Rounds π to 4 decimals.</td><td><code>3.1416</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(PI() / 180, 8)
</code></pre></td><td>Converts degrees to radians factor (π/180), rounded.</td><td><code>0.01745329</code></td></tr></tbody></table>

## POWER

The `POWER` function returns the result of a base number raised to a specified power. You can also use the `^` operator as an alternative to the `POWER` function, such as `4^3`, to indicate that the base number (4) is raised to the power of 3.

### Syntax

```dax
POWER(base, exponent)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>base</td><td>The base number, column or mocker, which can be any real number.</td></tr><tr><td>exponent</td><td>The exponent number, column or mocker to which the base number is raised.</td></tr></tbody></table>

### Return value

A number raised to another number.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">POWER(1.1, 3)
</code></pre></td><td>Raises <code>1.1</code> to the power of <code>3</code>.</td><td><code>1.331</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">POWER([AMOUNT], [EXPONENT])
</code></pre></td><td>Raises <code>[AMOUNT]</code> to <code>[EXPONENT]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">4 ^ 3
</code></pre></td><td>Raises <code>4</code> to the power of <code>3</code> using the <code>^</code> operator.</td><td><code>64</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SQRT(POWER([X], 2) + POWER([Y], 2))
</code></pre></td><td>Computes the Euclidean norm (√(x² + y²)) per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(POWER(1 + [RATE], [YEARS]), 6)
</code></pre></td><td>Computes compound growth then rounds to 6 decimals.</td><td>Varies by row.</td></tr></tbody></table>

## PROPER

The `PROPER` function capitalizes the first letter of each word in a text string and any other letters that follow a non-letter character. It converts all other letters to lowercase.

### Syntax

```dataweave
PROPER("text")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>The text, column or mocker you want to format. This can be a text string enclosed in quotation marks, a formula that returns text, or a reference to a value containing the text you want to capitalize.</td></tr></tbody></table>

### Return value

Capitalized words or texts.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">PROPER("5-star 99hoTels AMSTERDAM")
</code></pre></td><td>Capitalizes the first letter of each word and lowercases the rest.</td><td><code>"5-Star 99hotels Amsterdam"</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PROPER([ADDRESS])
</code></pre></td><td>Applies proper casing to <code>[ADDRESS]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PROPER(MOCK_ADDRESS)
</code></pre></td><td>Applies proper casing to a generated address.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PROPER(TRIM([ADDRESS]))
</code></pre></td><td>Trims whitespace first, then applies proper casing.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PROPER(LOWER([FULL_NAME]))
</code></pre></td><td>Lowercases <code>[FULL_NAME]</code> first, then applies proper casing.</td><td>Varies by row.</td></tr></tbody></table>

## PV

The `PV` function returns the present value of an annuity based on periodic, fixed payments to be made in the future and a fixed interest rate. The present value is the total amount that a series of future payments is worth now.

* An annuity is a series of fixed payments made over time, such as a mortgage or a savings plan.
* The `rate` and `nper` arguments must be based on the same units of time. For example, if `rate` is calculated using months, `nper` should also be calculated using months.
* In financial functions, cash outflows (such as deposits or payments) are represented by negative numbers, while cash inflows (such as dividends) are represented by positive numbers.

### Syntax

```dataweave
PV(Rate, Nper, Pmt, Fv, Type)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Rate</td><td>The interest rate per period. For example, if you have a car loan with an annual percentage rate (APR) of 10% and make monthly payments, the rate per period is <code>0.1/12</code>, or <code>0.0083</code>.</td></tr><tr><td>Nper</td><td>The total number of payment periods in the annuity. For example, a two-year car loan with monthly payments has <code>2 * 12 = 24</code> payment periods.</td></tr><tr><td>Pmt</td><td>The payment made each period, which typically includes both principal and interest and remains constant over the life of the annuity.</td></tr><tr><td>Fv</td><td>The future value or cash balance you want after the final payment. For example, the future value of a loan is $0 after the final payment. If omitted, <code>0</code> is assumed.</td></tr><tr><td>Type</td><td>Specifies when payments are due—<code>0</code> for payments at the end of the period, or <code>1</code> for payments at the beginning. If omitted, <code>0</code> is assumed.</td></tr></tbody></table>

### Return value

The present value of an investment.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dart"><code class="lang-dart">PV(0.06/12, 4*12, -250.99)
</code></pre></td><td>Calculates the present value of a 4-year loan at 6% APR with monthly payments.</td><td><code>~10687</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PV([RATE], [NPER], [PMT], [FV], [TYPE])
</code></pre></td><td>Calculates present value from per-row rate/period/payment inputs.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PV(0.06/12, 4*12, -250.99, 0, 0)
</code></pre></td><td>Same as above, with explicit <code>FV=0</code> and end-of-period payments (<code>Type=0</code>).</td><td><code>~10687</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PV(0.06/12, 4*12, -250.99, 1000, 1)
</code></pre></td><td>Computes present value with a future value of <code>1000</code> and beginning-of-period payments.</td><td><code>~11778</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">PV(0.06/12, 4*12, -250.99, 0, 1)
</code></pre></td><td>Computes present value with beginning-of-period payments (<code>Type=1</code>).</td><td><code>~10740</code></td></tr><tr><td><pre class="language-dart"><code class="lang-dart">ROUND(PV([RATE], [NPER], [PMT], [FV], [TYPE]), 2)
</code></pre></td><td>Rounds the computed present value to 2 decimals.</td><td>Varies by row.</td></tr></tbody></table>

## QUARTER

The `QUARTER` function returns the quarter of the year for a given date, represented as a number from 1 to 4, where:

* 1 corresponds to January – March,
* 2 corresponds to April – June,
* 3 corresponds to July – September,
* 4 corresponds to October – December.

### Syntax

```dax
QUARTER(date)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td>The date, column or mocker for which you want to determine the quarter.</td></tr></tbody></table>

### Return value

An integer from 1 to 4, representing the quarter of the year.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">QUARTER(DATE(2012, 8, 24))
</code></pre></td><td>Returns the quarter for Aug 24, 2012.</td><td><code>3</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUARTER([BIRTHDATE])
</code></pre></td><td>Returns the quarter for <code>[BIRTHDATE]</code> per row.</td><td>Varies by row (1–4).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUARTER(DATEVALUE("2024/05/01"))
</code></pre></td><td>Parses the date first, then returns its quarter.</td><td><code>2</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUARTER(DATEADD([BIRTHDATE], 3, "month"))
</code></pre></td><td>Adds 3 months to <code>[BIRTHDATE]</code> then returns the quarter.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(QUARTER([ORDER_DATE]) = 4, "peak", "normal")
</code></pre></td><td>Flags Q4 orders as peak season.</td><td>Either <code>"peak"</code> or <code>"normal"</code> per row.</td></tr></tbody></table>

## QUOTIENT

The `QUOTIENT` function returns the integer portion of a division, discarding the remainder. This function is useful when you only need the whole number result of a division.

### Syntax

```dax
QUOTIENT(dividend, divisor)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>dividend</td><td>The dividend column, mocker or the number to be divided.</td></tr><tr><td>divisor</td><td>The divisor column, mocker or the number by which the numerator is divided.</td></tr></tbody></table>

### Return value

Integer part of a division.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">QUOTIENT(-12.5, 5.3)
</code></pre></td><td>Returns the integer part of the division.</td><td><code>-2</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUOTIENT([REVENUE], [NUMBER_OF_SALES])
</code></pre></td><td>Computes revenue per sale and returns the integer portion.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUOTIENT(17, 3)
</code></pre></td><td>Returns the integer part of <code>17/3</code>.</td><td><code>5</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">QUOTIENT([TOTAL_SECONDS], 60)
</code></pre></td><td>Converts seconds to whole minutes per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(QUOTIENT([ORDER_TOTAL], 1000) >= 1, "high_value", "standard")
</code></pre></td><td>Flags orders of at least 1000 as high value.</td><td>Either <code>"high_value"</code> or <code>"standard"</code> per row.</td></tr></tbody></table>

## RAND

The `RAND` function returns a random real number that is evenly distributed between 0 (inclusive) and 1 (exclusive). Each time the worksheet recalculates, a new random number is generated.

### Syntax

```dax
RAND()
```

#### Parameters <a href="#parameters" id="parameters"></a>

The `RAND` function does not require any arguments. To generate a random real number between two specified values `a` and `b`, use the following formula:

```dax
a + (b - a) * RAND()
```

### Return value

A random number between 0 and 1.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">5 + (3 - 5) * RAND()
</code></pre></td><td>Generates a random number in the range <code>[3, 5)</code>.</td><td>Random number per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RAND()
</code></pre></td><td>Generates a random number in the range <code>[0, 1)</code>.</td><td>Random number per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">100 * RAND()
</code></pre></td><td>Scales a random number to the range <code>[0, 100)</code>.</td><td>Random number per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(RAND(), 3)
</code></pre></td><td>Rounds a random number to 3 decimals.</td><td>Random number per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(RAND() &#x3C; 0.05, "rare", "common")
</code></pre></td><td>Returns <code>"rare"</code> about 5% of the time.</td><td>Either <code>"rare"</code> or <code>"common"</code> per recalculation.</td></tr></tbody></table>

## RANDBETWEEN

The `RANDBETWEEN` function returns a random integer between the specified lower and upper bounds. Each time the worksheet recalculates, a new random integer is generated.

### Syntax

```dax
RANDBETWEEN(Lowerbound, Upperbound)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>lowerbound</td><td>The smallest integer, column or mocker that can be returned by the function.</td></tr><tr><td>upperbound</td><td>The largest integer, column or mocker that can be returned by the function.</td></tr></tbody></table>

### Return value

A random integer between two numbers.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">RANDBETWEEN(3, 5)
</code></pre></td><td>Returns a random integer between 3 and 5 (inclusive).</td><td><code>3</code>, <code>4</code>, or <code>5</code> per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RANDBETWEEN(-10, 10)
</code></pre></td><td>Returns a random integer between -10 and 10 (inclusive).</td><td>An integer in <code>[-10, 10]</code> per recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RANDBETWEEN([MIN_AGE], [MAX_AGE])
</code></pre></td><td>Returns a random integer between the per-row bounds.</td><td>Varies by row and recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(TODAY(), RANDBETWEEN(-30, 30), "day")
</code></pre></td><td>Returns a random date within ±30 days of today.</td><td>Varies by run date and recalculation.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CHAR(RANDBETWEEN(48, 57))
</code></pre></td><td>Generates a random digit character (<code>0</code>–<code>9</code>).</td><td>A character <code>"0"</code>…<code>"9"</code> per recalculation.</td></tr></tbody></table>

## REPLACE

The `REPLACE` function replaces part of a text string with a different text string, based on the number of characters you specify.

### Syntax

```dax
REPLACE(old_text, start_num, num_chars, new_text)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>old_text</td><td>The original text, column or mocker in which you want to replace some characters.</td></tr><tr><td>start_num</td><td>The position of the character in <code>old_text</code> that you want to start replacing with <code>new_text</code>.</td></tr><tr><td>num_chars</td><td>The number of characters in <code>old_text</code> that you want <code>REPLACE</code> to replace with <code>new_text</code>.</td></tr><tr><td>new_text</td><td>The text, column or mocker that will replace the specified characters or bytes in <code>old_text</code>.</td></tr></tbody></table>

### Return value

Part of a string with a new string.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">REPLACE("Hello Jupyter!", 6, 7, "Moon")
</code></pre></td><td>Replaces 7 characters starting at position 6 with <code>"Moon"</code>.</td><td><code>"Hello Moon!"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">REPLACE([PASSPORT], 6, 7, "004A")
</code></pre></td><td>Replaces 7 characters in <code>[PASSPORT]</code> starting at position 6.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">REPLACE([PASSPORT], 1, 2, "NL")
</code></pre></td><td>Overwrites the first two characters of <code>[PASSPORT]</code> with <code>"NL"</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">REPLACE(UPPER([COUNTRY_CODE]), 1, 2, "NL")
</code></pre></td><td>Uppercases <code>[COUNTRY_CODE]</code> then replaces the first two characters with <code>"NL"</code>.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">REPLACE([PASSPORT], LEN([PASSPORT]) - 1, 2, "XX")
</code></pre></td><td>Replaces the last 2 characters of <code>[PASSPORT]</code> with <code>"XX"</code>.</td><td>Varies by row.</td></tr></tbody></table>

## RIGHT

The `RIGHT` function returns a specified number of characters from the right side of a string.

### Syntax

```dax
RIGHT("text", number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>The text, column or mocker from which the rightmost characters are returned. If the string contains <code>Null</code>, the function returns <code>Null</code>.</td></tr><tr><td>number</td><td>A numeric expression indicating how many characters to return. If <code>0</code>, a zero-length string (<code>""</code>) is returned. If the length is greater than or equal to the number of characters in the string, the entire string is returned.</td></tr></tbody></table>

### Return value

The input text starting from a specified character index.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">RIGHT("Hello Earth!", 6)
</code></pre></td><td>Returns the last 6 characters of a literal string.</td><td><code>"Earth!"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RIGHT([STATE], MOCK_RANDOM_DIGIT)
</code></pre></td><td>Returns a random-length suffix of <code>[STATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RIGHT("Massachusetts", 4)
</code></pre></td><td>Returns the last 4 characters of a literal string.</td><td><code>"etts"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RIGHT(CONCATENATE("00000", [ZIP]), 5)
</code></pre></td><td>Left-pads ZIP with zeros then returns the last 5 characters.</td><td>Varies by row (e.g., <code>"02134"</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">RIGHT([PHONE], 4)
</code></pre></td><td>Returns the last 4 characters of a phone number per row.</td><td>Varies by row.</td></tr></tbody></table>

## ROUND

The `ROUND` function rounds a number to a specified number of digits.

* If `Count` is greater than 0, the `Number` is rounded to the specified number of decimal places.
* If `Count` is 0, the `Number` is rounded to the nearest integer.
* If `Count` is less than 0, the `Number` is rounded to the left of the decimal point.
* To always round up (away from zero), use the `ROUNDUP` function.
* To always round down (toward zero), use the `ROUNDDOWN` function.

### Syntax

```dax
ROUND(number, count)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The number, column or mocker you want to round.</td></tr><tr><td>count</td><td>The number of digits to which you want to round the <code>number</code>.</td></tr></tbody></table>

### Return value

A number that is rounded to a certain number of decimal places.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formulas round the numbers to various decimal places.

<table><thead><tr><th width="228">Formula</th><th width="361">Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(3.25, 1)
</code></pre></td><td>Rounds 3.25 to one decimal place</td><td>3.2</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(5.149, 1)
</code></pre></td><td>Rounds 5.149 to one decimal place</td><td>5.1</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(-6.745, 2)
</code></pre></td><td>Rounds -6.745 to two decimal places</td><td>-6.75</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(23.9, -1)
</code></pre></td><td>Rounds 23.9 to one decimal place to the left of the decimal point</td><td>20</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(575.9, -3)
</code></pre></td><td>Rounds 575.9 to the nearest multiple of 1000</td><td>1000</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(2.33, -1)
</code></pre></td><td>Rounds 2.33 to the nearest multiple of 10</td><td>0</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(-51.52, -2)
</code></pre></td><td>Rounds -51.52 to the nearest multiple of 100</td><td>-100</td></tr></tbody></table>

## ROUNDDOWN

The `ROUNDDOWN` function rounds a number down, toward zero.

* `ROUNDDOWN` behaves similarly to `ROUND`, except that it always rounds a number down.
* If `Count` is greater than 0, the `number` is rounded down to the specified number of decimal places.
* If `Count` is 0, the `number` is rounded down to the nearest integer.
* If `Count` is less than 0, the `number` is rounded down to the left of the decimal point.

### Syntax

```dax
ROUNDDOWN(number, count)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>Any real number, column or mocker that you want to round down.</td></tr><tr><td>count</td><td>The number of digits to which you want to round the <code>number</code>.</td></tr></tbody></table>

### Return value

A number rounded down, toward zero, to a certain precision.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formulas round down the numbers to various decimal places.

<table><thead><tr><th width="304">Formula</th><th width="341">Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDDOWN(5.3, 0)
</code></pre></td><td>Rounds 5.3 down to zero decimal place</td><td>5</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDDOWN(66.8,0)
</code></pre></td><td>Rounds 66.8 down to zero decimal places</td><td>66</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDDOWN(1.24279, 3)
</code></pre></td><td>Rounds 1.24279 down to three decimal places</td><td>1.242</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDDOWN(-1.24279, 1)
</code></pre></td><td>Rounds -1.24279 down to one decimal places</td><td>-1.2</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDDOWN(12427.98637, -2)
</code></pre></td><td>Rounds 12427.98637 down to 2 decimal places to the left of the decimal point.</td><td>12400</td></tr></tbody></table>

## ROUNDUP

The `ROUNDUP` function rounds a number up, away from 0 (zero).

* `ROUNDUP` behaves similarly to `ROUND`, except that it always rounds a number up.
* If `Count` is greater than 0, the `Number` is rounded up to the specified number of decimal places.
* If `Count` is 0, the `Number` is rounded up to the nearest integer.
* If `Count` is less than 0, the `Number` is rounded up to the left of the decimal point.

### Syntax

```dax
ROUNDUP(number, count)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>Any real number, column or mocker that you want rounded up.</td></tr><tr><td>count</td><td>The number of digits to which you want to round the <code>number</code>.</td></tr></tbody></table>

### Return value

A number rounded up, away from zero, to a certain precision.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

The following formulas round up the numbers to various decimal places.

<table><thead><tr><th width="304">Formula</th><th width="341">Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDUP(5.3, 0)
</code></pre></td><td>Rounds 5.3 up to zero decimal place</td><td>6</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDUP(66.8,0)
</code></pre></td><td>Rounds 66.8 up to zero decimal place</td><td>67</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDUP(1.24279, 3)
</code></pre></td><td>Rounds 1.24279 up to three decimal places</td><td>1.243</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDUP(-1.24279, 1)
</code></pre></td><td>Rounds -1.24279 up to one decimal places</td><td>-1.3</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUNDUP(12427.98637, -2)
</code></pre></td><td>Rounds 12427.98637 up to 2 decimal places to the left of the decimal point.</td><td>12500</td></tr></tbody></table>

## SECOND

The `SECOND` function returns the seconds component of a time value, as an integer ranging from 0 to 59.

### Syntax

```dax
SECOND(time)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>time</td><td>The time, column or mocker values from which you want to extract the seconds. This can be entered as a text string (e.g., <code>"6:45 PM"</code>), as a decimal number (e.g., <code>0.78125</code> representing 6:45 PM), or as the result of other formulas or functions (e.g., <code>TIMEVALUE("6:45 PM")</code>).</td></tr></tbody></table>

### Return value

Second component of given time.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">SECOND("2:25:55 PM")
</code></pre></td><td>Extracts the seconds component from a literal time string.</td><td><code>55</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SECOND([START_TIME])
</code></pre></td><td>Extracts the seconds component from <code>[START_TIME]</code> per row.</td><td>Varies by row (0–59).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SECOND("6/24/2012 07:30:05")
</code></pre></td><td>Extracts the seconds component from a literal datetime string.</td><td><code>5</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(SECOND([START_TIME]) = 0, "exact_minute", "has_seconds")
</code></pre></td><td>Flags whether the time is exactly on a minute boundary.</td><td>Either <code>"exact_minute"</code> or <code>"has_seconds"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SECOND([START_TIME]) + (MINUTE([START_TIME]) * 60)
</code></pre></td><td>Converts the seconds within the hour (minute*60 + second).</td><td>Varies by row (0–3599).</td></tr></tbody></table>

## SQRT

The `SQRT` function returns the positive square root of a given number.

### Syntax

```dax
SQRT(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The number, column or mocker for which you want to find the square root. If the <code>number</code> is negative, <code>SQRT</code> returns an error value.</td></tr></tbody></table>

### Return value

The positive square root of a number.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">SQRT(49)
</code></pre></td><td>Returns the square root of a literal number.</td><td><code>7</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SQRT([PAYER_COVERAGE])
</code></pre></td><td>Returns the square root of <code>[PAYER_COVERAGE]</code> per row.</td><td>Varies by row (and errors for negative values).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SQRT(POWER([PAYER_COVERAGE], 2))
</code></pre></td><td>Squares the value then takes the square root (returns absolute value for non-negative inputs).</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(SQRT([PAYER_COVERAGE]), 2)
</code></pre></td><td>Computes the square root then rounds to 2 decimals.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF([PAYER_COVERAGE] &#x3C; 0, 0, SQRT([PAYER_COVERAGE]))
</code></pre></td><td>Guards against negative inputs by returning <code>0</code> instead.</td><td>Either <code>0</code> or a square-root value per row.</td></tr></tbody></table>

## SUBSTITUTE

The `SUBSTITUTE` function replaces specific text within a text string with new text. Use `SUBSTITUTE` when you want to replace specific occurrences of text in a string; use `REPLACE` when you want to replace text based on its position in the string.

### Syntax

```dax
SUBSTITUTE(text, old_text, new_text, occurrence)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>text</td><td>The text string, column or mocker containing the text where you want to substitute characters.</td></tr><tr><td>old_text</td><td>The text you want to replace.</td></tr><tr><td>new_text</td><td>The text that will replace <code>Old_text</code></td></tr><tr><td>occurrence</td><td>Specifies which occurrence of <code>Old_text</code> you want to replace with <code>New_text</code>. If you provide <code>Occurrence</code>, only that specific instance of <code>Old_text</code> is replaced. If omitted, all occurrences of <code>Old_text</code> in the text are replaced with <code>New_text</code>.</td></tr></tbody></table>

### Return value

String where occurrences of `Old_text` are replaced by `New_text`. It replaces only specific occurrence if last parameter is provided.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">SUBSTITUTE("April 2, 2012", "2", "3", 3)
</code></pre></td><td>Replaces the 3rd occurrence of <code>"2"</code> with <code>"3"</code>.</td><td><code>"April 2, 2013"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SUBSTITUTE([PASSPORT], "X", "S", 1)
</code></pre></td><td>Replaces the first <code>"X"</code> in <code>[PASSPORT]</code> with <code>"S"</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SUBSTITUTE("john.doe@example.com", ".", "_")
</code></pre></td><td>Replaces all dots with underscores.</td><td><code>"john_doe@example_com"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SUBSTITUTE(LOWER([EMAIL]), " ", "")
</code></pre></td><td>Lowercases <code>[EMAIL]</code> then removes all spaces.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SUBSTITUTE([ADDRESS], CHAR(10), " ")
</code></pre></td><td>Replaces line breaks with spaces.</td><td>Varies by row.</td></tr></tbody></table>

## SWITCH

The `SWITCH` function evaluates one value (referred to as the expression) against a list of values and returns the result corresponding to the first matching value. If no match is found, an optional default value may be returned.

### Syntax

```dataweave
SWITCH(expression1, value1, result2, value2..., result_n, default)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>expression1</td><td>The value (such as a number, date, text or column) that will be compared against <code>value_1</code> through <code>value_N</code>.</td></tr><tr><td>value1, value2, ... value_N</td><td>The columns to be compared against <code>Expression1</code> through <code>expression_n</code>.</td></tr><tr><td>result1…result_n</td><td>The values to be returned when the corresponding <code>value1</code> through <code>value_N</code> arguments match result<code>1</code> through <code>result_n</code>. Each <code>result_n</code> must be provided for each corresponding <code>value_N</code> argument.</td></tr><tr><td>default</td><td>The column to return if no matches are found in the <code>value_N</code> expressions. The <code>Default</code> argument is identified by having no corresponding <code>result_n</code> expression. It must be the final argument in the function.</td></tr></tbody></table>

### Return value

A list of arguments, consisting of an expression followed by a value.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">SWITCH(3, 1, "Dog", 2, "Cat", 3, "Horse", "?")
</code></pre></td><td>Maps the expression <code>3</code> to the matching value.</td><td><code>"Horse"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SWITCH([STATUS], 1, "New", 2, "Active", 3, "Closed", "Unknown")
</code></pre></td><td>Maps numeric status codes to labels, with <code>"Unknown"</code> as default.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SWITCH([GENDER], "F", "female", "M", "male", "other")
</code></pre></td><td>Maps gender codes to normalized values.</td><td>Either <code>"female"</code>, <code>"male"</code>, or <code>"other"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SWITCH(TRUE(), [SCORE] >= 90, "A", [SCORE] >= 80, "B", [SCORE] >= 70, "C", "D")
</code></pre></td><td>Implements a tiered grade mapping using <code>TRUE()</code> as the expression.</td><td><code>"A"</code>, <code>"B"</code>, <code>"C"</code>, or <code>"D"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SWITCH(LEFT([COUNTRY], 2), "US", "United States", "NL", "Netherlands", "Other")
</code></pre></td><td>Maps country prefixes to full names.</td><td>Either <code>"United States"</code>, <code>"Netherlands"</code>, or <code>"Other"</code> per row.</td></tr></tbody></table>

## TODAY

The `TODAY` function returns the current date.

### Syntax

```dax
TODAY()
```

#### Parameters <a href="#parameters" id="parameters"></a>

The `TODAY` function has no arguments.

### Return value

An integer representing the current date as the number of full days since nullDate.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">YEAR(TODAY()) - 1998
</code></pre></td><td>Approximates age in years for a person born in 1998 (based on the current year).</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">TODAY()
</code></pre></td><td>Returns the current date.</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEDIFF([BIRTHDATE], TODAY(), "year")
</code></pre></td><td>Computes age in full years based on <code>[BIRTHDATE]</code>.</td><td>Varies by row and run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">DATEADD(TODAY(), 30, "day")
</code></pre></td><td>Returns the date 30 days from today.</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(TODAY() > DATE(2025, 1, 1), "after_2025", "before_2025")
</code></pre></td><td>Labels whether today is after Jan 1, 2025.</td><td>Either <code>"after_2025"</code> or <code>"before_2025"</code> (run date dependent).</td></tr></tbody></table>

## TRIM

The The **TRIM** function removes all unnecessary whitespace from a text string, ensuring cleaner and standardized text formatting. It is commonly used to clean imported or user-entered data that may contain irregular spacing.

### Syntax

```dax
TRIM("text")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td><p>The text, column or mocker from which you want to remove extra spaces.</p><ul><li><strong>Removes</strong> all leading and trailing spaces around a text string.</li></ul></td></tr></tbody></table>

### Return value

A cleaned text string with:

* No leading or trailing whitespace.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">TRIM(" Senatus Populusque Romanus ")
</code></pre></td><td>Removes leading and trailing spaces from a literal string.</td><td><code>"Senatus Populusque Romanus"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">TRIM([ADDRESS])
</code></pre></td><td>Removes leading and trailing spaces from <code>[ADDRESS]</code> per row.</td><td>Varies by row (e.g., <code>" 123 Main St "</code> → <code>"123 Main St"</code>).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">TRIM(MOCK_ADDRESS)
</code></pre></td><td>Trims whitespace from a generated address.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">TRIM(CONCATENATE([FIRSTNAME], " ", [LASTNAME]))
</code></pre></td><td>Concatenates first and last name and trims the result.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">LOWER(TRIM([EMAIL]))
</code></pre></td><td>Trims <code>[EMAIL]</code> first, then lowercases it.</td><td>Varies by row.</td></tr></tbody></table>

## TRUE

The `TRUE` function returns the logical value `TRUE`. Use this function to return `TRUE` based on a condition.

For example:

* `IF(2=2,TRUE(), FALSE())` returns `TRUE` if the value 2 is equal to 2.

You can also enter the value `TRUE` directly into formulas without using the function.

For example:

* `IF(2=2,TRUE, FALSE)` also returns `TRUE` if the condition is met.

If the condition is not met, both examples return `FALSE`.

### Syntax

```dax
TRUE()
```

#### Parameters <a href="#parameters" id="parameters"></a>

The `TRUE` function does not require any arguments.

### Return value

The logical value that is set to TRUE.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">IF(2 = 2, TRUE, FALSE)
</code></pre></td><td>Returns <code>TRUE</code> because the condition is always true.</td><td><code>TRUE</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">TRUE()
</code></pre></td><td>Returns the logical value <code>TRUE</code>.</td><td><code>TRUE</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF([IS_ACTIVE] = 1, TRUE(), FALSE())
</code></pre></td><td>Returns <code>TRUE</code> when <code>[IS_ACTIVE]</code> equals <code>1</code>; otherwise <code>FALSE</code>.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">AND(TRUE(), [IS_ACTIVE] = 1)
</code></pre></td><td>Shows that <code>AND</code> with <code>TRUE()</code> behaves like the other condition.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(TRUE(), MOCK_FIRST_NAME, MOCK_LAST_NAME)
</code></pre></td><td>Always returns the <code>then</code> branch because the condition is always true.</td><td>Varies by row.</td></tr></tbody></table>

## UPPER

The `UPPER` function converts text to uppercase.

### Syntax

```dax
UPPER("text")
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>"text"</td><td>The text, column or mocker you want to convert to uppercase. This can be a reference or a text string.</td></tr></tbody></table>

### Return value

The text that is converted to uppercase.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">UPPER("hello world!")
</code></pre></td><td>Converts a literal string to uppercase.</td><td><code>"HELLO WORLD!"</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">UPPER([ADDRESS])
</code></pre></td><td>Converts <code>[ADDRESS]</code> to uppercase per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">UPPER(MOCK_COMPANY_EMAIL)
</code></pre></td><td>Converts a generated company email to uppercase.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">UPPER(LOWER([EMAIL]))
</code></pre></td><td>Normalizes <code>[EMAIL]</code> by lowercasing first, then uppercasing.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">CONCATENATE(UPPER([STATE]), "-", RIGHT(CONCATENATE("00000", [ZIP]), 5))
</code></pre></td><td>Builds <code>"STATE-#####"</code> from state and a left-padded ZIP.</td><td>Varies by row (e.g., <code>"MASSACHUSETTS-02134"</code>).</td></tr></tbody></table>

## VAR

The `VAR` function calculates the variance based on a sample of a population.

* `VAR` assumes that its arguments represent a sample of the population. If your data represents the entire population, use the `VARP` function instead.
* Arguments can be numbers, names, arrays, or values that contain numbers.
* Logical values and text representations of numbers entered directly into the argument list are included in the calculation.
* If an argument is an array, only the numbers within that array are considered; empty values, logical values, text, or error values in the array are ignored.
* Arguments that contain error values or text that cannot be converted into numbers will cause the function to return an error.
* If you want to include logical values and text representations of numbers in the calculation, use the `VARA` function.

### Syntax

```dataweave
VAR(value1, value2, ... value30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value1</td><td>The first number, column or mocker corresponding to a sample of a population.</td></tr><tr><td>value2, ... value30</td><td>Additional arguments corresponding to a sample of a population, up to 30 total arguments.</td></tr></tbody></table>

### Return value

Variance of a sample.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">VAR(10, 22, 45, 65, 6, 63, 23, 89, 46, 54)
</code></pre></td><td>Computes the sample variance of the provided literal values.</td><td><code>~714.23</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COVERED_ENCOUNTERS], [COVERED_PROCEDURES])
</code></pre></td><td>Computes the sample variance across multiple numeric columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR([AMOUNT_COVERED], 0, 100, 250)
</code></pre></td><td>Computes the sample variance of a row value combined with constants.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(VAR([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COPAY_AMOUNT]), 2)
</code></pre></td><td>Computes sample variance across three columns, then rounds to 2 decimals.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">SQRT(VAR(10, 20, 30, 40, 50))
</code></pre></td><td>Computes the square root of the sample variance (i.e., sample standard deviation) of the provided values.</td><td><code>~15.811</code></td></tr></tbody></table>

## VAR.P

The `VAR.P` function calculates the variance based on the entire population, ignoring logical values and text.

* `VAR.P` assumes that its arguments represent the entire population. If your data represents only a sample of the population, use the `VAR.S` function instead.
* Arguments can include numbers, names, arrays, or values that contain numbers.
* Logical values and text representations of numbers entered directly into the argument list are included in the calculation.
* If an argument is an array, only the numbers within that array are considered; empty values, logical values, text, or error values are ignored.
* Arguments that contain error values or text that cannot be converted into numbers will cause the function to return an error.
* If you want to include logical values and text representations of numbers in the calculation, use the `VARPA` function.

### Syntax

```dax
VAR.P(value1, value2, ... value30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value1</td><td>The first number, column or mocker corresponding to the population.</td></tr><tr><td>value1, value2, ... value30</td><td>Additional arguments corresponding to the population, up to 30 total arguments.</td></tr></tbody></table>

### Return value

Variance of a population.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">VAR.P(10, 22, 45, 65, 6, 63, 23, 89, 46, 54)
</code></pre></td><td>Computes the population variance of the provided literal values.</td><td><code>~642.81</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.P([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COVERED_ENCOUNTERS], [COVERED_PROCEDURES])
</code></pre></td><td>Computes the population variance across multiple numeric columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.P([AMOUNT_COVERED], [AMOUNT_UNCOVERED])
</code></pre></td><td>Computes the population variance across two columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.P([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COPAY_AMOUNT])
</code></pre></td><td>Computes the population variance across three columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(VAR.P(10, 22, 45, 65, 6), 2)
</code></pre></td><td>Computes population variance, then rounds to 2 decimals.</td><td><code>497.84</code></td></tr></tbody></table>

## VAR.S

The `VAR.S` function estimates variance based on a sample, ignoring logical values and text.

* `VAR.S` assumes that its arguments represent a sample of the population. If your data represents the entire population, use the `VAR.P` function instead.
* Arguments can include numbers, names, arrays, or values that contain numbers.
* Logical values and text representations of numbers entered directly into the argument list are included in the calculation.
* If an argument is an array, only the numbers within that array are considered; empty values, logical values, text, or error values are ignored.
* Arguments that contain error values or text that cannot be converted into numbers will cause the function to return an error.
* If you want to include logical values and text representations of numbers in the calculation, use the `VARA` function.

### Syntax

```dax
VAR.S(value1, value2, ... value30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value1</td><td>The first number, column or mocker corresponding to a sample of the population.</td></tr><tr><td>value2, ... value30</td><td>Additional arguments corresponding to a sample of the population, up to 30 total arguments.</td></tr></tbody></table>

### Return value

Variance of a sample.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">VAR.S(10, 22, 45, 65, 6, 63, 23, 89, 46, 54)
</code></pre></td><td>Computes the sample variance of the provided literal values.</td><td><code>~714.23</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.S([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COVERED_ENCOUNTERS], [COVERED_PROCEDURES])
</code></pre></td><td>Computes the sample variance across multiple numeric columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.S([HEALTHCARE_EXPENSES], [HEALTHCARE_COVERAGE], [COPAY_AMOUNT])
</code></pre></td><td>Computes the sample variance across three columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VAR.S([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COPAY_AMOUNT], 0)
</code></pre></td><td>Computes the sample variance across three columns plus a constant <code>0</code> for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(VAR.S(10, 22, 45, 65, 6), 2)
</code></pre></td><td>Computes sample variance, then rounds to 2 decimals.</td><td><code>622.30</code></td></tr></tbody></table>

## VARA

The `VARA` function estimates variance based on a sample, considering numbers, text representations of numbers, and logical values.

* `VARA` assumes that its arguments represent a sample of the population. If your data represents the entire population, use the `VARPA` function instead.
* Arguments can include numbers, names, arrays, text representations of numbers, or logical values such as `TRUE` and `FALSE`.
* Logical values and text representations of numbers entered directly into the argument list are included in the calculation.
  * Arguments containing `TRUE` evaluate as 1.
  * Arguments containing text or `FALSE` evaluate as 0.
* If an argument is an array, only the values within that array are considered. Empty values and text within the array are ignored.
* Arguments that contain error values or text that cannot be converted into numbers will cause the function to return an error.
* If you do not want to include logical values and text representations of numbers in the calculation, use the `VAR` function.

### Syntax

```dataweave
VARA(value1, value2, ... value30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value1, value2, ... value30</td><td><code>value1</code> is required, and subsequent values are optional. You can provide 1 to 30 values corresponding to a sample of the population.</td></tr></tbody></table>

### Return value

Variance of a sample.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">VARA(10, 22, 45, 65, 6, 63, 23, 89, 46, 54)
</code></pre></td><td>Computes sample variance, including any logical/text values (none in this example).</td><td><code>~714.23</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARA([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COVERED_ENCOUNTERS], [COVERED_PROCEDURES])
</code></pre></td><td>Computes sample variance across multiple columns for each row, including any logical/text values.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARA(TRUE, FALSE, 10, "7")
</code></pre></td><td>Computes sample variance including booleans and text numbers (<code>TRUE=1</code>, <code>FALSE=0</code>, <code>"7"=7</code>).</td><td><code>23</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARA(TRUE, FALSE, [FLAG_A], [FLAG_B], [FLAG_C])
</code></pre></td><td>Computes sample variance including booleans and per-row flag columns.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(VARA(10, 20, 30, TRUE, "7"), 2)
</code></pre></td><td>Computes <code>VARA</code> including booleans/text, then rounds to 2 decimals.</td><td><code>131.30</code></td></tr></tbody></table>

## VARP

The `VARP` function calculates the variance based on the entire population.

* `VARP` assumes that its arguments represent the entire population. If your data represents a sample of the population, use the `VAR` function instead.
* Arguments can include numbers, names, arrays, or values that contain numbers.
* Logical values and text representations of numbers entered directly into the argument list are included in the calculation.
* If an argument is an array, only the numbers within that array are considered; empty values, logical values, text, or error values in the array are ignored.
* Arguments that contain error values or text that cannot be converted into numbers will cause the function to return an error.
* If you want to include logical values and text representations of numbers in the calculation, use the `VARPA` function.

### Syntax

```dataweave
VARP(value1, value2, ... value30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>value1</td><td>The first number, column or mocker corresponding to the population.</td></tr><tr><td>value2, ... value30</td><td>Additional arguments corresponding to the population, up to 30 total arguments.</td></tr></tbody></table>

### Return value

Variance of a population.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">VARP(10, 22, 45, 65, 6, 63, 23, 89, 46, 54)
</code></pre></td><td>Computes the population variance of the provided literal values.</td><td><code>~642.81</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARP([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COVERED_ENCOUNTERS], [COVERED_PROCEDURES])
</code></pre></td><td>Computes the population variance across multiple numeric columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARP([AMOUNT_COVERED], [AMOUNT_UNCOVERED])
</code></pre></td><td>Computes the population variance across two columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">VARP([AMOUNT_COVERED], [AMOUNT_UNCOVERED], [COPAY_AMOUNT])
</code></pre></td><td>Computes the population variance across three columns for each row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">ROUND(VARP(10, 22, 45, 65, 6), 2)
</code></pre></td><td>Computes population variance, then rounds to 2 decimals.</td><td><code>497.84</code></td></tr></tbody></table>

## WEEKNUM

The `WEEKNUM` function returns the week number of a specific date. For example, the week containing January 1 is considered the first week of the year and is numbered as week 1.

### Syntax

```dax
WEEKNUM(date, [return_type])
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td>A date, column or mocker within the week you want to identify. Dates should be entered using the <code>DATE</code> function or as the result of other formulas or functions. Entering dates as text may cause errors.</td></tr><tr><td>[return_type]</td><td>A number that determines which day of the week the week starts on. The default value is 1 (where Sunday is the first day of the week).</td></tr></tbody></table>

### Return value

The week number in the year.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">WEEKNUM("24/8/2012")
</code></pre></td><td>Returns the week number for a literal date string.</td><td>A week number (locale dependent).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">WEEKNUM([BIRTHDATE])
</code></pre></td><td>Returns the week number for <code>[BIRTHDATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">WEEKNUM(DATE(2024, 1, 1), 2)
</code></pre></td><td>Returns the week number for Jan 1, 2024 with Monday as the week start (<code>return_type=2</code>).</td><td><code>1</code> (depending on week-numbering rules).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">WEEKNUM(TODAY())
</code></pre></td><td>Returns the current week number.</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">WEEKNUM(DATEADD([ORDER_DATE], 7, "day"), 2)
</code></pre></td><td>Shifts <code>[ORDER_DATE]</code> by 7 days, then returns week number with Monday as week start.</td><td>Varies by row.</td></tr></tbody></table>

## XOR

The `XOR` function returns a logical Exclusive Or (XOR) of all the provided arguments.

* The arguments must evaluate to logical values such as `TRUE` or `FALSE`, or be in arrays or references that contain logical values.
* If an array or reference argument contains text or empty cells, those values are ignored.
* If the specified range contains no logical values, `XOR` returns the `#VALUE!` error.
* You can use an XOR array formula to check if a value occurs in an array.
* The result of `XOR` is `TRUE` when the number of `TRUE` inputs is odd and `FALSE` when the number of `TRUE` inputs is even.

### Syntax

```dataweave
XOR(Logicalvalue1, Logicalvalue2 ... Logicalvalue30)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Logicalvalue1, Logicalvalue2 ... Logicalvalue30</td><td><code>Logical1</code> is required, and subsequent logical values are optional. You can provide 1 to 30 conditions to test, which can be either <code>TRUE</code> or <code>FALSE</code>, and can include logical values, arrays, or references.</td></tr></tbody></table>

### Return value

TRUE if an odd number of arguments evaluates to TRUE.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">XOR([GENDER] = "M", [HEALTHCARE_COVERAGE] &#x3C; 250, [HEALTHCARE_EXPENSES] > 1000)
</code></pre></td><td>Returns <code>TRUE</code> when an odd number of conditions are true.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">XOR(TRUE, FALSE)
</code></pre></td><td>Computes XOR for two literal booleans.</td><td><code>TRUE</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">XOR([FLAG_A] = 1, [FLAG_B] = 1, [FLAG_C] = 1, [FLAG_D] = 1)
</code></pre></td><td>Returns <code>TRUE</code> when 1 or 3 of the flags are true.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(XOR([FLAG_A] = 1, [FLAG_B] = 1), "exactly_one", "zero_or_two")
</code></pre></td><td>Labels rows where exactly one of two flags is set.</td><td>Either <code>"exactly_one"</code> or <code>"zero_or_two"</code> per row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">XOR(AND([A] = 1, [B] = 1), OR([C] = 1, [D] = 1))
</code></pre></td><td>Computes XOR of two composite logical expressions.</td><td><code>TRUE</code> or <code>FALSE</code> per row.</td></tr></tbody></table>

## YEAR

The `YEAR` function returns the year corresponding to a given date as an integer between 1900 and 9999. The values returned by the `YEAR`, `MONTH`, and `DAY` functions will be Gregorian values, regardless of the display format for the supplied date.

### Syntax

```dax
YEAR(number)
```

#### Parameters <a href="#parameters" id="parameters"></a>

<table><thead><tr><th width="208">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>number</td><td>The date, column or mocker for which you want to extract the year. Dates should be entered using the <code>DATE</code> function or as the result of other formulas or functions. Entering dates as text may cause errors.</td></tr></tbody></table>

### Return value

The year as a number according to the internal calculation rules.

### Examples <a href="#example---shifting-a-set-of-dates" id="example---shifting-a-set-of-dates"></a>

<table><thead><tr><th width="360">Formula</th><th>Description</th><th>Result</th></tr></thead><tbody><tr><td><pre class="language-dax"><code class="lang-dax">YEAR("24/8/2012")
</code></pre></td><td>Extracts the year from a literal date string.</td><td><code>2012</code> (locale dependent).</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">YEAR([BIRTHDATE])
</code></pre></td><td>Extracts the year from <code>[BIRTHDATE]</code> per row.</td><td>Varies by row.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">YEAR(DATE(2024, 12, 31))
</code></pre></td><td>Extracts the year from a constructed date.</td><td><code>2024</code></td></tr><tr><td><pre class="language-dax"><code class="lang-dax">YEAR(TODAY())
</code></pre></td><td>Extracts the current year.</td><td>Varies by run date.</td></tr><tr><td><pre class="language-dax"><code class="lang-dax">IF(YEAR([ORDER_DATE]) &#x3C; 2000, "legacy", "modern")
</code></pre></td><td>Labels orders before 2000 as legacy.</td><td>Either <code>"legacy"</code> or <code>"modern"</code> per row.</td></tr></tbody></table>

{% hint style="info" %}
**Info:** The below functions are planned to be introduced in the future releases of Syntho.
{% endhint %}

### Planned Functions for future releases

| Function   | Description                                                                                                                     | Format                                 |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| STDEV      | Returns standard deviation of a sample. When used with column names, the value is calculated anew for each row.                 | STDEV(Value1, Value2, ... Value30)     |
| STDEV.P    | Returns standard deviation of a population. When used with column names, the value is calculated anew for each row.             | STDEV.P(Value1, Value2, ... Value30)   |
| STDEV.S    | Returns standard deviation of a sample. When used with column names, the value is calculated anew for each row.                 | STDEV.S(Value1, Value2, ... Value30)   |
| STDEVA     | Returns standard deviation of a sample. When used with column names, the value is calculated anew for each row.                 | STDEVA(Value1, Value2, ... Value30)    |
| STDEVP     | Returns standard deviation of a population. When used with column names, the value is calculated anew for each row.             | STDEVP(Value1, Value2, ... Value30)    |
| STDEVPA    | Returns standard deviation of a population. When used with column names, the value is calculated anew for each row.             | STDEVPA(Value1, Value2, ... Value30)   |
| MAX        | Returns the maximum value in a list of arguments. When used with column names, the value is calculated anew for each row.       | MAX(Number1, Number2, ... Number30)    |
| MAXA       | Returns the maximum value in a list of arguments. When used with column names, the value is calculated anew for each row.       | MAXA(Value1, Value2, ... Value30)      |
| MEDIAN     | Returns the median of a set of numbers. When used with column names, the value is calculated anew for each row.                 | MEDIAN(Number1, Number2, ... Number30) |
| MIN        | Returns the minimum value in a list of arguments. When used with column names, the value is calculated anew for each row.       | MIN(Number1, Number2, ... Number30)    |
| MINA       | Returns the minimum value in a list of arguments. When used with column names, the value is calculated anew for each row.       | MINA(Value1, Value2, ... Value30)      |
| COUNT      | Counts how many numbers are in the list of arguments.                                                                           | COUNT(Value1, Value2, ... Value30)     |
| COUNTA     | Counts how many values are in the list of arguments.                                                                            | COUNTA(Value1, Value2, ... Value30)    |
| COUNTBLANK | Returns the number of empty cells.                                                                                              | COUNTBLANK(Range)                      |
| IFNA       | Returns the value if the cell does not contain the #N/A (value not available) error value, or the alternative value if it does. | IFNA(Value, Alternate\_value)          |
