Documenting your Power BI model

Ian SantillanIan Santillan
4 min read

Marc Lelijveld created an external tool to help document your Power BI model

Document your model

How it works

  1. Open a Power BI solution that you want to document

  2. In the Top Ribbon under External Tools, click Document Model.

  3. After the click, you might see a PowerShell window appear and disappear quickly. This is the process that triggers all other actions to happen.

  4. At execution of the script, a json file is dumped in the defined location. By default this is C:\temp but you might have changed this to your own preference. See next chapter as well.

  5. A new Power BI Desktop instance will open and the .pbit template file will open directly. Here again, the location for the dumped file needs to be entered. Default location is listed in the template.

  6. You can click load and this will start loading the report. You will be asked for Authentication to the source as well. Please choose Windows authentication here, as we query the local host on your computer.

  7. The provided Power BI template report will load. In the next chapter more about the template and how it looks like.

Integrate the External tool

In the Power BI Desktop July release, the External Tools capability was released (in preview).

Step 1: Download necessary files
Download everything you need from this GitHub repository.

  • The Power BI Template file:
    ModelDocumentationTemplate.pbit

  • The PowerShell Script:
    Data-Marc_WriteConnectionDetailsToFile.ps1

  • External Tool integration file:
    Data-Marc_ModelDocumentor.pbitool.json

Step 2: Upload the integration file
The External Tool integration file is needed to get the button in the Power BI ribbon. In order to achieve this, you need to upload the Data-Marc_ModelDocumentor.pbitool.json file in the External Tools folder. For me this location was:
`C:\Program Files (x86)\Common Files\microsoft shared\Power BI Desktop\External Tools

While uploading the files, it can be that Windows asks you to login with admin privileges before you can continue. This is mandatory to upload the files. If you cannot do this yourself, please contact your administrator.

Step 3: Upload other files to temp folder
The two other files are referenced by the PowerShell script and need to be uploaded to a specific location as well. I have put them in a temp folder since this will only be used during script execution.

Please upload the PowerShell script and the Power BI Template file to: C:\temp. If this folder does not exist or you cannot upload files to the folder, you can put them in another location of your preference. Please know that this requires to do some minor edits to the PowerShell script as well.

Identical to the previous step, Windows might ask you to authenticate with admin privileges before you can continue.

Step 4: Restart Power BI Desktop
You have applied all required steps by now. Assuming that you did not change any of the file location, a new button will appear in the Power BI Desktop top ribbon for External Tools. In case you had Power BI running already, please restart Power BI desktop first.

If you made changes to the file locations, please read the next chapter first.

You’ll most likely run into this error here:

Tables - Query 'Tables' (step 'Renamed Columns1') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination. and Loading blocked by failures with other queries.

This error is caused by the Power BI Privacy Levels settings and has nothing to do with the authentication. While I don’t recommend ignoring Privacy Level settings, in order to fix this, we have to change some settings in Power BI Desktop. Make sure to come back here and set this back to how you had it before. Please follow these steps:

  1. Open Power BI Desktop

  2. Go to File

  3. Options & Settings

  4. Options

  5. In the Global Settings go to Privacy

  6. Change the Privacy Levels to “Always Ignore Privacy Level Settings”

  7. Close all Power BI Desktop Instances and retry :)


https://data-marc.com/model-documenter/

0
Subscribe to my newsletter

Read articles from Ian Santillan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ian Santillan
Ian Santillan

Data Architect ACE - Analytics | Leading Data Consultant for North America 2022 | Global Power Platform Bootcamp 2023 Speaker | Toronto CDAO Inner Circle 2023