You zoomed in on a quarter, which is not a good way to look at it. From an annual standpoint, they have been profitable for each of the last 4 years, excluding 2015. 2015 Included a massive impairment of goodwill (which is not a cash expense) at $4.4B[0] and would have otherwise been profitable.
Yahoo announced falling revenues and a quarterly loss of $99.2m on Tuesday - from April 19, 2016