top of page

Developing a Direct Lake Mode Semantic Model & Power BI Report with GitHub Integration

  • Jihwan Kim
  • Aug 6, 2024
  • 4 min read

In this writing, I aim to share my journey and experiences in learning and experimenting with the development of a Direct Lake Mode semantic model and Power BI report integrated with GitHub.


After learning from numerous YouTube videos and blog posts about developing a Direct Lake Mode semantic model and Power BI report, I struggled to find the best practices for further developing the semantic model and report within a Git (or GitHub) integrated workspace. I wondered if the Direct Lake Mode report could still be opened on a local computer after the workspace is under GitHub integration. If not, how could it be accessed from a local computer? Additionally, even if it opens, I questioned whether committing changes would still work after development.


Let's find out.


Here is how my Fabric workspace (Workspace name: Contoso) appears:

ree

When selecting the Golden data task, it displays as follows:

ree

The semantic model, named prod_semanticmodel_contoso, is a custom semantic model created from the gold_contoso Lakehouse.

And it appears as shown below. I have created relationships and a DAX measure named # customer.

ree
ree

Please note that I intentionally created this DAX measure incorrectly. I will also share how I learn to fix this DAX measure.


I created a Power BI report by clicking the "New report" button.

As described below, the sort order of the column [YearMonthShort] is incorrect, and the DAX measure [# customer] is also wrong.




I then connected the workspace to GitHub.

ree

And, I created a Power BI report by clicking the "New report" button in the sematic model.

As described below, the sort order of the column [YearMonthShort] is incorrect, and the DAX measure [# customer] is also wrong.

ree

I saved this report under the name "prod_report_contoso" and placed it in the Data visualize task.

ree

ree



As shown below, a new item has been added to the workspace. I committed the change to GitHub by clicking the "Commit" button.

ree


I checked the main branch in the GitHub repository, and it displays the changes I committed, as shown below.

ree

Seeing the definition.pbir file, it looks like below. It is connected to the semantic model folder in the local computer's repository.

ree

Let's try to open this file.

ree

It cannot be opened.


Let's try modifying the connection settings in the `definition.pbir` file as shown below, and then attempt to open it again.

ree

After making the changes, it now displays as shown below on the local computer.

ree


To obtain the connection code, follow these steps:


1. Download the Report:

- Download the report from the workspace to the `Downloads` folder on your local computer.

ree

2. Save as PBIP:

- Save the downloaded report as a `.pbip` file in the `Downloads` folder. This will create a folder named `prod_report_contoso.Report`.


3. Locate the Definition File:

- Navigate to the `prod_report_contoso.Report` folder.


4. Right-click the Definition File:

- Find the `definition.pbir` file, right-click it, and select "Edit in Notepad."


5. Retrieve the Connection Code:

- The connection code will be displayed in Notepad. Copy this code.


6. Update the GitHub Repository:

- Paste the copied connection code into the `definition.pbir` file in the GitHub repository.



Now it's time to correct the sort order of the [YearMonthShort] column and the DAX measure [# Customer]. When fixing the semantic model in the workspace, I prefer using Tabular Editor 3.

ree

When viewing the Pivot Grid, it displays an incorrect sort order and an erroneous result for the DAX measure.

ree

I fixed the DAX measure and adjusted the sort order, as shown in the images below.

ree
ree

The changes are not yet reflected because one more step is required: press `Ctrl + Alt + S`.

ree

It now displays the correct sort order and accurate result for the DAX measure.

ree

After refreshing the report on the local computer, it now displays the correct sort order and the accurate result for the DAX measure.

ree

I added one more visualization, as shown below, and saved the file.

ree

The changes are outlined below. However, be cautious when reviewing the modifications to the connection in the `.pbir` file.

ree

I attempt to discard the changes made to the `.pbir` file, then commit the remaining changes to main branch, and push them to the origin (GitHub repository).

ree


ree


The commits in the GitHub repository now displays as shown below.

ree


In the workspace, there is one update reflected due to the report modification. Click the "Update all" button to apply the changes.

ree

There is also one change detected because I modified the sort order and the DAX measure using Tabular Editor 3. Write a commit message and then click the "Commit" button. In this demo, I did not write a commit message. Let's see how this omission appears in the GitHub repository.

ree



The report now correctly displays the information, including the newly added visualization.

ree
ree

Finally, the GitHub repository displays the latest change commit as shown below, with no commit message provided.

ree




To summarize, I’ve tried to share how I learn to develop a Direct Lake Mode semantic model and Power BI report with GitHub integration. Here are my thoughts:


- Tool Preference: I prefer using Tabular Editor 3 for managing Direct Lake semantic models. This is because the model is initially created not on the desktop but directly in Power BI Service (or also can be created via Tabular Editor 3).


- Report Fixes: When fixing reports created directly on the web and integrated with GitHub, I find it useful to adjust the `.pbir` file connection as needed. This approach helps me because editing the report design on the desktop is more convenient.


- Exploration and Sharing: I recognize that there are various methods to configure and fix Direct Lake semantic models and reports. I welcome sharing different approaches and love to learn from your experiences.


I hope this help having fun in playing with Direct Lake Semantic Models and Reports.

Comments


bottom of page