# How to calculate % change in header total

How can i fix the % value in Total header. It actually just sums the % which is incorrect

Hi @RAHUL_singh1 and welcome to the community!

I would be interested to see the calculated field you are using to build the percent change field. If your earning is 100 and the difference in earnings is -25, that makes me think the previous earning was 125. If that is the case, you would want to run the calculation differently.

%Change = `({Earning}/({Earning}-{Difference in Earning}))-1`

Since your table is already partitioning your data, this should manage the percent by group and then show the total percent change rather than summing up the values for each group. I believe this would provide your expected output. Thank you!

Hi @duncan , Thanks for your response. Let me look try your solution.
correct pervious earning was 125. see below
I am using formula to calculate the %change from last period= {Difference in Earning}/Earning

Hi @duncan ,
No, it did not work. % Total change should be .23 (-70/300) , but I am getting .57

Any thought on above issue ?

Have you considered using the periodOverPeriodâ€¦Difference functions?
periodOverPeriodDifference
periodOverPeriodPercentDifference

For example Iâ€™ve built a similar pivot table using different data below using calculated fields to calculate the differences between years:

``````Difference in Profit
periodOverPeriodDifference(sum(Profit), {Order Date}, YEAR, 1)

% Difference in Profit
periodOverPeriodPercentDifference(sum(Profit), {Order Date}, YEAR, 1)
``````

Could you use these functions instead and achieve the desired result?

Many Thanks,
Andrew

Hello @RAHUL_singh1 !

Were you able to try @abacon 's solution above?

HI @duncan /@abacon , I am sorry for the late response! Yes, @abaconâ€™s solution gave me the clue to use the sum function. I used following and it worked
%Change = `(sum({Earning})-sum({Difference in Earning}))/sum({Earning})`