Here is an example of the sort of data I'm working with:
I would like to create a pivot table where the rows are the dates, the columns are the regions, and the values are the percent of total daily transactions that came from that region. So my desired output looks like:
I created a Calculated Field called "PercentOfDailyTransactions" with the formula COUNT(Amount)/'Total Daily Transactions'. Then I created a pivot table with value equal to Sum of PercentOfDailyTransactions.
However, this appears to be calculating 1/(total daily transactions x number of transactions in that region on that day), rather than (number of transactions in that region on that day)/(total daily transactions). For instance, 1/2/2021 in West region should be 3/6=0.5 but is instead 0.0555=1/(3*6). How is Excel getting this value, and how do I create a calculated field that calculates my desired output?
Note that if I add a column to my source table with the formula COUNT([@Amount])/[@[Total Daily Transactions]], then create a pivot table whose values are the sum of that field, that gives me the correct result. However, I would like to be able to accomplish this without adding such a column.
question from:
https://stackoverflow.com/questions/65892603/excel-pivot-table-calculated-field-not-behaving-as-expected 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…