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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
SergioTorrinha
Resolver II
Resolver II

Python Visuals | Dynamic Parameters

Hi all!

Consider the following scenario:

1. You have a python visualization in a Power BI desktop report, from where you are pulling a dataframe/table from any data source of your choosing and plotting a chart;
2.  In the same dashboard/page where the python visual from 1. is in, you have a slicer from where a user can select one value of his choosing.

My question:
How does one configure/setup Python script or PBI desktop objects, in order to pass the selected objects in 2. into the visual in 1. ?

You can refer to image below for the scenario I have right now:
Capture.PNG

What have I tried before coming for help:
I created a metric to select the value chosen by the user in the Age slicer:

SelectedAge = SELECTEDVALUE( df[Age] )
and I added this metric in the Python visual (I thought it would then be possible to invoke the metric through Python script).
However i get the following error:
Capture.PNG

Tkx for your help, in advance.
4 REPLIES 4
amitchandak
Super User
Super User

@SergioTorrinha , refer if these can help

https://community.powerbi.com/t5/Desktop/Prompts-to-Power-BI-using-Python-scripts/td-p/654059

https://community.powerbi.com/t5/Desktop/Pass-Python-Variable-as-a-query-parameter-in-Advance-Editor...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi all!

I'm still looking for a solution.
Does anyone has ahint on this bugger?

Tkx in advance 🙂

up up!

 

I'm still struggling to find a solution for this.

 

Does anyone has any idea?

Thanks

Helpful resources

Announcements
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.