Your solution is not correct. Note how the output table wants you to have a row for each day that the item was sold, and then a row with the total for each month it was sold, and then a row for each year that it was sold, and then a row for the total overall sales of the item... and then you have to have all of those rows for each item. That's why the expected solution is so much longer than the one your query generates. Your query is not correct.
Your solution is not correct. Note how the output table wants you to have a row for each day that the item was sold, and then a row with the total for each month it was sold, and then a row for each year that it was sold, and then a row for the total overall sales of the item... and then you have to have all of those rows for each item. That's why the expected solution is so much longer than the one your query generates. Your query is not correct.
This comment is hidden because it contains spoiler information about the solution