• 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

Show Values as Percentage of Another PivotTable Column Total

You are here: Home / Power Pivot / Show Values as Percentage of Another PivotTable Column Total
values_as_%_of_another_column_thumb
March 7, 2019 by Mynda Treacy

Occasionally you may want to show values as percentage of another PivotTable column total. For example, below we want to find what percentage the expenses for each region are of the total revenue:

Show Values as Percentage of Another PivotTable Column Total

Unfortunately, you can’t do this with regular PivotTable calculated fields or PivotTable calculated items.

However, we can with Power Pivot*, aka the Data Model. All we need to do is write a DAX measure, but don’t worry, it’s super easy.

*Note: Not all versions of Excel come with Power Pivot. Click here to check if your version of Excel has Power Pivot.

Power Pivot Show Values as % of Another PivotTable Column Total

Below is the source data I’ve loaded into Power Pivot. It’s just a small sample, in reality you’d be aggregating hundreds, thousands or even millions of rows of data. Yes, Power Pivot can handle millions of rows of data.

source data loaded into Power Pivot

Load Data to Power Pivot

In Excel 2013 onward, you can load data from an Excel table into Power Pivot by checking the ‘Add this data to the Data Model’ box when inserting a PivotTable.

add data to the data model

In Excel 2010 you can click on the ‘Add to Data Model’ icon on the Power Pivot tab:

add to data model

Build the PivotTable

Build the PivotTable bringing the Revenue and Expenses fields in to the Values area as you normally would.

Build the PivotTable

Write the DAX Measures

Now all we have left is to create the measures.

We need a measure that calculates the Total Revenue and then one to calculate the Expenses as a percentage of total Revenue. That said, you could write it all in one measure, but it's common practice to create the building blocks separately so they can be re-used in multiple measures.

We’ll create the total Revenue measure first since we need to reference this in the percentage calculation.

On the Power Pivot tab of the ribbon > Measures > New Measure*

new measure

*In Excel 2013 Measures were called ‘Calculated Fields’.

This opens the New Measure dialog box where you can (1) give your measure a name, I’ll call it ‘Revenue Grand Total’, (2) enter the DAX formula, (3) set the formatting:

give your measure a name

The DAX formula:

=CALCULATE(SUM(Income[Revenue]), ALL(Income[Region]))

In English it reads:

CALCULATE the SUM of ALL income irrespective of any Region filters, or row and column context.

Notice the formula uses Structured References, just like an Excel Table. E.g. SUM(Income[Revenue])

While we don’t need this measure in the PivotTable, if we were to insert it, as you see below, the Total Revenue is entered in every cell:

Revenue Grand Total

We can then use this measure as the denominator in our percentage calculation.

Let’s do that. I’ll create my Value as percentage of Another Column Total, which is Expenses / Revenue Grand Total. The DAX formula is:

=DIVIDE(SUM(Income[Expenses]), [Revenue Grand Total])

The DIVIDE function handles #DIV/0! Errors. In English it simply reads, DIVIDE the SUM of Expenses by the Revenue Grand Total.

Notice the formula refers to the first measure; ‘Revenue Grand Total’.

Now I can insert that measure in the Value field of my PivotTable like so (note: I removed the ‘Revenue Grand Total’ measure because I don’t want it in my PivotTable report):

insert measure in the Value Field

So, you see DAX formulas aren’t that scary.

Download the Workbook

Enter your email address below to download the sample workbook.



By submitting your email address you agree that we can email you our Excel newsletter.
Please enter a valid email address.
Download the Excel Workbook. Note: This is a .xlsx file please ensure your browser doesn't change the file extension on download.

Note: This workbook is compatible with Excel 2013 onward.

Power Pivot Data Sources

In this example the data was in the Excel file, but you can also get data from tons of external sources or load direct from Power Query to the Power Pivot Data Model. Unfortunately, I haven’t got time to cover them all here.

If you’d like to learn Power Pivot, please consider my Power Pivot Course.

values_as_%_of_another_column_thumb

More Power Pivot Posts

CUBE Functions

Excel CUBE Functions

Excel CUBE Functions are a great alternative to GETPIVOTDATA for Power Pivot PivotTables and still work with Slicers.
Introduction to DAX

Introduction to DAX Measures

Introduction to DAX in Power BI and Excel. Where and how to write DAX measures, understanding filter context and more.

Toggle Top N with Slicers

Toggle Top N with Slicers using disconnected tables in Power Pivot. These easy measures allow users to choose their top n.
power pivot running total

Power Pivot Running Total

The defaul Power Pivot Running Total setting doesn't handle aggregated periods. This measure solves this issue.
static data tables

Static Tables in Power Query, Power Pivot and Power BI

Use static tables to store data in Power Query, Power Pivot and Power BI without needing to load data from an external source
custom formatting strings in power bi

Custom Formatting Strings in Power BI

Control how data is displayed in Power BI using your own formats. Like hiding negative or zero values, using symbols or custom number formats
GETPIVOTDATA Function for Power Pivot

GETPIVOTDATA Function for Power Pivot

The GETPIVOTDATA Function for Power Pivot references measures and so it works a little different to GETPIVOTDATA for regular PivotTables.
Change PivotTable Aggregation Methods using Excel Slicers

Change PivotChart Aggregation Methods using Excel Slicers

Change Pivot Chart Aggregation Methods using Excel Slicers and Power Pivot. Disconnected tables and the SWITCH function are the secret sauce.
PivotTable Distinct Count

Excel PivotTable Distinct Count

Excel PivotTable Distinct Count, sometimes called ‘Unique Count’ will return a count of unique items in a field. It uses the Data Model (Power Pivot).
Power Pivot does VLOOKUP

Power Pivot does VLOOKUP

Creating PivotTables from multiple tables used to require consolidating the data into one table, but now Power Pivot does VLOOKUP, kind of. So you don't need to.


Category: Power Pivot
Previous Post:scheduling macros in excel with application ontimeScheduling Macros in Excel With Application.OnTime
Next Post:GETPIVOTDATA Function for Power PivotGETPIVOTDATA Function for Power Pivot

Reader Interactions

Comments

  1. Karen Cotton

    February 24, 2020 at 7:43 am

    In order to have expenses percentage on last column in pivot table, are you supposed to add as a column header in the source data?

    Reply
    • Mynda Treacy

      February 24, 2020 at 1:17 pm

      Hi Karen,

      No, you should never have totals in your source data. Calculating totals is the job of the PivotTable. Please follow the steps above and if you get stuck, you can post your question and sample Excel file in our forum where we can help you further.

      Mynda

      Reply
  2. thamer

    May 9, 2019 at 6:50 pm

    Thanks ….. very much

    Reply
    • Mynda Treacy

      May 10, 2019 at 12:26 pm

      You’re welcome 🙂

      Reply
  3. Sunny Kow

    March 12, 2019 at 5:49 pm

    Hi Mynda

    Any suggested workaround using a normal Pivot Table in Excel 2010?
    I was thinking along the line of having a Grand Total to the right of the Pivot Table that is the same value as the Revenue Grand Total. Then maybe we can compare the Expenses against that Grand Total.

    Reply
    • Mynda Treacy

      March 12, 2019 at 9:40 pm

      Hi Sunny,

      My workaround is usually a formula outside of the PivotTable, but it’s not ideal as it doesn’t grow with the PivotTable.

      Remenber though, Power Pivot is a free add-in for Excel 2010.

      Mynda

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Current ye@r *

Leave this field empty

Sidebar

More results...

Featured Content

  • 10 Common Excel Mistakes to Avoid
  • Top Excel Functions for Data Analysts
  • Secrets to Building Excel Dashboards in Less Than 15 Minutes
  • Pro Excel Formula Writing Tips
  • Hidden Excel Double-Click Shortcuts
  • Top 10 Intermediate Excel Functions
  • 5 Pro Excel Dashboard Design Tips
  • 5 Excel SUM Function Tricks
  • 239 Excel Keyboard Shortcuts

100 Excel Tips and Tricks eBook

Download Free Tips & Tricks

Subscribe to Our Newsletter

Receive weekly tutorials on Excel, Power Query, Power Pivot, Power BI and More.

We respect your email privacy

Guides and Resources

  • Excel Keyboard Shortcuts
  • Excel Functions
  • Excel Formulas
  • Excel Custom Number Formatting
  • ALT Codes
  • Pivot Tables
  • VLOOKUP
  • VBA
  • Excel Userforms
  • Free Downloads

239 Excel Keyboard Shortcuts

Download Free PDF

Free Webinars

Excel Dashboards Webinar

Watch our free webinars and learn to create Interactive Dashboard Reports in Excel or Power BI

Click Here to Watch Now

mynda treacy microsoft mvpHi, I'm Mynda Treacy and I run MOTH with my husband, Phil. Through our blog, webinars, YouTube channel and courses we hope we can help you learn Excel, Power Pivot and DAX, Power Query, Power BI, and Excel Dashboards.

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.