Adding Power Pivot Data to the Data Model?

Maggie Barr

Board Regular
Joined
Jan 28, 2014
Messages
188
Hello and thank you in advance if you can help,
I am using MS Office 2019 on a PC. I am somewhat new to Power Query and Power Pivot, and I am trying to analyze a data set in a way that as much of it as possible is "automatic". I currently have to run multiple pivot tables and bring information from them, by hand, into a final summary table. I would like to add my pivot tables to the data model so that I could potentially build on the model, and thus be able to bring data from those directly into a final summary. When I go to insert a pivot table, use this workbook's Data Model, Existing Worksheet, the little box for Add this data to the Data Model is grayed out. Does anyone know why that is and how I can get the data into the model. I have all my pivot tables built, and if there were a way to select the table and add it, that would be great, but, if not, I can recreate them, it is just not giving me the option. My pivot tables do have more than one field as a header (meaning two rows), so I do not know if that will pose a problem.
Any help would be appreciated,
Thank you,
Maggie
 
I am very happy to inform you that your comment of "load them as Power Query queries" made me go back to looking into this option. I had been able to create reference queries that would show me what I needed, but I was unable to link them through relationships back into the data model to allow for the display of the data from different queries within the same pivot. Well, I figured it out (mostly)! I have a locations table lookup that is unique at the Block Name/Code level, but my analyses actually look at the Region and Block Type, not the block name, so I created a reference query that grouped these so that I could then create the relationship needed, but I also had to create a merged columns of the region; block type so that I could base the relationship on that (one to many) but still allow the links to follow through. That being said, I was still having a hard time getting the two separate queries to put data in by reading the species list accordingly, but then I realized I needed a reference query to the full dataset that created a distinct species list that appears in the data, and then link that to those other two queries based on species, and use that distinct species list as the rows. Now I can create one pivot table that has the columns from what would have been two pivot tables.



That is a common, and powerful, technique in Power Query. I didn't mention it but in my little tests that I did with your data that is exactly what I was doing. Take a table with say Species in, strip out all columns but the Species, remove duplicates, add an index column, voila we have a Species table that we can add to the datamodel. We can then replace any other tables that have Soecies in them with a SpeciesId by merging with the Species table, extract the id, anbd remove the old text column. Add more relational, usable.


I think I am at the point that I may need to know more about writing measures, if that is the tool to use. I would like to get the percentage of blocks each species is observed in the pivot as a column.


Whilst I would not siscourage you from learning DAX measures, you might not need a measure for that. Take a look at pivots, right-click an item in the pivot list Values pane, and then click the Value Field Settings. There you can see that you can pivot as a percentage of the row or column. More complex stuff does need DAX, and should you have the time, it will add power to your analysis toolbox.


I created yet another reference query that parsed the data down and provides the # of blocks with data for each region; block type. I have the # of Blocks observed in for each species in each region; block type in one query, but I need a column (I think in that query) that will look for the # of blocks with data in another query that matches the region; block type field to do the percentage calculation. I hope this is making some sense, and if it does, I would appreciate any advice.


Again, I don't understand why you would do this. If you have a table that contains all of the attributes of a block, the type, region, species, your pivot can give you the percentage directly. Am I missing something here?
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
theBardd,
So, I simply had to merge one query with the other to get the field into the query needed to calculate the percent. My problem now is that, when I try to pull that into the Pivot table, it wants to perform a calculation with that % thus changing it from 50% to 0.5. I do not know if a way to get a pivot to display just the contents of a field you drag in, and from what I have searched over the years and now, there is no way to do it. Any advice would be appreciated.
Regards,
Maggie
 
Upvote 0
Got it, Value field setting, show values as tab, no calculation, number format, % with 2 decimal places.
I do not have the full report format yet, but the huge part of the report is now automatic.
Always so grateful to everyone here at Mr. Excel for their time and effort to help!!!
Best Wishes,
Maggie
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top