Excel Pivot Chart Help - Pulling names that contributed to count (VBA?) - excel

I am looking to develop a pivotchart of meaningful data related to employees. Lets say it's a graph of employees with infractions by month.
We have a graph that graphs it based on the COUNT of employees that got an infraction for that month. What I am looking to do is make it very easy for management to see the graph and then see the names that contributed to a large count for a month.
However, upon selecting a certain pivot chart cell (Lets say March had a LOT of infractions on the chart and we want to know who was a part of it). Upon double clicking the cell, it then brings up a "Show Detail" window, we select the cell Name since we want to know the names - however that doesn't help because it just puts the names as part of the legend and screws up the chart.
What are some ways to get it to display the names that contributed to the count for the month? I am thinking something along these lines:
-Upon mousing over the data point of the pivot chart, the tooltip is a list of the names
-Upon clicking on it, it displays a table at the bottom that shows the data from the table that contributed to that month (including names).
Anything along those lines. Any help is much appreciated, I do have experience with VBA - but sadly not in Excel yet.E

The best solution would be to check the PivotTable associated with the PivotChart.
When you show detail on the chart the change will be mirrored in the PivotTable.
For more information check out Overview of PivotTable and PivotChart reports # office.microsoft.com

Related

Calculated Field

I am trying to create a simple pivot table which will tell me how many community residents reported a particular problem, and what percentage of them reported each problem type. I have a data set with name, and then columns for each type of problem. Here's an small sample of the data set:
I have created a pivot table which sums each of these columns and also provides me the total number of people who reported any type of problem at all. Here's what I have:
I want to add a second column to this pivot table that gives the percent of times each problem type was reported. Sounds simple, but because of the structure of the original data set, I can't figure out how to do it. I can set up formulas outside of the Pivot Table which reference the table, but in doing so I forfeit the ability to graph the percentages on a pivot chart. Any ideas how to create a calculated field for this pivot table?
Just to be clear, what I want is something like this, except all contained in the structure of the pivot table:
Edit: I've changed the example of the data set. Here's an explanation of the pivot table. The values under the "# Reporting Issue" column are counts of all the 1's under each corresponding column in the data set. This meant that I had to add each row to the pivot table independently, as you can see here:
I'm open to the idea that I need to change the formatting of the data set, but I'm not sure of the best way to do it. This was set up initially because it allowed for easy compilation into a data table, but Pivot Tables seem to be a different story.
Hopefully this edit clarifies things.
You need to unpivot your data so that you turn it into a Flat File...something that the PivotTable can consume properly.
The easiest way is to use something called PowerQuery, which is baked in to Excel 2016 but available as a free addin from Microsoft for any other versions. Google PowerQuery Unpivot and you will turn up hundreds of tutorials, such as this one from my good pal Chandoo . PowerQuery looks slightly daunting at first to a first time user, but it is freakin easy once you get your head around how to use it. PQ is by far the best addition to Excel in years. PowerPivot being a close second.
If you can't install PowerQuery, then you can use your current data structure to make a 'staging pivot', and then drag the Values label that will appear in the Columns area to the bottom of the ROWS pane, like in this excerpt from a book I'm writing:
Note that my Year categories are equivalent to your Issues categories.
That will emulate the flat file layout you’re after. All you need to do then is turn this intermediate PivotTable back into a normal range, change that Values heading to Issue, and add a Count heading and you’ve got the flat file you need to build a useable PivotTable.
You can also use VBA. Google Unpivot VBA and turn up hundreds of results, including this blazingly fast code I posted some time back. (Look for the code under the —Update 26 November 2013— heading.)
You can also use the DoubleClick extraction trick.

How to get Pivot Table - Calculated Field to work in this excel sheet?

first time asking a question here. So I apologize in advance if I have not asked properly.
I have a set of data in the form of a table, which I have converted into a Pivot Table, with the normal purchase sales and profit columns. However, my problem arises as I want to create another column in the Pivot Table which gives the profit percentage on purchases. I am aware that this can be done by clicking on the Fields, Items & Sets drop-down menu under the PivotTable Tools - Analyze Tab, However, this doesn't work and all I can see is that the Calculated Field option is greyed out.
Can anyone advise how I can get a profit percentage column to be inserted in the pivot table? Thank you in advance.
Warren Barrell
Screenshot
It looks like your PivotTable uses an OLAP data source, which is why that option is greyed out. If you have the requisite version/SKU of Excel you could use the PowerPivot add-in to write a measure, but otherwise I think your only other option is to get your database admin to add the column to the database, and then bring that through to Excel.

Pivot chart (Excel) fails to render the data the way I want

I'm creating a piece of Java code to fill data into an excel file. The file is pre-created, inlcuding a pivot chart and some vba code.
Though the java code works, I have some problems getting the pivot chart itself to work. I've included a screenshot with some demodata.
There are several Problems I'd like to solve:
The X-Achis seems to behave like a category-axis, though it is formatted as a date-axis.
Symptoms:
Dates are not ordered automatically, but only if I order the according column in the pivot-table
All dates have the same distance, though there is a gap of 1.5 years in the data
The chartline of cathy has a gap. But i do want the line rendered, even if there are dates without data for cathy
Am I using the wrong chart, did I miss the an important checkbox in the chart options or do I really have to interpolate the data programmatically for every day before filling it into the table?
The last option would be not only be disappointing, but also distort the chart since I want to have the datapoints marked with symbols (like the squares and diamonds on the screenshot)
Any help is appreciated.
Edit
By now this is my solution:
First of all: pivot charts are great, unless you want to visualize randomly ordered dates
I'm going to copy the pivot-data via vba into another sheet and use a regular chart
Gaps in the chartline can be avoided by using a point-diagram (X/Y-data) and selecting "connect datapoints with line" in the Dialog in "datasource > hidden and empty cells" (roughly translated from the german locale)
The vba-code will be extended to set up the diagram to my needs (adjusting range of input data and so on)
Still I'm kind of disappointed. I would have thought this was a usual usecase.
I set up trial workbook.
I based a line chart on a range of data that had a column of dates.
It was NOT pivot chart, just an ordinary one
When I went to the x-axis formatting options and chose "Date axis" I was presented with choices about how to span the dates out (to do what you want).
When I created a chart based on a pivot table using the same data, the x-axis formatting options did not give me the same choices
It would seem that pivot charts do not allow dates to be spanned out.
So you might like to consider basing your chart on a range of data not a pivot table.
I also found this useful page, all about this sort of thing:
here
Harvey

Excel create graph for bought domain names

I have a excel table with 450 domain names and I have a column for the "created on" which I would want to manipulate to create an history graph but I really don't knwo how to handle it. I'm new to pivot tables, but I already change my data from range to table.
I would want to have a graph having the years on the x-axis and having the added number of domains bought on the y-axis and be able to see the "curve".
Could somebody give me some advice on how to create that only with pivot table configuration?
Thanks a lot.
I tried to pack it all into one picture for you. If the dates are stored as dates, the Pivot Table can "Group Field" by Years. This will summarize the data in groups. You can then create a Pivot Chart with this summarized data. Most common issue when doing this is not having all the dates formatted correctly.
Edit
To get from here to a cumulative total, you can change the Pivot Table "Show Values As" to "Running Total In...". Select the DATE field when you get the prompt.
Change the display option.
Chart is now cumulative. (My pictures are now the same since I regenerated the data and added a couple years to show it.)

How do you group an Excel PivotChart by a column not selected in category?

Does anyone know if its possible to select one column in an Excel PivotChart (i.e. Name in my example) but sum the values by ID without displaying the ID column in the chart?
In the example below, we have two Johns. I want to view both of them in the chart like in chart two, but I don't want to display their ID fields in the chart.
[EDIT]
Real case scenario is that I need to filter on top 10 file views by file name. And if we have a bunch of files named image1.jpg (because people don't properly name their files), we end up bucketing them all together and it looks like image1.jpg has way more views than it actually has; causing the chart to be skewed. I know it might be confusing to have two same data labels, but oh well. :) The user will just have to drill into one to see other details.
I did find a clean way of doing this using hierarchies in PowerPivot, but with a large dataset the performance is horrible.
Create a hierarchy in powerpivot with ID and Name. Use the hierarchy in the PivotChart category. Only ID field shows up initially. Expand entire field and the names show up. Hide level ID, and voila. You get all Names without ID column, but only to be used on smaller datasets.
datamodel,
easiest way to do this is created a calculated column in PowerPivot window where you will combine filename AND file id.
With that, it's very easy and still should be quite good from performance perspective. Better yet if you could prepare this column in your import file / on your server.
Result could then look like this:
From a data visualisation point of view it will be most confusing to have two data points with the same label and no means of differentiating them. So, having the ID in the X axis is actually helping the reader to make sense of the information.
From a technical point of view, you can create a chart that is based on the pivot table, but is not a pivot chart. Use the pivot table as the source for a regular chart and select only the Name as the X axis label.
If the pivot table dimensions may change when it is refreshed, you can use dynamic range names to ringfence the ranges required for the chart.
In the screenshot below, the label range chtLabels uses the formula
=OFFSET(Sheet1!$F$38,1,0,COUNTA(Sheet1!$F:$F)-1,1)
The range chtValues uses
=OFFSET(chtLabels,0,1)
When adding the range names to the chart source dialogues, they must be preceded with the sheet name or the file name.

Resources