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 nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.