<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKCumulativeQuantitySample",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKCumulativeQuantitySample"
  },
  "title" : "HKCumulativeQuantitySample"
}
-->

# HKCumulativeQuantitySample

A sample that represents a cumulative quantity.

```
class HKCumulativeQuantitySample
```

## Overview

A quantity sample contains one or more [`HKQuantity`](/documentation/HealthKit/HKQuantity) objects. Each quantity represents a single piece of data with a single numeric value and the value’s associated units. Use these samples to store data that accumulates over time, such as step count, active energy burned, or walking distance.

The [`HKCumulativeQuantitySample`](/documentation/HealthKit/HKCumulativeQuantitySample) class is a concrete subclass of the [`HKQuantitySample`](/documentation/HealthKit/HKQuantitySample) class. Cumulative quantity samples are immutable; you set the sample’s properties when you create it, and they cannot change.

### Extend Cumulative Quantity Samples

Like many HealthKit classes, you should not subclass the [`HKCumulativeQuantitySample`](/documentation/HealthKit/HKCumulativeQuantitySample) class. You may extend this class by adding metadata with custom keys to save related data used by your app.

For more information, see [`init(type:quantity:start:end:metadata:)`](/documentation/HealthKit/HKQuantitySample/init(type:quantity:start:end:metadata:)).

## Topics

### Accessing Calculated Data

[`sumQuantity`](/documentation/HealthKit/HKCumulativeQuantitySample/sumQuantity)

The sum of all the quantities contained by the sample.



---

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)