NET LOSS PER SHARE - Computation of Basic and Diluted Net Loss Per Share (Details) - USD ($) $ / shares in Units, $ in Thousands |
3 Months Ended | 6 Months Ended | ||
|---|---|---|---|---|
Jan. 31, 2017 |
Jan. 31, 2016 |
Jan. 31, 2017 |
Jan. 31, 2016 |
|
| Earnings Per Share [Abstract] | ||||
| Net loss | $ (93,212) | $ (33,205) | $ (255,381) | $ (71,750) |
| Weighted-average shares used in computing net loss per share attributable to common stockholders—basic and diluted (in shares) | 141,996,600 | 43,666,825 | 108,185,194 | 43,252,879 |
| Net loss per share attributable to common stockholders—basic and diluted (in dollars per share) | $ (0.66) | $ (0.76) | $ (2.36) | $ (1.66) |