---
title: asOf()
slug: asof
createdAt: 2022-11-02T17:51:01.000Z
---

Returns the result of a Carrot expression on a particular date using either only Primary data, or both Primary and Scenario based data.

### Syntax

**asOf** - Returns the result of a Carrot expression on a particular date using data from both Primary, and the Scenario that the function is used in.

`asOf( date: Date, expression:{CQL} )`

- `date` - The selected date.
- `expression` - The Carrot (CQL) expression.
- **Return type:&#x20;**&#x54;he data type result of the Carrot (CQL) expression.&#x20;

| **Code sample**                           | **Result**                                                                                                                 |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `asOf('2017-07-01', {performanceRating})` | Returns the value of `performanceRating` as of January 7th, 2022 using data on Primary and from proposed Scenario changes. |

***

**asOfPrimary** - Returns the result of a Carrot expression on a particular date using data from Primary.

`asOfPrimary( date: Date, expression:{CQL} )`

- `date` - The selected date.
- `expression` - The Carrot (CQL) expression.
- **Return type:&#x20;**&#x54;he data type result of the Carrot (CQL)  expression.&#x20;

| **Code sample**                                 | **Result**                                                                                                                                                  |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `asOfPrimary('2017-07-01', '2022-08-01", 2.5)`  | Returns the value of `performanceRating` as of January 7th, 2022, using **only the data on Primary.** Does not include data from proposed Scenario changes. |

