How do you copy the powerpivot data into the excel workbook as a table? - excel

I have data in powerpivot that I've modified and I'd like to place it into the workbook as a regular table (and not as a pivottable). I need this so that I can run use the table for some vlookups from another worksheet in the same workbook.

I found this answer: link which I will try and summarize with out cutting and pasting to much. This assumes you have powerpivot installed.
goto powerpivot and "import from and external source" the data you want to munge and bring back into the workbook as a table
Key here is to select the checkbox “Enable selection of multiple tables”.
when prompted at the "import data" window, pick pivot report (you won't really use this)
go back to powerpivot with the "Manage Data Model:
add a new measure below your data. something like: NRofOrders:=COUNTROWS(values(FactResellerSales[SalesOrderNumber]))+0
(you won't really use this but this seems to change the query to this table so that you can use DAX)
also add any columns that you want ( for me, this is want I wanted that I wanted to be reflected back in the workbook)
back to Excel, select the data tab, click on Existing connections and select Tables: and then pick a table from your query.
boom, you're done
(the link continues on and you should read that as it's interesting but at this point you should have powerpivot query with your modification as a table in your workbook)
The July 2014 update to Power Query (pushed out at the end of Aug) simplifies the answer. With the new Power Query Update you can pull the data into the Data Model with out having to also copy it to the Works sheet.
goto powerquery and import the data you want to munge. Use the option to just add it to the Data Model.
go back to excel and then go to powerpivot with the "Manage Data Model" button.
munge your data (add columns, whatever)
back to Excel, select the data tab, click on Existing connections and select Tables: and then pick a table from your query.
boom, you're done

In the PowerPivot window you can select the table, or elements of it, and then copy (nornal right click or ctrl +c) and paste that into your spreadsheet.
This works for reasonable amounts of data but if you try and do it with thousands of rows you may find that excel objects and falls over, based on my experience.
Vlookups kind of defeat the purpose of PowerPivot :-)

Found a great solution over on Mr Excel
(http://www.mrexcel.com/forum/power-bi/637919-extracting-static-data-powerpivot-without-pivot-tables.html)
If you are trying to get a PowerPivot table into Excel, then you can simply query it. The easiest way to set that up is to first create any pivot table based on you PowerPivot data. Then double-click the measures area to drill-through. This creates a table with a connection to your PowerPivot model. Then edit the command text by going to: Data > Connections > Properties > Definition tab > Command Text.
Change it to something like
Code:
EVALUATE Table1

Related

Use datamodel data for cell formula

I have an excel file that has a table imported from a txt in a sheet (using New Query). From that table I created a pivot table and some formulas like for example MAX().
I was told that for large files it is better to add the info to the data model as connection only (the data is not visible in a sheet).
No problem in creating the pivot and works great, but trying to do the formulas excel does not find the Table.
Before I could do something like this:
=+MAX(Table1[#[Column1]])
but know when I do MAX, the system does not find the Table1 I have loaded as connection only. Is there any way to relate a formula to data that has been added to the model as connection only?
Thanks.
In order to access data in the data model you can use "Cube functions" you can follow these steps:
1- From inside the "Manage Data Model" option, create a pivot table of your table
2- Customize the new pivot table according to your needs
3- Click the ribbon "PivotTable Tools" | "Analyze" | "OLAP Tools" | "Covert to formulas"
4- Optional: Merge the formulas in one
Remarks:
The functions (MAX, SUM, Etc.) must be defined in the Pivot Table.
Here is an screencast I created for you.
Reference: https://support.office.com/en-us/article/cube-functions-reference-2378132b-d3f2-4af1-896d-48a9ee840eb2
First Create a Data Model table then use
=MAXIF(Table1[Values],Table1[Labels],"a")

How to hide Source Data Tables in Power Pivot

I unioned two tables (AccelerateData and Adjustments) in PowerQuery and loaded them into the data model (table name in the data model is AccelerateData). Afterwards I created a pivot table from the data model to analyze it. I want to make the data model accessible to other users as well and therefore I'm doing some tidying up.
In PowerPivot there is the option to "Hide from Client Tools". I have done this for the non relevant PowerPivot for columns and tables. However, I always see the source data tables from PowerQuery in the field list of the pivot table and can't find out how to hide them.
Anybody knows how to not show them in the field list?
Thank you very much!
I don't see a way to do exactly what you are asking under the All tab, but you can easily hide (or unhide) any sources from the Active tab with just a right-click and Remove from (or Show in) Active Tab.
In my opinion, All really should show all dependencies rather than some arbitrary user defined selection with the Active tab being used for customization and this seems to be how Microsoft built it.
After hiding them using the "Hide from Client Tools" option in Powerpivot, you also have to right-click and refresh your pivot table. That should hide the fields from the pivot table fields list.
I found a better solution than using the "Active" / "All" tabs.
In Excel, go the table you want to hide, then go to the Power Pivot tab, and select "Add to Data Model". This will make the table directly visible in Power Pivot, where you can now "Hide from Client Tools".
I agree that the PivotTable Fields view shouldn't include tables outside of your data model, but with this solution you at least gain control of hiding them, and as long as you don't create any relationships you should be ok in terms of performance.

Change data source of a list table in Excel 2010

Is there a way to change the data source of a list table in Excel? It's easy to change the data source of a pivot table but the only way I have found to change the data source of a list table is to delete the table and start again.
Just to be clear, what I mean by a list table is what you get when you set up a connection to a table or query in Access (for example) and then click on "Existing Connections" under the Data tab.
I would prefer a method using the usual user interface but if there is a method that works only in VBA, that would be fine.
You can do it from the Excel interface without VBA.
Under the Data tab, click on Connections.
From the Workbook Connections dialog, click Properties.
From the Connection Properties dialog, click Definition.
Browse for a connection file and then select a table.
That's it.
If your data source is inside Excel on another sheet and you're using OLE DB Query, you might find changing the data source impossible (which was the case with me).
To change the data source in this instance, you need to click on Resize Table under the Table Design tab in Excel, as can be seen below:
When you click on this, you are able to change the range of your query, as can be seen below:

Excel 2010: Replace a table by an external connection without impacting other sheets

I have a big workbook with a lot of data. In one sheet I have a table. This table is used for many Pivot tables used in other sheets, which are also used in other sheets.
The data for the table was copied manually regularly. I now have a external connection to import automatically the data but I'd like to avoid impacting other sheets.
How can I use my external connection without losing my table?
Thank you for your help
This might be a helpful workaround. I have successfully done this but it may require a bit of rework and not be the exact answer you expect. (I am using Excel 2010).
The reason for a workaround is I assume this is for a regular table (not a pivot table) as the source table. Unfortunately, I don't believe the switching connection options work for regular tables in Excel 2010.
Recreate a new table just below the other in the same worksheet by going to the Data tab > Get External Data > Existing Connections
Select your data connection (assuming it has been created) then select how you want to view the data. ie: Table
Place in your existing worksheet. Use your old table as a reference to reconnect all the connections to your other sheets, then delete the old table.
At this point, I find it easier to rebuild/copy those existing links to the new table with external data.
The good news: If your source table is a pivot table or pivot chart with an existing connection, you can easily change the table to have an external data connection (and switch between data connections).
For a pivot table with an existing connection you wish to change, select a cell in the table. In the ribbon above in 'PivotTable Tools' > Options tab > Change Data Source, you will be able to select this and reconnect to another source under 'Choose connection'.
For a pivot table with static data to introduce a new connection, I would suggest a similar workaround above.
I hope this works for you.
I'm going through this too. I've done some testing, and this is the approach I am going to take.
Save copy of file (just in case!)
Create a new sheet, and create link to your database, and have it entered as a table on this new sheet
Make sure your old table (manually entered) matches the same layout as the table with the data you are connecting to (same column order and column names)
For each pivot table, change the source to the new table (it should keep all of your setup the same if the columns are labeled the same)
Do a find and replace to change all formula referencing to the new table name.
Change any code in VBA that references the old tables
This should result in the least issues while making the changes. Just don't forget the first step!
If both connections/query are SQL or PostgreSQL, you can simply copy the query code from the new query to the old query. Then you do not even have to replace anything. "Edit" - "Advanced editor"

How to select entire excel spreadsheet for pivot table?

I want to be able to select and reference all of the tabs in my excel spreadsheet (to get totals of everything), but the data source only allows one tab to be selected... is there a way to select and use the entire workbook in the pivot table?
Thank you!
You actually just have a data formatting problem. You're using tabs to separate devices by departments instead of simply creating a department field/column and putting everything in one tab. The data was likely delivered to you that way, but don't let the delivery format define the true working format of the data.
Combine everything in one tab, and then you'll be able to use the data in a pivot table just fine.
If you have more data than will fit in a tab, put it in a database such as MS Access, MS SQLServer or mySQL, and then tell excel to use the database as the pivot table source.
I think Jonathan M has the best answer, but here's a way to do it using SQL that I've used successfully.
I don't know any easy way of doing this, but you could write a macro to copy and paste all your existing sheets onto a single new sheet (assuming there's enough room on a single sheet).
In 2007 Multiple Consolidated Ranges isn't in the default pivot table window. You need to create your pivot table, click on it, hit Alt + D, then P. Click back to step one and you'll have the option for multiple consolidated ranges.
Select the data on any of the one sheet and hit Alt D > P. It will show you Step 1 of 3 for PivotTable Wizard. Now select Multiple Consolidation Ranges and hit Next.
Select and add different fields from different tabs and it will create a consolidated range for your PivotTable and then you can run your PivotTable based on data located on different tabs of sheet at the same time.
Hope it helps.

Resources