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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors