Min, Max, or Average formula not working in a Pivot Table Calculated Field

David_j78

New Member
Joined
Jun 18, 2021
Messages
12
Office Version
  1. 365
I am trying to create a calculated field in a pivot table that essentially takes the Total Days divided by the # of days that was in a given month/Year.

Below are the data columns I am using. The first 5 columns get pulled in a query data dump that I don't control. The last 2 columns are driven by formulas I created to help determine how many days were in a given month in a given year (I did it this way so that I could account for leap years).

The "Date" column is a concatenate formula =IF(N2="","",(CONCATENATE(N2,"/",1,"/",M2))) - this gives me a short date based by combining my "mnth" and "yr" column.
The "# of Days" column has the formula =IF(X2="","",(DAY(EOMONTH(X2,0)))) - this gives me the # of days there were in that month and year.

Now comes my problem.
In the pivot table I built off this data that gives a 5 year history by month, I need to do a calculated field that takes the "Total_days" of a given month and year divided by the # of days that was in that month and year.
I thought by adding that "# of Days" column, I would use the Min, Max, or Average formula in my calculated field I would create for the pivot table. But it doesn't work.

For example, if the month/year is Feb 2022 and the sum "Total_days" column of all Feb 2022 rows adds up to 3,000, i want to divide that 3,000 by 28 because that is the number of days there was in Feb 2022.
But the calculated filed, whether I use =Min(# of Day), or =Max(# of Day), or =Average(# of Day), keeps giving me a sum total of the "# of Days" column (see 2nd pic below).

What I would like to see or at least take into consideration in my calculated field formula is to return something that looks like the 3rd pic below. I was able to create that my just dropping the "# of Days" column in a pivot table and selecting "min" under the Value Field Settings.

I have to be missing something. Surely I should be able to create a calculated field for my pivot table that takes my "Total_days" column divided by the Min of "# of Days" column.

1653605257182.png


1653605787518.png


1653605832895.png
 

Attachments

  • 1653605779507.png
    1653605779507.png
    29.4 KB · Views: 18

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Thanks for the pictures, but you should be aware that we cannot manipulate data in a picture. Please reload your data to this site using XL2BB so that we can down load and manipulate and solve. Look at my signature for instructions.
 
Upvote 0
Unfortunately, this file is on a work computer and I am unable to download the XL2BB add-in. It is blocked by my company.
 
Upvote 0
Thanks for the pictures, but you should be aware that we cannot manipulate data in a picture. Please reload your data to this site using XL2BB so that we can down load and manipulate and solve. Look at my signature for instructions.
Actually I think I found out how to do what I wanted to do. I used the below formula in my calculated field. :)
Seems to be giving me the expected value I need.

1653609573994.png
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top