从 PowerApps 连接到 Power BIConnect to Power BI from PowerApps

Power BI

Power BI 是一套用于分析数据和共享见解的业务分析工具。Power BI is a suite of business analytics tools to analyze data and share insights. 通过每个设备上提供的丰富的仪表板来监视业务并快速获取答案。Monitor your business and get answers quickly with rich dashboards available on every device. 可以在应用中检查在 Power BI 服务中设置的数据警报的状态。In your app, you can check the status of the data alerts that you have set up in the Power BI service. 有关 Power BI 中数据警报的详细信息,请转到文档页For more information on data alerts in Power BI, head to the documentation page.

本主题演示如何在应用中使用 Power BI 连接,并列出可用的函数。This topic shows you how to use the Power BI connection in an app, and lists the available functions.

开始之前的准备工作What you need to get started

在应用中使用 Power BI 连接Use the Power BI connection in your app

列出在 Power BI 服务中设置的警报List the alerts that you've set up in the Power BI service

  1. 在“插入”菜单上,选择“”,并添加任意“文本库”。On the Insert menu, select Gallery, and add any of the Text galleries.
  2. 若要显示当前用户的警报,将库的 Items 属性设置为以下公式:To show the current user's alerts, set the Items property of the gallery to the following formula:

    PowerBI.GetAlerts()

库中将会更新警报列表。The gallery will update with the list of alerts. 对于每条警报,都将收到警报的名称、警报的 ID 号,以及配置警报的组工作区的 ID。For each alert, you will receive the alert name, the ID number of the alert, and the ID of the group workspace in which the alert was configured. 通过警报 ID,可以获取有关该警报的更多信息。You will need the alert ID to get further information about the alert.

查看警报状态View the status of an alert

若要查看警报状态,可使用从以上步骤获取的警报 ID 调用 CheckAlertStatus 函数。To view the status of the alert, call the CheckAlertStatus function with the alert ID obtained from the step above.

警报 ID 可以作为文本字符串传递(如“1234”),或作为使用 GetAlerts() 调用填充的库部分的引用传递(如 Gallery1.Selected.alertId)The alert ID can be passed in either as a literal string (e.g. "1234") or as a reference to a gallery section populated using the GetAlerts() call (e.g. Gallery1.Selected.alertId)

若要继续,请添加一个标签,然后将“Text”属性设置为以下公式之一:To proceed, add a label, and then set its Text property to one of these formulas:

  • PowerBI.CheckAlertStatus( /* alert ID that you received from GetAlert */ ).alertTitle
  • PowerBI.CheckAlertStatus( /* alert ID that you received from GetAlert */ ).currentTileValue
  • PowerBI.CheckAlertStatus( /* alert ID that you received from GetAlert */ ).alertThreshold
  • PowerBI.CheckAlertStatus( /* alert ID that you received from GetAlert */ ).isAlertTriggered

此时,标签会更新显示警报的当前状态。The label will update with the current status of the alert.

查看可用函数View the available functions

此连接包括以下函数:This connection includes the following functions:

函数名称Function Name 说明Description
GetAlertsGetAlerts 列出在 Power BI 服务中设置的警报List the alerts that you have set up in the Power BI service
CheckAlertStatusCheckAlertStatus 检查特定警报的状态Check the status of a particular alert

GetAlertsGetAlerts

列出在 Power BI 服务中设置的警报。List the alerts that you have set up in the Power BI service.

输入属性Input properties

无。None.

输出属性Output properties

属性名称Property Name 数据类型Data Type 需要Required 说明Description
value 数组array No 在 Power BI 服务中设置的数据警报的数组。An array of the data alerts that you have set up in the Power BI service. 每个数组中的元素将包括:Each element in the array will include:
  • alertTitle:警报的标题alertTitle: the title of the alert
  • alertId:警报的 IDalertId: the ID of the alert
  • groupId:创建警报的组的 IDgroupId: the ID of the group that the alert was created in

CheckAlertStatusCheckAlertStatus

检查警报状态。Check the status of an alert.

注意:如果调用过于频繁,则将基于警报限制对该终结点的请求。Note: requests to this endpoint will be throttled on a per-alert basis if called too frequently.

输入属性Input properties

属性名称Property Name 数据类型Data Type 需要Required 说明Description
alertIdalertId 整数integer Yes 由 GetAlerts 返回的警报的 IDThe ID of the alert, as returned by GetAlerts

输出属性Output properties

属性名称Property Name 数据类型Data Type 需要Required 说明Description
tileValuetileValue numbernumber No 触发警报时的磁贴值The value of the tile when the alert was triggered
tileUrltileUrl 字符串string No 具有警报的磁贴的 URLURL for the tile that has the alert
alertTitlealertTitle 字符串string No 警报名称Name of the alert
isAlertTriggeredisAlertTriggered 布尔值boolean No 当前是否触发了警报Whether the alert is currently triggered
alertThresholdalertThreshold numbernumber No 触发警报的阈值The threshold at which the alarm is triggered

查看所有可用连接See all the available connections.
了解如何向你的应用添加连接Learn how to add connections to your apps.