Forum Discussion
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
- v-danhe-msft
Microsoft Employee
Hi sprasad,
Based on my research, you could refer to below link:
https://community.powerbi.com/t5/Desktop/How-to-edit-an-existing-direct-query/td-p/217857
Regards,
Daniel He
- sprasad
Helper 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
Community 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