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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Need to pass the variables dynamically into sql script as a source into Power BI Desktop

Hi Team,

I have a script which has the date variable mentioning as below image which are highlighted . If I pull this script into Power BI Desktop(SQL Source-Query) How can I pass the values into this variable from Power BI Desktop using the filter Slicer. Please do the needful asap as I have ambiguity on this .Thank You so Much.

chandru123_0-1633592192470.png

 

3 REPLIES 3
v-xiaoyan-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please take a look at the following link to see if it helps, and hopefully some other expert in Power BI will be able to solve it.

 

How-do-I-pass-parameters-to-my-SQL-statement 

 

Hope it helps,


Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi Team,

This is the simple exampel to understood

Declare @Employee varchar(max)

Set @Employee = 'Filter Value from Slicer Visual from Power BI'

Select top 10
EmployeeID,EmployeeAddress from Employee where EmployeeName=@Employee

If we select Employee = 'Dhoni' from Power BI Slicer Visual , the sql source script should as follows


Declare @Employee varchar(max)

Set @Employee = 'Dhoni'

Select top 10
EmployeeID,EmployeeAddress from Employee where EmployeeName='Dhoni'

If we pass multiple values like Employee = Dhoni,Kohli then the sql query should be as follows 

Declare @Employee varchar(max)

Set @Employee = 'Dhoni','Kohli'

Select top 10
EmployeeID,EmployeeAddress from Employee where EmployeeName in ('Dhoni','Kohli')

Please do the needful . Thank You.




Anonymous
Not applicable

I have seen this from different source and its posted in 2016 . I hope any chances that can available now

chandru123_0-1633596380579.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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