How to use features when predicting aggregation? Let's say I have to predict the total monthly sales of a store. I have the data in the following format:


I don't think I can use this data directly for predicting the sales for a month, as in it's current form there is no target variable present to predict. We would have to sum the sales for each month and only then will we get our target variable (the sales that we want to predict).

Please see when I group the sales by month (Jan and Feb):



Now the above is data I can use with ml algos to predict the Total_Sale which is my target variable. But, since now I have grouped the sale by month, I have lost all the features like Gender, Age, Product etc... I cannot explain these features and see their impact on the sale.

Is there any way around this?

Thanks
You can pass the entire month's data as a single sample, which should predict the sales of that month. It would look like an index with multiple indexes. Something like MultiIndex in python's Pandas library.

Another idea would be to still try predicting the sales every day, then just sum up all predictions at the end to create your monthly aggregation.

Using something like a neural network may be overkill - it depends how much data you have - but will offer the flexibility to easily train a model with multiple inputs and a single output, as is your case.