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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
CarterB13
Frequent Visitor

Setting up Parameter in Query on Power BI desktop

Hey, I am trying to create a Client parameter in my dataset, that when you change the client name on the parameter, all the tables update to only have the data for that client.  I created a server parameter and a client parameter. so P_Server & P_Client. Below is the query. This is actually using server views rather than tables, so not sure if that matters.   

 

(I made a post already, but it was marked as spam, so not even sure if actually posted. )

 

 

let
Source = Sql.Database(""&P_Server&"", "DW_Target", [Query="select *#(lf)from Table.Table#(lf)WHERE [Client]="&P_Client&""])



in
Source

 

 

However I keep getting the following error:

 

DataSource.Error: Microsoft SQL: Incorrect syntax near the keyword 'from'.
Details:
Message=Incorrect syntax near the keyword 'from'.
ErrorCode=-2146232060
Number=156
Class=15

1 ACCEPTED SOLUTION
davehus
Memorable Member
Memorable Member

Hi @CarterB13 , Your code looks fine there. Does the &_Client& parameter have single quotes in the parameter itself? As they need to be there.

 

View solution in original post

2 REPLIES 2
davehus
Memorable Member
Memorable Member

Hi @CarterB13 , Your code looks fine there. Does the &_Client& parameter have single quotes in the parameter itself? As they need to be there.

 

Thanks for the reply. Yes I caught that afterwards and that fixed the problem. The missing single quotes.  Thanks again.. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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