<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSDerivedAttributeDescription/derivationExpression",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDerivedAttributeDescription(py)derivationExpression"
  },
  "title" : "derivationExpression"
}
-->

# derivationExpression

An expression for generating derived data.

```
var derivationExpression: NSExpression? { get set }
```

## Discussion

When using derived attributes in an SQL store, this expression should be

- a keypath expression (including @operation components)

a function expression using one of the predefined functions defined in <doc://com.apple.documentation/documentation/Foundation/NSExpression>

Any keypaths used in the expression must be accessible from the entity on which the derived attribute is specified.

If you try to add a store to a coordinator whose model contains derived attributes of a type not supported by the store, the add fails and throws an error.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)