I learned a lesson the hard way: I shouldn’t change field names and data types in Power Pivot on tables that were imported using Power Query. My changes broke the connection between the two tools, so when I refreshed a query in Power Query that was set to load the results to my data model it caused a new/duplicate table to be created in my data model instead of updating the original table.
I already had Power View reports built off of my model that I didn’t want to rebuild, and I didn’t want to leave a duplicate table in my model, but I needed to make the data model refreshable. The issue can be fixed, but it’s a bit tedious:
- Create relationships for the new table to match those of the old table
- Rename the old table to something else
- Rename the new table to the original table name (usually it has a 1 after the table name)
- Rebuild or move any calculated measures to the new table
- Delete the old table
I was fine until I got to #4. You can’t just copy a calculated measure to a new table by cutting and pasting. You can copy the formula from the formula bar and paste it into a cell on another table, but you will get a warning that you can’t have two measures with the same name.
Going this route means pasting your measure, renaming the old measure, and then renaming the new copy of the measure to the original name. Due to the lack of the ability to filter data in Power Map, I had to create several calculated measures in my data model to limit the data shown in my map. The idea of copying, pasting, and renaming several dozen measures was less than appealing.
It should be noted that in the current version of Power Pivot, you can put calculated measures on any table in the model without affecting the result of a query using the measure. The table in which it is located is more of an organization issue rather than a technical calculation issue.
I thought there must be a better way to move a measure. I looked through all of the buttons on the ribbon in the Power Pivot window and saw nothing helpful so I turned to Google (yes, I still choose Google over Bing). A TechNet article provided just the guidance I needed:
“To move a measure, you can cut and paste the formula in the Calculation Area. You can only move it to a different location in the Calculation Area of the table in which it was created. You cannot move a measure to different table in this view; instead use the Measure Settings dialog in the PowerPivot ribbon in Excel to change the association.”
The Measure Settings dialog box held the answer, although I found these settings under the Calculated Fields -> Managed Calculated Fields.
It contains a drop-down box that allows me to choose the table where the definition of the measure should be stored. This was a much quicker way to quickly move several calculated measures to another table in Power Pivot.
I have built several Power Pivot models and never run into this particular situation. I can’t say I’m glad it happened, but I can appreciate that it reminded me that there are useful things on the Power Pivot ribbon in the Excel window that aren’t accessible through the Power Pivot window.
Thank you so much for publishing that, you saved me tons of time. 🙂
Glad I could help!
… of course you can always try right-clicking on the measure in the PowerPivot Field List and ‘Edit formula…’ will take you where you want to go. I guess right-clicking instead of searching the ribbon sort of shows my age but oh well
Thanks for the comment! I do remember that being true for Excel 2010, but I believe that option is not available in 2013. Let me know if you have found otherwise.
I love this! thanks a lot 🙂
thanks ! this is super useful – I had been looking for a way to store all my measures neatly together, and you provided it (just create a dummy table and move all measures there)