work space specific variable to use in power bi query dynamically

泪湿孤枕 提交于 2019-12-25 01:12:38

问题


Use Case: We are getting app insight custom event data from app insight and publishing it in power bi using power bi queries. We have 3 environments (Dev,PreProd and Prod). We have created 3 work spaces for each environments.

Question: The queries use application insight App ID which is hardcoded for now. Is there a way to pass the App ID dynamically since it will be different for different workspace/environments.


回答1:


I think what you want to use is parameters. Guy in a Cube did a video about something similar awhile back, but the process can be modified to work with App Insights.

The instructions for creating a connection to App Insights from Power BI Desktop ask you to export the M code from App Insights and then copy it into a blank query. Go ahead and open up the query editor, but instead of copying in the code right away, first make a parameter to hold the link to the specific App Insights instance you want to connect to.

Once you have the parameter created, you can open up the query's advanced editor and paste in the code you exported from App Insights. Replace the connection string with the parameter you created.

Complete the rest of the work on the report, and publish it to the service. Finally, go into each workspace and update the parameter in the dataset's settings menu.

Currently parameters do get overwritten when you publish changes. However, if you use a script to push the updates to the separate workspaces you can also use that script to set the parameter in each.



来源:https://stackoverflow.com/questions/56376813/work-space-specific-variable-to-use-in-power-bi-query-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!