Supplemental information - schedule of redeemable non-controlling interest (Details) - USD ($) $ in Millions |
12 Months Ended | ||
|---|---|---|---|
Aug. 31, 2024 |
Aug. 31, 2023 |
Aug. 31, 2022 |
|
| Increase (Decrease) in Temporary Equity [Roll Forward] | |||
| Beginning balance | $ 167 | $ 1,042 | $ 319 |
| Recognition upon acquisition of subsidiary | 0 | 0 | 2,684 |
| Acquisitions of non-controlling interests | 0 | 0 | (2,047) |
| Net income (loss) attributable to Redeemable non-controlling interests | 1 | (21) | (73) |
| Redemption price adjustments | 6 | 460 | 159 |
| Reclassifications to accrued expenses and other liabilities | 0 | (1,314) | 0 |
| Ending balance | 174 | 167 | 1,042 |
| Conversion of Stock [Line Items] | |||
| Recognition upon acquisition of subsidiary | $ 0 | $ 0 | 2,684 |
| VillageMD | |||
| Increase (Decrease) in Temporary Equity [Roll Forward] | |||
| Recognition upon acquisition of subsidiary | 1,900 | ||
| Conversion of Stock [Line Items] | |||
| Recognition upon acquisition of subsidiary | $ 1,900 | ||
| McKesson Corporation, GEHE Pharma Handel | |||
| Conversion of Stock [Line Items] | |||
| Outstanding equity interest percentage | 30.00% | ||