本文介绍了动态在Power Bi查询中使用的工作空间特定变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用例:我们正在从应用洞察中获取应用洞察自定义事件数据,并使用Power Bi查询将其发布到Power Bi中.我们有3个环境(Dev,PreProd和Prod).我们为每种环境创建了3个工作空间.

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.

问题:这些查询使用应用程序洞察的应用程序ID(目前已进行硬编码).有没有一种动态传递App ID的方法,因为对于不同的工作空间/环境,它会有所不同.

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.

推荐答案

我认为您要使用的是参数.多维数据集中的家伙制作了一段类似的视频,但过程可以是进行了修改以与App Insights配合使用.

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.

从Power BI Desktop创建到App Insights的连接的说明要求您从App Insights导出M代码,然后将其复制到空白查询中.继续并打开查询编辑器,但不要立即复制代码,而是先创建一个参数,以保留指向您要连接的特定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.

一旦创建了参数,就可以打开查询的高级编辑器,并粘贴从App Insights导出的代码.将连接字符串替换为您创建的参数.

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.

这篇关于动态在Power Bi查询中使用的工作空间特定变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:43