after googling my specific inquiry online, I haven't found much luck. Basically what I'm trying to do is take a excel file what has lots of columns. Now I'm only interested in some of these columns to be included in a pivot table. Is there a way to automatically create a pivot table, via a script of some sort which will occupy the desired columns in a pivot table that I want to take from the original excel file?
Thank you
The best way to do this for real is to set your file up to make the call to the database and specify that the destination is a pivot table.
How this is done depends greatly on what your data source is. But the functionality to do this is built in to the program without having to use VB at all.
Related
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.
I am generating Excel files with Perl using the use Excel::Writer::XLSX module. I put the data on a sheet. I want to automatically as I create the Excel file, also create a pivot table and chart with that data. The pivot table and charts need to have filter, so I can select Month, Week, Status, Department. I have been searching for days with no result on how to do that.
If you know a better suitable option with other programming languages, like python, ruby or java. Please let me know.
Thanks a lot!
Happy Holidays!
To my best knowledge none of the Perl modules supports pivot tables in Excel at the moment nativly.
There is two workaround: Create and setup the pivot (like a template) and the chart by hand then load your data and save a file in different name.
Create a pivot table using OLE, it is working only on windows. Starting point: http://www.perlmonks.org/?node_id=651561
Regards,
I'm using pivot tables to structure my statistics.
I have recently been making changes to the data set and then created a new pivot table. However, this time there are duplicates in the row labels. For example, there is a duplicate of "1". Before it was 12345678 as row labels, however, currently it is 112345678.
Any idea of what my causing this?
Thanks!
For a pivot table to have information within it, it has to be referencing some data that resembles this... If you can provide a little more information you may get some help but the information provided is very limiting.
Also check out if the data source is all formatted as text or numerics.
I have a series of table in Excel worksheets, all of them holds same data types, one table for one item, and how some values changed over time in each table column.
I want to create a excel graph/chart for each of this table, with same formatting, only the data should be different.
When I copy each from single graph to create many, the table link doesn't change and I have to do that manually, which is difficult because there are number of tables.
Is there any better solution? Thank you
The dirtiest solution is to simply use VBA to automate these changes.
I finally copied and pasted the same graphs for each table, undo the old links and linked each table separately. I was looking for a easier way than this because even this is difficult with number of tables increasing. Thank you.
I have a spreadsheet that is emailed to me by an outside vender. It contains a bunch of pivot tables. I really couldn't care less about the pivot tables, I just want the underlying data. The data comes from a sql server that I don't have access to, but the data is stored within the spreadsheet. Is there anyway that I can access the data, (I think it's the PivotCache) directly without drilling into one of the pivot tables?
I'd love some sort of ODBC/ADO.Net command that I can use from SSIS. But am open to just about anything that doens't require me to open and save the workbook.
I'd also like to avoid macros if at all possible.
Here's the answer. Or at least what I did to resolve my problem.
There is really no way to accss the underlying PivotCache data except via pivot tables. So direct accss was out. I ended up using a script task with excel ole to dynamically create a pivot table with the data I needed at run time. Once the script task is done, I then use the new pivot table as my dataflow source. Excel can be a little tricky to automate, but it's worth it.