Generally speaking, you'd want to align your response codes with what users are expecting.
The 200 response is generally used as an OK response.
As per mdn web docs:
The request succeeded. The result meaning of "success" depends on the
HTTP method.
- GET: The resource has been fetched and transmitted in the message body.
- HEAD: The representation headers are included in the response without any message body.
- PUT or POST: The resource describing the result of the action is transmitted in the message body.
- TRACE: The message body contains the request message as received by the server.
This information is based on RFC 7231
In your situation, using a 404 Not Found response could lead the developer to think the resource does not exist.
A 200 OK is an appropriate response as the HTTP call was successful and you can provide a "no content found" message.
A 204 No Content would work as well but the request should be terminated after the header, thus you're not passing a message.
For your second scenario, since the request is erroneous, you should go for a 4XX or 5XX of your choice. A 400 Bad Request is a possibility as:
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status
code indicates that the server cannot or will not process the request
due to something that is perceived to be a client error (for example,
malformed request syntax, invalid request message framing, or
deceptive request routing).
Edit: A 2XX response can be considered if the "Not enough data to calculate yearly average salary" message is displayed client side, however since you'd require more data to complete the calculation, a 4XX or 5XX would be more correct.