Automatically create PowerBI dashboards using the .pbir file type
Project description
Power Bpy 
Do you wish you could build dashboard with python or R, but can't because the client specifically asked for Power BI or your employer only supports publishing Power BI? Do you love love love Power BI, but wish there was a way to automatically generate parts of your dashboard to speed up your development process?
Introducing Power Bpy, a python package that lets you create Power BI dashboards using functions 💪 instead of a point-and-click interface 🥹. Dashboards created using these functions can be opened, edited and saved normally in Power BI desktop.
This package uses the new .pbip/.pbir format with TMDL enabled. This stores dashboards as directories of text files instead of binary files letting you version control your dashboards! 🥳 These features are still preview features, so use this with caution until there's more clarity from microsoft about what they're going to do with .pbir and tmdl.
Features
Currently the package has functions that let you do the following without opening Power BI 🥳:
- Create a new dashboard
- Import data from
- csv file stored locally
- csv file stored in Azure Data Lake Storage (ADLS)
- Power BI table stored as a Tabular Model Definition Language (TMDL) file
- Add a page
- Add background images to a page
- Add visuals to a page
- charts
- slicers
- cards
- maps
- text boxes
- buttons
Dependencies
Before you can start to build power BI dashboards using this package's functions you'll need the following:
- Python and pip installed and on path
- Git installed and on path
- Power BI Desktop (You can create the dashboards without this, but not view them).
Power BI settings:
You'll need to enable some preview features in Power BI Desktop. Navigate to File > Options and Settings > Options > Preview features and enable the following options:
- Shape map visual
- Power BI Project (.pbip) save option
- Store Semantic Model using TMDL format
- Store reports using enhanced metadata format (PBIR)
Run the example
This example assumes you are on windows. All the code below should be entered in command prompt or put in a batch script.
- Create a new folder to store all the files you'll need.
:: create a new folder
mkdir automatic_PBI_dashboards_example
:: move into the new folder
cd automatic_PBI_dashboards_example
- Clone the files from github.
git clone https://github.com/Russell-Shean/powerbpy
- Activate venv.
The following is taken from this tutorial. We'll use venv to install the python package in an isolated environemnt.
:: create a virtual environment
py -m venv .venv
:: activate the virtual environment
.venv\Scripts\activate
:: For extra credit, verify that venv is working
where python
- Make sure pip is installed and up-to-date.
Pip is the tool we'll use to install the package.
:: install and/or upgrade pip
py -m pip install --upgrade pip
:: check version number (and confirm it's working)
py -m pip --version
- Install the package.
This package isn't on pypi yet, so you'll need to install it from Github
```dosbat
py -m pip install git+https://github.com/Russell-Shean/powerbpy.git#egg=powerbpy
After the package is on pypi, you'll be able to install it using this:
py -m pip install powerbpy
- Create the example dashboard. Run an example script to generate an example dashboard.
py powerbpy/examples/create_example_dashboard.py
- Open the dashboard.
Open the dashboard to confirm everything worked.
start test_dashboard/test_dashboard.pbip
- Refresh data models
After Power BI opens, you'll see a banner that looks like this:
Click Refresh now
If everything worked you should have a dashboard that looks like this:
Next steps
The code used to generate the dashboard is stored here
Try building your own dashboards with these functions and let me know what happens!
Feedback
I welcome the following feedback:
- Pull requests to add features, add tests, fix bugs, or improve documentation. If the change is a major change create an issue first.
- Issues to suggest new features, report bugs, or tell me that the documentation is confusing 😅
- Power BI feature requests. I need help from Power BI developers who don't neccesarily have experience with python or github. I don't really know Power BI 😅, so please feel free to suggest new features. It would be really helpful if you could include a .pbix file that has the feature or even better a git diff of the dashboard before and after the change.(Use the .pbip format)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powerbpy-0.1.0.tar.gz.
File metadata
- Download URL: powerbpy-0.1.0.tar.gz
- Upload date:
- Size: 32.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
887ec50f93f945fb1efabae2d4c1b2519e4c8fc53cb0343e210493283ffba393
|
|
| MD5 |
ec433567ffe3f5403cdc1176e9ebdabd
|
|
| BLAKE2b-256 |
0a790b9311c378b7f9ef39cd91f3e1cd28cf318e2bce54db0f918c7dde5c03c5
|
Provenance
The following attestation bundles were made for powerbpy-0.1.0.tar.gz:
Publisher:
python-publish.yml on Russell-Shean/powerbpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerbpy-0.1.0.tar.gz -
Subject digest:
887ec50f93f945fb1efabae2d4c1b2519e4c8fc53cb0343e210493283ffba393 - Sigstore transparency entry: 198409983
- Sigstore integration time:
-
Permalink:
Russell-Shean/powerbpy@4ab631d3895a837b090b42eb55ee92424697c82d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Russell-Shean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4ab631d3895a837b090b42eb55ee92424697c82d -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerbpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: powerbpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 69.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fb55472ec9e9973e7846c06b00313f964abb1be48df2524a8189c9189ef4010
|
|
| MD5 |
4aef15f4e7c7ee8096ce6c49b4038081
|
|
| BLAKE2b-256 |
341b43eebaf374b7f2aa850a0fbb7380e744385c422507741a150c5460037fdc
|
Provenance
The following attestation bundles were made for powerbpy-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on Russell-Shean/powerbpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerbpy-0.1.0-py3-none-any.whl -
Subject digest:
8fb55472ec9e9973e7846c06b00313f964abb1be48df2524a8189c9189ef4010 - Sigstore transparency entry: 198409984
- Sigstore integration time:
-
Permalink:
Russell-Shean/powerbpy@4ab631d3895a837b090b42eb55ee92424697c82d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Russell-Shean
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4ab631d3895a837b090b42eb55ee92424697c82d -
Trigger Event:
release
-
Statement type: