Re: Best Practice Analyzer Report

Frequent Visitor
3765 Views
mikova
Microsoft Employee
Microsoft Employee

Best Practice Analyzer Report

Download this notebook from: semantic-link-labs/notebooks/Best Practice Analyzer Report.ipynb at main · microsoft/semantic-link-l...

Install the latest .whl package

Check here to see the latest version.

%pip install semantic-link-labs

Import the library and necessary packages

import sempy_labs as labs
import sempy_labs.report as rep

Collect semantic model Best Practice Analyzer stats

Collect stats for all semantic models within a single workspace

labs.run_model_bpa_bulk(workspace='Workspace 1')

Collect stats for all semantic models within a list of workspaces

labs.run_model_bpa_bulk(workspace=['Workspace 1', 'Workspace 2'])

Collect stats for all semantic models within all accessible workspaces

labs.run_model_bpa_bulk(workspace=None)

Create a Direct Lake semantic model (called 'ModelBPA') for analyzing the Best Practice Analyzer results

labs.create_model_bpa_semantic_model()

Create a Power BI report called 'ModelBPA' based semantic model created in the previous cell, which can be used to analyze the Best Practice Analyzer results

rep.create_model_bpa_report()
Note: The 'BPAReport' Power BI report is located within the workspace in which the default lakehouse attached to this notebook resides. Navigate to this workspace to open the report and view the Best Practice Analyzer results.
 

Going forward, you just need to run the 'run_model_bpa_bulk' function which will append BPA results to the 'modelbparesults' delta table in your lakehouse. Since the 'BPAModel' semantic model is in Direct Lake mode, the data will appear in the semantic model and report automatically without any need for processing the semantic model.

 

afernand0
Frequent Visitor

Thanks for sharing the code. This is super helpful. I get the error below when running the 

labs.run_model_bpa_bulk(workspace='workspace name'). Any idea how I can fix it?
ArrowInvalid: ('Casting from timestamp[us] to timestamp[ms] would lose data: 1747114480485629', 'Conversion failed for column Timestamp with type datetime64[us]')

 

avatar user