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
I'm trying to create a Power BI report where a Python script generates a table by running in Power Query, but the script requires a user-defined input parameter.
The input range is wide, and the execution time of the Python script is high, and it impossible to run it for all possible ranges.
What is the best way to ask for the input parameter from the user?
Solved! Go to Solution.
Hi @Omid_Motamedise ,
Python scripts in Power Query run during data refresh, not interactively. So the parameter must be set before refresh.
If the script is too slow for large ranges, consider caching results or preprocessing data outside Power BI.
Another approach could be-
Create a table with possible input values then use a slicer to let users pick a value then DAX to pass the selected value to a measure or calculated table.
Hope this helps!
Hi @Omid_Motamedise ,
Python scripts in Power Query run during data refresh, not interactively. So the parameter must be set before refresh.
If the script is too slow for large ranges, consider caching results or preprocessing data outside Power BI.
Another approach could be-
Create a table with possible input values then use a slicer to let users pick a value then DAX to pass the selected value to a measure or calculated table.
Hope this helps!
You can’t use input() in Power BI. Instead:
Use Power Query Parameters → create a parameter, pass it into your Python script, refresh with user-defined value.
Or use a Slicer → let users pick a value/range, filter data, then run the Python script only on that subset.
👉 Best choice: Parameters for free input, slicers for predefined values.
@Shahid12523 Thank you for your reply. However, it isn’t an interactive experience for the user, as it still requires going into the Power Query section to change the parameter value, and the slicer also needs to consider all the combinations for the parameter, which in this case is impossible. I’m looking for a more user-friendly, interactive approach.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!