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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.