Forum Discussion

jamontes's avatar
jamontes
Regular Visitor
7 years ago

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° SequenciaDatemov tipoMODELSKUMovStock Ac.
125-05-2018BUYLeterA55
226-05-2018BUYLeterB66
326-05-2018BUYLeterC77
426-05-2018BUYLeterD77
527-05-2018SALELeterA-16
628-05-2018SALELeterA-14
729-05-2018SALELeterC-16
801-06-2018SALELeterA-13
901-06-2018SALELeterA-12
1002-06-2018SALELeterB-24
1102-06-2018SALELeterD-16
1205-06-2018SALELeterC-33
1307-08-2018SALELeterB-13
1407-08-2018SALELeterC-12
1510-06-2018SALELeterD-24
1610-06-2018SALELeterD-13
1710-06-2018BUYLeterB14
1811-06-2018VALUELeterD03
1912-06-2018SALELeterD-21

This is the pivot table:

 

DateMODELSKUStock Ac.
MayoleterA4
  B6
  C7
  D7
 TOTAL 7
JunioleterA2
  B4
  C3
  D1
 TOTAL 4
AgostoleterB3
  C2
 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.