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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Guilherme8482
New Member

How to use dynamically filtered database in a python script

I'm doing an analysis that takes a subset available from my Power BI data source and generates a table using python (which performs complex calculations).

But my question is about how to bring filtered data into the Python script.

I'm using the query transformation, which has a Python script option to generate my calculation.

The problem is that when I use the filter panel (inside the panel), the Python script is never updated and the data is still wrong.

I tried to use Visual Python, but I don't want to see the Python graphs, I need to use the python data to then visualize it in the Power BI graphs.

 

I've looked for several solutions, but I can't get it to work.

 

For example, here is a code I need to run:

# The data must be filtered before applying my python script

dataset['SMA'] = dataset.VALUE.rolling(2, win_type='gaussian').sum(std=3)

# After that, I need to show using Power BI charts

 

1 REPLY 1
Anonymous
Not applicable

I am also looking for a similar solution. What did you do? Thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.