How to get all products sales data?

I’m trying to get all products sold within 30 days. Having to query all orders and loop through counting all products is extremely inefficient and slow. I see references from several years ago on here to an “n_day_sales” but that does not exist in the api documentation. Is there a more efficient way to do this?