Negative total in Sales Analytics Report

For a customer who has a sales return in a particular year the sales analytics report shows negative total for that year instead of actual sales.

Example:
In year 2021 Customer XYZ has a sale of $200. Sales analytics shows it as $200 for year 2021.
In Year 2022 Customer XYZ has
1. Sale of $30
2. Sales return of $100 linked to the invoice from the year 2021.
So the sales analytics report shows the total sales of 2022 as -$70.

I believe it should be showing as $30 instead of -$70.
Any thoughts on this would be appreciated.

My actual case scenario is as below

Sales return will show up in the year based on its Posting Date, wherever you link it to. So if your posting date of sales return is in 2021, it will show up in 2021 and if it is in 2022, it will show up in 2022.

However, it will show a negative value when return is higher than sales amount itself!

Mathematically,
$30 - $100 is -$70, not $30

So your report is showing up correctly.

Yes. Mathematically it is correct. But what is the point of having a sales report if does not show what actually is the sales of that particular customer for that year irrespective of sales return.

You are right, if the sales return is of a past invoice, the return value should affect that period only. And inventory should affect current period.

But then there could be lot of accounting complications. If you have closed the accounts and filed your reports for the last year, any changes to it is not really the right way. The returns you file with the authorities will not match your ERP.

However, If you want the sales return to show up for any other period, just post the sales return on a date during that period. In your case, just post the sales return in the year 2021 rather than in 2022. Anyhow that again would be a wrong practice from an accounting perspective.

Alternatively you can pass journal entry to a different ledger, say, “Sales Returns” and play with the values how you like it. So that your original Sales register is not affected.

As you have rightly pointed out that we cannot change the sales return date as the previous year accounting period is closed and this is never possible.

My whole point is why cant we just have a sales report that can differentiate between sales invoice and sales returns. Just show them in two separate columns or some other possible way of doing it where the total amount reflected is just of only the sales invoices without sales returns invoices.

I am not sure, it is probably taking in data from Sales ledger. If that is the case, while entering a sales return, you could route it to a different ledger and these values will not show up in Sales Analytics. Maybe you could try, I am not too sure:

As a feature addition, It would also be good to have in the company settings to set a “Default Sales Return Ledger”.

If you feel this is a very much wanted feature, you can do a feature request.
https://github.com/frappe/erpnext/issues/new/choose