excel PowerPivot Auto Calculated Measures & Columns

Viewed 61

After looking at a few similarish questions I figured I needed something more specific so asking here. I will start by explaining the situation:

The Setup

I have a Store which sells Cakes, Cookies and Wine. I have the weekly sales data of each product sorta like this:

Product ID Product Name Quantity Value Week Ending
1 Ginderbread 2 £4 13/01/22
2 Chocolate chip 5 £25 13/01/22
3 Red Wine Bottle 1 £10 13/01/22
4 Sponge Cake 3 £9 13/01/22

Currently every week's data is stored within the same table, with me using a Week filter to show only the week i'm interested in.

Using this Data I created PivotTables that shows the sales of each category, with the ability to drill down to show the specific products. Table looks something like this:

Category Quantity Value
Cakes 2 £4
Cookies 7 £29
Wine 1 £10

The issue

I now want to stick in a new calculated column that shows the Value as a %. E.g The total value for the previous table was £43, so Cookies is about 67%. If I drill down, it would show the Chocolate Chip record as 80% and Gingerbread as 20%

I imagine doing this would be easier if each individual week's data was on a different table, but I got a lot of weeks and I also want to do tables showing the sales for over a period of time. Plus I don't know of a way to merge the "value" and "quantity" columns, etc instead of having 1 for each week being shown.

any advice would be appreciated

1 Answers

Create an extra column in the source table (prior to filtering) entitled "perc" calculated as the corresponding value for each row divdied by the total value across all rows (se pic. / eqn. for first row below) --

=E2/$E$6

Table - source data (eqn references)


No calculated fields required - just include perc as the mesaure of interest in your pivot table, with value setting as 'sum':

Pivot table with Sum of perc as key measure


The reason why this worked is because of the common denominator - which allows one to sum ratios on a 1:1 basis.

Devising a calculated field using the standard 'fields, items & sets' functionality for ordinary pivot tables would not be feasible / possible as far as I am aware. You would need to move into the realm of power pivots and data models - which is not too complicated (readily accesible directly from the field list per below) - however, I see this as unnecessary complication for the task at hand.

More tables to combine - possible approaches for more complex / sophisticated approach - yet unnecessary for this task


Side notes:

Using table names in your functions is sometimes more convenient when entering, albeit may appear tricky at first when reviewing - first eqn above becomes:

=[@Value]/Table1[[#Totals],[Value]]

Table names in formulas : hotkey to open tools/options: alt + t + **o** (for oscar)


Related