---
schema_version: "1"
id: ad053fe15504d5fd527cd0ca032e6048b32a21f4d72c710cac164c9f50d0612d
title: Multivalue Field
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/concept/bi-saql-multivalue.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-multivalue.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e6d4be41a5d4d535f01244c0911a877b4d088975a47dbb6b89add1ef515c6872
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# Multivalue Field

A multivalue field contains more than one value.

## Example

One typical use case for multivalue fields is security. For example, you can have a dataset that contains various accounts, and each account has multiple owner IDs. We’ve created a sample dataset called OppRoles where `OwnerId` is a multivalue field.

| Account ID         | Amount    | Owner.Name      | Opportunity ID     | Owner ID                                                                      | Stage      |
| ------------------ | --------- | --------------- | ------------------ | ----------------------------------------------------------------------------- | ---------- |
| 001R00000046CHdIAM | 1,900,013 | Emily Dickinson | 006R0000002OF6eIAG | 005R0000000VU9bIAG, 005R0000000VU9bIAH, 005R0000000VU9bIAI                    | Closed Won |
| 001R00000046CV6IAM | 70,449    | Albert Einstein | 006R0000002OF6eIAG | 005R0000000VU9UIAW, 005R0000000VU9bIAG, 005R0000000VU9UIAX 005R0000000VU9UIAY | Closed Won |
| 001R00000046CI6IAM | 4,206,995 | Indiana Jones   | 006R0000002OF6eIAG | 006R0000002OF6gIAG, 005R0000000VU9RIAW, 005R0000000VU9SIAW                    | Closed Won |

This query filters on an `OwnerId` to display only the accounts that it can access.

```nolang
q = load "OppRoles";
q = filter q by 'OwnerId' in ["005R0000000VU9bIAG"];
q = foreach q generate 'AccountId' as 'AccountId', 'Amount' as 'Amount', 'Id' as 'Id', 'Owner.Name' as 'Owner.Name', 'OwnerId' as 'OwnerId', 'StageName' as 'StageName';
```

**note:** When using comparison operators in the filter, use `in` and `not in` to return the correct values. Using `==` and `!=` returns unexpected values when null handling is enabled. See [`Group-by` with Null Values](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-groupby.md) for more information.

| Account ID         | Amount    | Owner.Name      | Opportunity ID     | Owner ID           | Stage      |
| ------------------ | --------- | --------------- | ------------------ | ------------------ | ---------- |
| 001R00000046CHdIAM | 1,900,013 | Emily Dickinson | 006R0000002OF6eIAG | 005R0000000VU9bIAG | Closed Won |
| 001R00000046CV6IAM | 70,449    | Albert Einstein | 006R0000002OF6eIAG | 005R0000000VU9bIAG | Closed Won |

The `OwnerID` value `005R0000000VU9bIAG` has access to two of the three accounts, so two of the accounts are displayed.

**important:** Limit multivalue field use to filtering only. Multivalue fields can behave unpredictably with `group` and `foreach`.

**See Also**

- [mv_to_string()](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-functions-string-mts.md)
- [Comparison Operators](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-operators-comparison.md)
- [Limit Multivalue Fields](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-performance-multivalue-fields.md)
