image

“Daxur an edraith calculatem! Daxur grabbar i formulayen!”

Great Question from the Forums

***UPDATE:  There are at least three better ways to do this, see the followup post HERE.

image

Another Question from the MrExcel PowerPivot Forums (Link)

In the question above, Mike was asking if there was a way to trace formula dependencies in PowerPivot.  The official answer is no (there may be something if you import your workbook into Visual Studio as a Tabular BISM Project, but I haven’t really been dong that yet.)

But who is content with official answers when there is magic to be had? Smile

How to Get All of Your Measure Formulas as One Text File

1) Save and close your workbook

2) Rename the XSLX (or XLSB/XLSM) to .ZIP

image

Yielding…

image

3) Double click to open the ZIP file in Explorer

image

4) Drill down into the CustomXml folder:

image

Showing you a bunch of XML files with similar names.  We want the ones named Item1.xml, etc.:

image

5) Find the biggest of those ItemN.xml files

We actually only care about one of those files. It is USUALLY the largest of the files.

image

In rare cases you get unclucky and it isn’t the largest, but 95% chance it’s the biggest.

6) Copy that file out of the ZIP and into a “real” folder like your Desktop

7) Open in NotePad, WordPad, Notepad++, etc.

image

Notepad works if you don’t have a more “sophisticated” text editor

8) Find the text “CREATE MEASURE”

image

image

9) Copy every line that starts with CREATE MEASURE into a new text file

And that’s it, you’ve got them Smile

Notes About Certain Symbols

You will see things about your formulas that aren’t quite the same as in the PowerPivot UI.

For instance a greater than symbol “>” will be represented in the text as “>”

In fact any of these symbols will be transformed:  <   >   &   <=   >=

And maybe the | operator as well, but I don’t have an example handy.

Can we modify this file?

Come on, didn’t you see the warning?

image

Oh, you’re THAT type of person, the kind who ignores warnings?  Yeah, me too Smile

But I’ll tell you right now – if you modify this file it will NOT work.  Your edits will be completely ignored.

There’s a workaround for that too of course, muhaha.  More on this in a future post.