Forum Discussion

sprasad's avatar
sprasad
Icon for Helper II rankHelper II
8 years ago

Parameterize sql query programatically

Hi,

I have a Power BI template file which has saved query. e.g ("Select Employee name where emp id > "Variable"). Programatically using C# I need to silently instantiate the PBIT file and pass a Value (say 1200) to the "Variable" in the query. My question is, how I can achieve passing the Value of 1200 to the "Variable" variable in the saved query? Any API 

TIA

5 Replies

    • sprasad's avatar
      sprasad
      Icon for Helper II rankHelper II

      I am looking for a proper API code where programatically I can accept a value from an existing text or xls file and input it in the existing query in the PBIT file and create my data visualization

       

      I know the way how to do this porcess manually but I wanted to automate the whole process.

      • Stachu's avatar
        Stachu
        Icon for Community Champion rankCommunity Champion

        Are you using Direct Query? If not, do you need to use the template?
        In imported mode you can reference a text file in the Query Editor, so even though it's the same query from PowerBI perspective you can effectively use it as a parameter