I have a simple pivot table, but I'm using Calculated Field values.
The raw data used for the pivot table is like a transaction log, as shown below:
DATE | STOCK | QTY | PRICE | TOTAL---------------------------------------03/2023 | AAPL | 1 | 100 | 10003/2023 | AAPL | 2 | 120 | 24003/2023 | GOOG | 2 | 60 | 12003/2023 | GOOG | 3 | 80 | 240The sheet also has the current price of a ticker with the GOOGLEFINANCE(..) function, as shown below:
TICKER | PRICE---------------- AAPL | 158.28 GOOG | 103.06The pivot table groups the transactions by the ticker name, sums up the TOTAL per transaction QTY * PRICE, and shows the current value QTY * 'CURRENT PRICE'. The current price is a lookup to the current price table expressed as =VLOOKUP(STOCK,$K$7:$L$10,2, FALSE)*SUM(QTY) in the pivot table as a calculated field.
However, the Grand Total of the CURR POSITION column shows a wrong value. It shows $3,044.75 instead of $1,150.88. It should sum the VLOOKUP value, but it shows a different value.
How can I fix this?
Sample sheet for better visualization here
And prints bellow:

