I have a list of dates and correspond to that is the number of sales per month. So What I want is instead of dates I want is to filter out by month.
This is my input
["2019-01-01", "900"],
["2019-01-01", "150"],
["2019-01-01", "150"],
["2019-01-01", "450"],
["2019-01-01", "180"],
["2019-01-01", "240"],
["2019-01-01", "300"],
The output I want is:-
["2019-01-01 to 2019-01-31", "total sale of this month only"],
["2019-02-01 to 2019-02-28", "total sale of this month only"],
Now what I want is to list the array not only of a particular date and the sale on that day. I want to something like above which will give me the month and sale of that month.
month_sales = record
|> Enum.filter(fn
["Date" | _ ] -> false
_ -> true
end)
|> Enum.map(fn [head | tail ]-> [head, Enum.reduce(Enum.take(tail, -1), fn price, acc ->
acc + price
end)] end)
|> IO.inspect()
- So first I want to list this not by date but by month.
Help me If anyone knows about this