Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Parameters in Direct Query

Hello Team,

 

I want to change my local server to on premise server using dataset parameters. I have loaded data using direct query. 

I could change my server with using parameter in import mode. I am trying to achieve same result with direct query but Power bi Service is not able to identify parameters when I use direct query.  Please let me know how I can achieve this.

  • GilbertQ's avatar
    GilbertQ
    6 years ago
    Hi there

    As far as I know there is nothing else at the moment unfortunately.
  • Anonymous's avatar
    Anonymous
    6 years ago

    Yes by using rest api you can update parametrs in direct query.

    Step 1- Take direct query mode and in advance option write a normal query.

    Step 2- Go to adavance editor and change that query with parameter.

    like

    let
    Source = Sql.Database("host name", "database_name",
    [Query="select * from [schema name].["& paramter 1 & "_retailername_"& paramter2 &"] (NOLOCK)"])
    in
    Source

     

     

    In the above example i chnage my direct query using parameter.

     

    If you want to chnage thease parameters using powershell plz follow the following link-

    https://github.com/mycodehub2205/Powershell-For-PowerBI/commit/eb1263699640beb6ec33a822c45a0c56190a78b1

     

    If i answer your question marked as solved..

     

15 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      is there any other workaround?

      • GilbertQ's avatar
        GilbertQ
        Super User
        Hi there

        As far as I know there is nothing else at the moment unfortunately.
    • Anonymous's avatar
      Anonymous
      Not applicable

      but, it requires premium capacity and my organization has pro license.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi GilbertQ ,

      Can we change Paramter values in direct query mode using PowerShell?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Yes by using rest api you can update parametrs in direct query.

        Step 1- Take direct query mode and in advance option write a normal query.

        Step 2- Go to adavance editor and change that query with parameter.

        like

        let
        Source = Sql.Database("host name", "database_name",
        [Query="select * from [schema name].["& paramter 1 & "_retailername_"& paramter2 &"] (NOLOCK)"])
        in
        Source

         

         

        In the above example i chnage my direct query using parameter.

         

        If you want to chnage thease parameters using powershell plz follow the following link-

        https://github.com/mycodehub2205/Powershell-For-PowerBI/commit/eb1263699640beb6ec33a822c45a0c56190a78b1

         

        If i answer your question marked as solved..

         

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous  I have tired this by downloading latest version 2.82.5858.1161 and published the report with direct query contains paramter but parameters are not showing up in power bi online(app.powerbi.com.) Could you please elobarate the steps furher if possible. Any references could be highly appreciated.

      Just for your information, I am holding Trail Pro License. Is that really matters? 
      Thanks

      Mohan Kumar

      • GilbertQ's avatar
        GilbertQ
        Super User
        Hi there

        As far as I know parameters cannot be used with DirectQuery?