Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there,
I have a script that performs some calculations (do normalization) in python. The output of the script is in the data frame. I want to run that script in Power BI in such a way that whenever new data comes into the tables of power BI, the script runs. I have two issues:
Any help would be really appreciated.
Hi @Dunner2020
If the above posts help, please kindly mark it as a answer to help others find it more quickly. thanks!
If not, please kindly elaborate more.
Hi @Dunner2020
There is a Python visual you can use which is in the Visualizations section.
1. The pyton script will run only when the report page containing it is open not before that.
2. PFB the code to take the data from tables.
@Anonymous @Greg_Deckler ,
Here is a table as shown below:
Now I want to run my Python scripts when report loads/runs that perform calculation after reading data from an above mentioned table and save the results into a new table. My question is how can we read the data from the above-mentioned table using Python code. @Anonymous I tried your code, but it looks like a R code. I tried to convert into Python but it did not work
@Dunner2020 - Right click the query that creates that table and choose "Reference". Now in this new query, insert a Python step into your query.
https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-in-query-editor
@Dunner2020 - You have 2 options
Which option is correct or whether either will work is not immediately apparent. You might wish to provide more detail.
If you go with the 1st option, go into Power Query Editor, Transform tab, look all the way to the right, the last option in the ribbon is "Run Python script". No clue if this works for dataflows actually.
Another consideration, don't use Python.
@Dunner2020 , not very clear to me
https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts
https://en.blog.businessdecision.com/how-to-use-the-python-integrator-in-powerbi/
https://towardsdatascience.com/using-python-in-power-bi-ee95a6b71443
https://powerbi.microsoft.com/en-us/blog/python-visualizations-in-power-bi-service/
https://powerbi.microsoft.com/en-us/blog/python-visualizations-in-power-bi-service/
https://www.ahaapps.com/microsoft-power-bi-service-with-python-visualizations/
@amitchandak , I want to take data as an input in my Python script from the tables present in the data flow model of power BI.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 35 | |
| 34 | |
| 31 | |
| 27 |
| User | Count |
|---|---|
| 135 | |
| 102 | |
| 67 | |
| 65 | |
| 56 |