Source control for M and DAX code

Although the version history of M and DAX code within Power BI Desktop files is technically available via OneDrive for Business, some BI organizations may also choose to utilize more robust version control tools on essential queries and measures. For example, the M query used to retrieve the Customer dimension table could be saved as a .pq file and synchronized with a team project code repository in VSTS. This approach would improve the visibility of the code to project team members and, for M queries, provide the code editing benefits of colorization and IntelliSense.

In the following screenshot, a Power Query project containing multiple folders of PQ files (M queries) has been added to a solution in Visual Studio and synchronized with a Git repository in a VSTS project:

Power Query project in Visual Studio

In this example, all M queries (.pq files) are checked into source control via the lock icon in the Solution Explorer window except for the Customer query which is pending an edit (checkmark icon). The revised Customer dimension table query would be implemented within the Power BI Desktop file first but also saved within the Power Query project in Visual Studio.

As an enterprise tool, many version control options are available in Visual Studio, including Compare with Unmodified... and Blame (Annotate). By clicking Commit, a message describing the change can be entered and the updated file can be synced to the source control repository in VSTS.

In the following screenshot from VSTS, the updated Customer dimension query file (Customer.pq), including the latest commit date (5 minutes ago), is visible:

Files view in VSTS

Given the additional maintenance overhead, enterprise source control tools may not be suitable for smaller, simpler Power BI projects or the very early stages of projects. In addition to sound requirement gathering efforts, teams can minimize the maintenance effort required of the version control project by only including the essential M queries and DAX measures. For example, only the DAX measures containing fundamental business logic, such as the base measures described in Chapter 3Designing Import and DirectQuery Data Models, could be saved as (.msdax) files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.70.170