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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
peebes1
New Member

Using SQL to override a parameter built into the data source

My SQL Server database has an optional "fiscal year" parameter.  If no value is chosen at the database level, the default is to return data for only the current fiscal year.  I can't figure out how to use SQL to get Power BI to interact with the parameter and let me choose the fiscal year(s) I want.  If I use a SELECT statment with a WHERE clause for the fiscal year, it is too late, and the database is only sending through current fiscal year data.  In Tableau, I could use the OpenTable command (example below) to take control.  Is there a way I can get Power BI to do this as well?

 

OpenTable("Beneficiary"."Frequently Used Fields",
"Choose one or more Fiscal Years"= "[2023, 2024]"

1 REPLY 1
Akash_Varuna
Community Champion
Community Champion

The default behavior of Power BI’s SQL Server connector does not allow you to pass parameters directly into the database query. To address this, create a stored procedure in SQL Server that accepts fiscal years as input and dynamically retrieves data based on the parameter. Use Power BI to execute this stored procedure via DirectQuery and bind it to a parameter in Power BI for user selection.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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