I'm having to hack a report together to pull data from another field in the same table. The row selection is going to be based on various elements in the above 'foreignkey' field - elements 1, 2, 4 & ...
creation_date_utc between '2023-08-20 00:00:00' and '2023-08-26 23:59:59' ...
select retailer, city, product, operating_profit, sales_method, case when operating_profit = 0 then 'No Profit' when operating_profit > 0 and operating_profit < 500 then 'marginal profit' when ...