Forum Discussion
Use Python in Power BI connecting directly to my Power BI dataset
I want to use Python in a Power BI dataset that has already been cleaned (ETL via Power Query). I don't want to connect Python to an external dataset or database, but to the dataset that is ready in my Power BI (pbix file).
Is is possible to use Python in Power BI connecting it directly to my Power BI dataset? In other words, I want to open my pbix file and add a Python script that will perform some calculations in the dataset that is being used in the pbix file.
Tks for your answer, lbendlin! Let me see if I understood:
a) The best way to create a new table or a calculated column, using Python scripts, is in Power Query.
b) In Power BI desktop (after applied the ETL steps from Power Query), Python scripts should be used only to render a chart, diagram, table etc. Not to add tables or calculated columns to my tables.
c) About your NOTE 2. If I publish or share my report, the Python script will only run if I have a Personal Gateway.
Can you please add your comments to these statements?
4 Replies
- lbendlin
Super User
That is available for Power Query (where you can run Python scripts against the appled steps) and for the User interface as well where you can add a Python visual to your report.
NOTE 1: The Python visual MUST render something. Just running a script will not be sufficient.
NOTE 2: If you want this to refresh in the service then a Personal Gateway is mandatory.
- WMMRegular Visitor
Tks for your answer, lbendlin! Let me see if I understood:
a) The best way to create a new table or a calculated column, using Python scripts, is in Power Query.
b) In Power BI desktop (after applied the ETL steps from Power Query), Python scripts should be used only to render a chart, diagram, table etc. Not to add tables or calculated columns to my tables.
c) About your NOTE 2. If I publish or share my report, the Python script will only run if I have a Personal Gateway.
Can you please add your comments to these statements?- lbendlin
Super User
b) should => MUST
The rest is accurate.