@xhaixia,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
We evaluated your issue further.
Well, you should refresh data first, and then calculate the data. By the way, if you will call the PivotTable.calculateData() method, you don’t need to call the PivotTable.calculateRange() method for performance. This is due to the fact that we have implemented the logic of calculating range in the PivotTable.CalculateData() method already.
So, for your issue, please change the following code:
i.e.,