Percentage column in a Pivot table - excel

[/edit]Solved it, just right click on a field, Pivot table options, used For error message show: "0".
Again 1 step closer, looks like the filters don't work with the IF statement, when I only use the formula ([A]-[B])/[B] it works. How can I add the check if [B] <> 0 ? Do I need to use CALCULATE and what would the code look like?
Ok, found another way of doing it, with the following issues:
When I use a calculated field with formula =IF([Sum of B]=0;0; ([Sum of A]-[Sum of B])/[Sum of B]) my filters don't work correctly anymore. It empties all fields which are filtered out but doesn't collapse the table. So for example when I filter on 2017, both 2017 and 2018 are displayed but 2018 has only empty fields.
Im kinda new in the whole Pivot Tabel making and I have an issue I can't solve.
I have 2 columns (A and B) with values, I want to add a 3rd one (let's call it C) with the percentage change per row.
I made the following formula =IF([A]=0;0;[A]/[B]*100-100) which works in the Power Pivot window (Data view) from Excel 2010.
When I add this to my Pivot table (under Σ Values) I can only select Sum, Min, Max, Count, etc. but not the raw output from my column in the designer.
I want the 3 columns to be arranged next to each other and grouped by date so the output looks like 01.2017 A B C 02.2017 A B C so i put date and Σvalues in Column labels and A B and C in Σ values. All 3 get SUM of but C I want the raw data.
How to acclompish this? My colleague (not much better than me in Power Pivot) says I have to make a calculated column in the tabel but I can't find how to do this and can't find it online.
Found something more:
What I get when I right click Edit measure in the PP field list:
What I would like to see:

You need to add a Calendar table and use the Time Intelligence functions. There's plenty of examples on Google if you search "Calendar", "Time Intelligence", "Year on Year" and the like. I'd suggest you subscribe to Matt Allington's blog, and also check out this specific post: https://exceleratorbi.com.au/power-pivot-calendar-tables/
Matt has a fantastic book, and if I had one suggestion about picking up PowerPivot it's this: Don't try to muddle through. Buy a book from a pro like Matt or Rob Collie at PowerPivotPro. The cost of a great book is a fraction of the cost of the time you'll otherwise spend scratching your head.
Also check out Mike Girvin's ExcelIsFun YouTube channel for posts on the subject.

Related

excel PowerPivot Auto Calculated Measures & Columns

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
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
No calculated fields required - just include perc as the mesaure of interest in your pivot table, with value setting as 'sum':
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.
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]]

Excel table with expandable records

Alright, high chance of this being a dumb question, but I hope someone has an answer for me.
Say I have a report for the sales of my 3 products, Cakes, Cookies and Wine. They're all in tables looking something like this:
Product ID
Total Cookies
Quantity
1
Ginderbread
2
2
Chocolate chip
5
3
Cookie type C
1
Using these tables I made a summary table of how many of each product type was sold, like below.
Category
Quantity
Cookies
8
Cakes
11
Wines
5
However, we finally reach my question: I want to now make it so if I click on a record, I can expand it/get a pop-up/something happens that shows me the breakdown of the sales. E.g f I click on "Cookies" the cookie table will show up in some way, shape or form.
My first thought was that Excel's Power Pivot and Pivot Table system would be the answer i'm looking for, but i'm struggling to figure out how.
If you append all of your data into one table, you can use the drill down feature in the Pivot Table. When you double click the "Sum of Quantity" column, it will show the applicable data for that row:

Top 3 Values for Multiple Categories based on hours in a week

I'm working on a charging matrix where project managers can input time to the top three contracts in each category based on a week to week basis. Right now I have a pivot table with the categories (Production, Spares, Development) with multiple contracts that were charged that week. I manually select the top three from each category and copy into a table where I have formulas creating charge numbers for the project managers to use.
The question is, is there a way I can automate selecting the top 3 contracts from each category based on number of hours for that specific week?
Pivot Table & Charging Matrix
You can use LARGE() to get the top 3 (large(data,1) etc)
Then use index() and match() to get the contract names.
I have made a simple example here, but it will not deal with duplicate results in the hours if they are in the top 3...
There are solutions to that already posted.
If I understand you correctly, you want to automate the process of finding the top 3 contracts under each category and then create the charge number based on the results.
You can do so by creating a new pivot table as demonstrated below, put the Category Name and Contract Name in the Rows field, and put the Hours in the Values field, then right click anywhere within the Row Labels column of the pivot table, go to Filter -> Top 10... -> enter 3 in the second field, then you should have the top three contracts for each category.
P.s. You can choose to sort the hours from largest to smallest, and choose NOT to show the subtotals for each category.
Once you have the list, you can enter your formula (I presume you used a formula) in corresponding cells in column H (as in my example) to create the desired charge number.

Calculate average based on a value column (count) in a pivot table

I'm looking a way to add an extra column in a pivot table that that averages the sum of the count for the months ("Count of records" column) within a time period that is selected (currently 2016 - one month, 2017 - full year, 2018 - 5 month). Every month would have the same number based on the year average, needs to be dynamically changing when selecting different period: full year or for example 4 months. I need the column within the pivot table, so it could be used for a future pivot chart.
I can't simply use average as all my records appear only once and I use Count to aggregate those numbers ("Count of records" column).
My current data looks like this:
The final result should look like this:
I assume that it somehow can be done with the help of "calculated filed" option but I couldn't make it work now.
Greatly appreciate any help!
Using the DataModel (built in to Excel 2013 and later) you can write really cool formulas inside PivotTables called Measures that can do this kind of thing. Take the example below:
As you can see, the Cust Count & Average field gives a count of transactions by month but also gives the average of those monthly readings for the subtotal lines (i.e. the 2017 Total and 2018 Total lines) using the below DAX formula:
=AVERAGEX(SUMMARIZE(Table1,[Customer (Month)],"x",COUNTA(Table1[Customer])),[x])
That just says "Summarize this table by count of the customer field by month, call the resulting summarization field 'x', and then give me the average of that field x".
Because DAX measures are executed within the context of the PivotTable, you get the count that you want for months, and you get the average that you want for the yearly subtotals.
Hard to explain, but demonstrates that DAX can certainly do this for you.
See my answer at the following link for an example of how to add data to the DataModel and how to subsequently write measures:
Using the Excel SMALL function with filtering criteria AND ignoring zeros
I also recommend grabbing yourself a book called Supercharge Excel when you learn to write DAX by Matt Allington, and perhaps even taking his awesome online course, because it covers this kind of thing very well, and will save you significant head-scratching compared to going it alone.

Report on data for a particular month

I have a data sheet in Excel that gets populated with generic information first (Data, Project code etc.) and then along columns there are questions asked in a survey (40 in total). There are predefined answers (A, B, C etc.)
So a Row would look a little something like this:
Date / Contract# / Sector / Q1 / Q2 / Q3.......... Q40
12/05 010632 Department A B N/A.......... Not Checked
20/07 022365 Department N/A C Not Checked.. Not Checked
01/10 032501 Department A A N/A.......... Not Checked
What I would like to report on is for a particular month, give me the questions with the most "A" answers showing the following (for instance).
What would be the best way to do this?
I cannot seem to get it to work in PivotTables and VLOOKUPs, but not sure they are best suited for this extraction of data.
I would properly go for the next free column as a countif formula reaching over the question answers, so countif(D2:AD2,"A") I Say AD2 But just drag until questions have all been selected on that row....Then in the next column either a month formula as suggested or a TEXT(A2,"MMMMMM") Will show the month....Then Standard pivot.
Hope this helps
Thanks
Chris

Resources