Given sales data from multiple shops, what is the best way to determine profitability of a shop with inconsistent sales times

I have a dataset of sales data (individual sales from multiple shops in an area, date sale was made on given) from multiple shops (denoted by the field shop_number). I calculated a field for profit (units_sold*[retail_price - product_cost]).

To get the profit made by the shops, I grouped the data by shop_number and summed up the profit.

However, some shops have sales within the entire timeframe, while some within a subset of that timeframe.

Should I divide the profit by #sales. If I could assume that the shops with sales only within a subset didn't make any other sales during any other timeframes, then summing the profit would be sufficient.

If you don't want to do pairwise comparisons like that, there's also the option of splitting the time periods into some intervals and then fitting, say, a linear mixed effects model for profit that has a fixed effect for shop, a random effect for each time interval (let's say week is a sensible unit) and perhaps some other factors (depends, see below, also time trends, seasonality etc.). E.g. in R this could look like lmer(profit ~ (1|week) + shop) (using the lmer function from the lme4 package, this assumes a data structure with one record per shop per week giving the profit for that week in that shop). This is a bit too simplistic, e.g. it ignores that adjacent weeks are presumably correlated, but may give you a reasonable way to get some kind of impression of what's going on once one adjusts for what times shops were open in.