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
Hello,
How can I use a Parameter (StartYear) in this SQL Statement in Power BI?
Hello,
Yes but what about adding a parameter for the Start Year to load data?
Michael
Hi @mikebi ,
Thanks for the reply from adudani , please allow me to provide another insight:
When writing your SQL query within Power BI, you cannot directly embed Power BI parameters into the SQL code.
You can use Power Query Editor to dynamically generate your SQL query string based on the parameter value.
In Power Query Editor, select Advanced Editor.
Enter content similar to the following in the page that opens.
let
ParameterHere = Number.ToText( #"StartYear Parameter"[Value] ),
SqlQuery = "SELECT * FROM YourTable WHERE Year >= " & ParameterHere,
Source = Sql.Database("YourServer", "YourDatabase", [Query=SqlQuery])
in
Source
Replace "YourTable", "YourServer", and "YourDatabase" with your actual table name, server, and database names.
Just refresh it after setting it up.
If you have any further questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
hi @mikebi ,
reference this: Making data source parameters easy in Power BI Desktop (youtube.com)
let me know if this resolves the issue.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 22 | |
| 22 | |
| 18 | |
| 17 | |
| 13 |
| User | Count |
|---|---|
| 61 | |
| 52 | |
| 47 | |
| 41 | |
| 38 |