Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Using Power BI variable in Python Script

Hi there,

 

I was trying to see if we could run a Python script in PowerBI using a PowerBI variable as part of the script.


For instance, the script would be:

print({Sum of Sales Variable})

 

The end goal is to have a Predictive model written in Python that runs within PowerBI based on input parameters from the dashboard. That way the business user would just have to select an input value, click "refresh" and the model would re-run using that input value. Then the visualizations would get updated on their own.


Any advice on how to do that?

 

Thanks!

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may just try Create Power BI visuals using Python.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks, @v-chuncz-msft . 

 

I have tried it and was able to use the parameter there, but I want to use the PowerBI visualizations. 

 

Can you re-integrate data frames from the Python viz as PBI data table? Or is there a way to integrate the parameter into the Python script when loading data tables?

Thanks!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.