Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. 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.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 5 | |
| 4 | |
| 4 |