Why do my Apple Health step samples add up to two or three times my real steps?
Because every device you carry records the same steps as its own samples: your Apple Watch, your iPhone, and a ring or another tracker if you wear one. A plain sum adds all of them; Apple Health's own daily total takes each stretch of time from one source, so use that total, never a sum of the raw samples.
This matters most for AI agents. An agent that is handed raw samples and asked "how many steps did I take on Tuesday?" will write SUM(value) and report a number two or three times too high.
A made-up day with three devices
Say you wear an Apple Watch and a smart ring, and carry your iPhone. On one Tuesday (an example, not anyone's real data):
| Source | Steps it recorded |
|---|---|
| Apple Watch | 9,420 |
| iPhone | 8,870 |
| Ring | 9,610 |
| Sum of all samples | 27,900 |
| Apple Health's daily total | 10,060 |
You walked about ten thousand steps, not 27,900. All three devices counted the same walks. With the Watch at the top of your step sources, Health's total, 10,060, is the Watch's count plus 640 steps the iPhone counted during the hour the Watch was on its charger.
How Health counts each step once
When several sources record the same type of data, Health ranks them. Apple's support page says that by default Health puts data you enter by hand first, then data from your iPhone, iPad and Apple Watch, then data from apps and Bluetooth devices, and that "the data source at the top will take priority over others" (Apple, Manage Health data, as of November 2026). You can change the order in the Health app, in a data type's Data Sources & Access.
So for each stretch of time, Health uses one source, and fills a gap from the next one down. The total the Health app shows is the result. The raw samples do not carry it: each sample only knows its own device.
The wrong query and the right one
With raw samples in a database, the natural query is wrong:
-- Wrong: adds the Watch, the iPhone and the ring together
SELECT round(sum(value)) AS steps
FROM samples
WHERE metric = 'StepCount' AND day = '2026-11-10';The right number is Health's own daily total. HealthSQL is an iPhone app and a command-line tool that copy your whole Apple Health record into a local SQLite database on your computer, so AI agents can query it with SQL or MCP. Its iPhone app asks Health for each day's total and stores it, so the daily view has it:
-- Right: Apple Health's own total for the day
SELECT day, steps FROM daily WHERE day = '2026-11-10';To see what each device recorded, group the raw samples by source. This is the right use of a sum: one source at a time.
SELECT source_name, round(sum(value)) AS steps
FROM samples
WHERE metric = 'StepCount' AND day = '2026-11-10'
GROUP BY source_name;Not only steps
The same holds for every type that more than one device records: walking and running distance, active energy, flights climbed, exercise minutes. And for sleep: a Watch and a ring can both record the same night. HealthSQL's nights view picks one source per night (the one with sleep stages), and nights_by_source shows each.
If you build your own pipeline
- Ask HealthKit for statistics (
HKStatisticsCollectionQuery) rather than summing samples when you need a daily number. That is how HealthSQL's phone app gets the totals the Health app shows, for every quantity type, every day; it writes them asdaylines (export format). - If you only have raw samples, do not sum across sources. Choose one source per stretch of time, the way Health does, or accept one device's count.
- Tell your agent the rule. HealthSQL's MCP server gives it to every agent that connects: use
dailyordaysfor any daily number, never a sum ofsamples.
An error like this hides in trends: weeks when you wore the ring look far more active than weeks when you did not. The fix is to ask for the number Health already computed.