• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Modify a pivot table to complete a calculation on two columns already included in the pivot table and to summarize data based on variable Values field |Power Query|Excel Forum|My Online Training Hub

You are here: Home / Modify a pivot table to complete a calculation on two columns already included in the pivot table and to summarize data based on variable Values field |Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower QueryModify a pivot table to complete a …
sp_PrintTopic sp_TopicIcon
Modify a pivot table to complete a calculation on two columns already included in the pivot table and to summarize data based on variable Values field
Avatar
Matthew Chase

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
December 4, 2019
sp_UserOfflineSmall Offline
1
December 4, 2019 - 7:07 am
sp_Permalink sp_Print

I have a large table that has multiple types of material properties (yield strength, ultimate strength, compressive strength, shear strength, elongation, etc.) as well as multiple input criteria (floor level, type of masonry, type of stone, type of steel, type of steel shape, building area). I would like to build a pivot table to calculate certain properties on the filtered data that are broken down by one of the categories (for example, floor level). I would like to have columns for average, standard deviation, max, min, coefficient of variation, etc.

1) Is there a way to change the property that is summarized in the pivot table for all columns? As it stands, I can add the column for, for example, Yield Strength as many times as I want, then change the Summary Function (to average, max, min, etc.). However, if I want to then have the pivot table report on the Ultimate Strength of the data set, I have to change each column individually. I'd like to be able to change between properties (Yield Strength, Ultimate Strength, etc.) with a single change, without having to update each column to change it from Yield Strength to Ultimate Strength.

2) I would like to add a columun that will calculate the coefficient of variation (COV) of the displayed data. The COV is the standard deviation divided by the average. I can do this outside the pivot table, but if the pivot table changes height (for example, if I change the rows from Building Area to Floor Level, which have different numbers of options), then the formulas do not work since they reference empty cells. There are possibly other formulas I would like to add as well.

I'm very new to Pivot Tables, so thank you for your patience!

sp_AnswersTopicSeeAnswer See Answer
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4438
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
December 4, 2019 - 8:35 pm
sp_Permalink sp_Print

Hi Matthew,

Welcome to our forum!

It sounds like you need to unpivot your data so that the 'Material Properties' are in a single column and the value is in another column. This will allow you to use Slicers to change between the properties and only need to set the different summary functions once. You can easily unpivot the data with Power Query.

In regards to your COV calculation, you can do this with Power Pivot measures, but I'm not sure you can do it with the regular PivotTable calculated fields. 

If you get stuck, upload a sample Excel file and we can help you further.

Mynda

Avatar
Matthew Chase

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
December 4, 2019
sp_UserOfflineSmall Offline
3
December 5, 2019 - 2:49 am
sp_Permalink sp_Print

Hi Mynda

Thank you for the reply! I think I get what you are suggesting. However, for my data set, I have some entries that have a value in multiple (up to maybe 10) different property types, so I cannot simply have a column that includes the name of the property as an entry and a second column for the numerical value, for each line in the data. I suppose this would work if I assigned a primary, secondary, etc. property type for each type of data, but this would be very prone to error since the data would have to be entered in the same order for all similar entries. There are also about 28 property types (i.e., different types of results values) right now, and this will definitely increase!

I have uploaded a much smaller version of the data and pivot table that I am trying to work with. It has 4 Input Criteria (Area, Flooor, Zone, and Shape) and 6 Property Types (Yield strength, Ultimate strength, Elongation, Total Carbon, Carbon Equivalent, and Weldability). Each of the 12 entries in the data source has values for all of these Criteria and Property values. I have applied filter controls using slicers and linked Pivot Tables for convenience and consistency of display (slicers are on a separate sheet, with secondary pivot tables that act as filter controls on the primary sheet). My computer is set up in French, so hopefully translates back to English when you open it on your machine (usually not a problem).

I can get the main pivot table to display the sum, average, max, min, etc. (using the built-in summary function options) for one of the properties, but would like to not have to create new columns reporting these summary values for each of the other 5 property types, which would be prone to error (and would be time-consuming when I go back to the main data source which has 28 property types).

With regards to the COV calculation, I think I have figured out how to do this with Measures/Power Pivot but only for one specific property (i.e., only for Yield Strength), not for the generic "Values" of a specific material property which I want to be able to select in order to retain flexibility.

I very much appreciate the help! Hopefully someone has a suggestion that will work.

Best regards,

Matt

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4438
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
December 5, 2019 - 8:49 am
sp_Permalink sp_Print

Hi Matthew,

Please try uploading the file again. You need to click the yellow 'start upload' button after adding the file.

Mynda

Avatar
Matthew Chase

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
December 4, 2019
sp_UserOfflineSmall Offline
5
December 6, 2019 - 1:00 am
sp_Permalink sp_Print

Hi Mynda

Sorry about that. Here it is.

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4438
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
6
December 6, 2019 - 10:36 am
sp_Permalink sp_Print

Hi Matthew,

Thanks for sharing the file. You can use this Power Pivot technique that allows you to change aggregation methods using Slicers. 

It requires a version of Excel that comes with Power Pivot.

Mynda

Avatar
Matthew Chase

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
December 4, 2019
sp_UserOfflineSmall Offline
7
December 7, 2019 - 2:35 am
sp_Permalink sp_Print

Hi Mynda

Thanks for the reply. I don't see how this can work in my situation: the Measures that were created in the example were for a specific column in the original data set, "Sales" (i.e., Sales Prior Period, Sales Current Period). I want to display the same calculations (average, min, max, etc.) but on a variable Property type that can be changed by selecting from a list/filter, without having to create the same list of custom Measures for each Property. 

Thanks for the help!

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4438
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
8
December 7, 2019 - 9:50 am
sp_Permalink sp_Print

Hi Matthew,

You would need to set up the measures first. Going back to my original suggestion now that I have your sample data. I don't see why you're concerned about errors if you unpivot your data so you have a Property Type column and a value column. Power Query can connect to your table and unpivot the data. If you make changes to the original source data, you just refresh the query and it updates.

See example attached.

Mynda

sp_AnswersTopicAnswer
Answers Post
Avatar
Matthew Chase

Active Member
Members
Level 0
Forum Posts: 5
Member Since:
December 4, 2019
sp_UserOfflineSmall Offline
9
December 14, 2019 - 6:25 am
sp_Permalink sp_Print

Hi Mynda

 

Thanks so much for your help. I got my spreadsheet working how I would like. I was very reluctant to unpivot the data, prior to discovering that unpivoting makes a new table but leaves the existing one in place. Data entry into the original table (which is ongoing) is much easier when all values are on the same line for a given specimen. But now that I've unpivoted, the Pivot Table works like a charm. I've also noted that by placing my Property (i.e., the different types of values that I have) column ahead of the Values in the Columns area of the Pivot Table, I can display all the calculations (Avg, Std. Dev, Coefficient of Variation, etc.) on multiple related properties at the same time.

A whole new world has opened it's doors to me!

Thanks fo much for your assistance and patience.

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4438
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
10
December 14, 2019 - 8:56 am
sp_Permalink sp_Print

It's great to hear you've embraced unpivoting with Power Query 🙂

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
yashal minahil
Oluwadamilola Ogun
Yannik H
dectator mang
Francis Drouillard
Orlando Inocente
Jovitha Clemence
Maloxat Axmatovna
Ricardo Freitas
Marko Meglic
Forum Stats:
Groups: 3
Forums: 24
Topics: 6201
Posts: 27185

 

Member Stats:
Guest Posters: 49
Members: 31861
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.