Forum Discussion
Adding up with SUMX mesure
Hi everybody. I have a problem whith the ading up in a sumx mesure whit a filter. I hope someone here could healp me to solv this issue.
Here we go:
I have a db with the Acomulative Inventory by each SKU. I have to take out the inventory at the last date of the pivote table filter.
This is te data:
| N° Sequencia | Date | mov tipo | MODEL | SKU | Mov | Stock Ac. |
| 1 | 25-05-2018 | BUY | Leter | A | 5 | 5 |
| 2 | 26-05-2018 | BUY | Leter | B | 6 | 6 |
| 3 | 26-05-2018 | BUY | Leter | C | 7 | 7 |
| 4 | 26-05-2018 | BUY | Leter | D | 7 | 7 |
| 5 | 27-05-2018 | SALE | Leter | A | -1 | 6 |
| 6 | 28-05-2018 | SALE | Leter | A | -1 | 4 |
| 7 | 29-05-2018 | SALE | Leter | C | -1 | 6 |
| 8 | 01-06-2018 | SALE | Leter | A | -1 | 3 |
| 9 | 01-06-2018 | SALE | Leter | A | -1 | 2 |
| 10 | 02-06-2018 | SALE | Leter | B | -2 | 4 |
| 11 | 02-06-2018 | SALE | Leter | D | -1 | 6 |
| 12 | 05-06-2018 | SALE | Leter | C | -3 | 3 |
| 13 | 07-08-2018 | SALE | Leter | B | -1 | 3 |
| 14 | 07-08-2018 | SALE | Leter | C | -1 | 2 |
| 15 | 10-06-2018 | SALE | Leter | D | -2 | 4 |
| 16 | 10-06-2018 | SALE | Leter | D | -1 | 3 |
| 17 | 10-06-2018 | BUY | Leter | B | 1 | 4 |
| 18 | 11-06-2018 | VALUE | Leter | D | 0 | 3 |
| 19 | 12-06-2018 | SALE | Leter | D | -2 | 1 |
This is the pivot table:
| Date | MODEL | SKU | Stock Ac. |
| Mayo | leter | A | 4 |
| B | 6 | ||
| C | 7 | ||
| D | 7 | ||
| TOTAL | 7 | ||
| Junio | leter | A | 2 |
| B | 4 | ||
| C | 3 | ||
| D | 1 | ||
| TOTAL | 4 | ||
| Agosto | leter | B | 3 |
| C | 2 | ||
| TOTAL | 3 | ||
| Total general | 7 |
The mesure of "Stock Ac" is:
=SUMX(FILTER(Table1,Table1[N° Sequencia]=MAX(Table1[N° Sequencia])),Table1[Stock Ac.])
Its gives to me the correct record by row, but the add up it's wrong. How can i get the correct subtotal and grand total?
I´tried with this other measure
=SUMX(FILTER(Table1,Table1[N° Sequencia]=MAX(Table1[N° Sequencia])),SUM(Table1[Stock Ac.]))
But this is wrong in the record by row and also in the adding up.
1 Reply
- Greg_DecklerCommunity Champion
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907