Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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

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

     

2 Replies

  • davehus's avatar
    davehus
    Icon for Memorable Member rankMemorable Member

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

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