Power Bi 简明教程

Power BI - Quick Guide

Power BI - Introduction

Power BI 是一个数据可视化和商业智能工具,它将来自不同数据源的数据转换为交互式仪表盘和 BI 报表。Power BI 套件提供了多个软件、连接器和服务 - Power BI 桌面版、基于 Saas 的 Power BI 服务,以及适用于不同平台的移动 Power BI 应用程序。这些服务被业务用户用于使用数据和生成 BI 报表。

Power BI is a Data Visualization and Business Intelligence tool that converts data from different data sources to interactive dashboards and BI reports. Power BI suite provides multiple software, connector, and services - Power BI desktop, Power BI service based on Saas, and mobile Power BI apps available for different platforms. These set of services are used by business users to consume data and build BI reports.

Power BI 桌面应用程序用于创建报表,而 Power BI 服务(软件即服务 - SaaS)用于发布报表,Power BI 移动应用程序用于查看报表和仪表板。

Power BI desktop app is used to create reports, while Power BI Services (Software as a Service - SaaS) is used to publish the reports, and Power BI mobile app is used to view the reports and dashboards.

Power BI Desktop 提供 32 位和 64 位两种版本。如需下载最新版本,可使用以下链接 -

Power BI Desktop is available in both 32-bit and 64-bit versions. To download the latest version, you can use the following link −

power bi desktop

Power BI - Installation Steps

如需查看系统要求、安装文件的详细信息,用户必须导航至“高级下载选项”。以下是下载 Power BI 工具的系统要求:

To check the system requirements, installation files detail, users have to navigate to “Advanced download options”. Following are the system requirements to download Power BI tool −

Supported Operating Systems

  1. Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

  2. Microsoft Power BI Desktop requires Internet Explorer 9 or higher

  3. Microsoft Power BI Desktop is available for 32-bit (x86) and 64-bit (x64) platforms

用户可以选择安装 Power BI 的语言,且提供以下文件供下载。

Users can select a language in which they want to install Power BI and following files are available for download.

language

这是直接下载 Power BI 文件的链接 -

This is the link to directly download Power BI files −

install power bi
choose download

PBIDesktop_x64.msi 显示一个 64 位操作系统文件。根据操作系统类型选择要安装的文件,然后单击下一步。将安装文件保存到本地驱动器中。

PBIDesktop_x64.msi shows a 64-bit OS file. Select the file you want to install as per OS type and click Next. Save the installation file on the local drive.

local drive

运行安装文件时,将显示以下屏幕。

When you run the installation file, following screen is displayed.

installation file

接受许可协议并按照屏幕上的说明完成安装。

Accept the license agreement and follow the instructions on the screen to finish the installation.

license agreement

安装 Power BI 时,它会启动欢迎屏幕。此屏幕用于启动与获取数据、丰富现有数据模型、创建报表以及发布和共享报表相关的不同选项。

When Power BI is installed, it launches a welcome screen. This screen is used to launch different options related to get data, enrich the existing data models, create reports as well as publish and share reports.

welcome screen

Power BI - Architecture

Power BI 包括以下组件:

Power BI includes the following components −

  1. Power BI Desktop − This is used to create reports and data visualizations on the dataset.

  2. Power BI Gateway − You can use Power BI on-premises gateway to keep your data fresh by connecting to your on-premises data sources without the need to move the data. It allows you to query large datasets and benefit from the existing investments.

  3. Power BI Mobile Apps − Using Power BI mobile apps, you can stay connected to their data from anywhere. Power BI apps are available for Windows, iOS, and Android platform.

  4. Power BI Service − This is a cloud service and is used to publish Power BI reports and data visualizations.

power bi components

Power BI - Supported Data Sources

Power BI 支持广泛的数据源。您可以单击“获取数据”,它将显示所有可用的数据连接。它允许您连接到不同的平面文件、SQL 数据库和 Azure 云甚至 Web 平台,例如 Facebook、Google Analytics 和 Salesforce 对象。它还包括 ODBC 连接,用于连接到其他未列出的 ODBC 数据源。

Power BI supports large range of data sources. You can click Get data and it shows you all the available data connections. It allows you to connect to different flat files, SQL database, and Azure cloud or even web platforms such as Facebook, Google Analytics, and Salesforce objects. It also includes ODBC connection to connect to other ODBC data sources, which are not listed.

以下是 Power BI 中可用的数据源−

Following are the available data sources in Power BI −

  1. Flat Files

  2. SQL Database

  3. OData Feed

  4. Blank Query

  5. Azure Cloud platform

  6. Online Services

  7. Blank Query

  8. Other data sources such as Hadoop, Exchange, or Active Directory

要在 Power BI 桌面版中获取数据,您需要单击主屏幕中的“获取数据”选项。它首先向您显示最常见的数据源。然后,单击“更多”选项以查看可用数据源的完整列表。

To get data in Power BI desktop, you need to click the Get data option in the main screen. It shows you the most common data sources first. Then, click the More option to see a full list of available data sources.

available data sources

当您点击“更多..”选项卡(如上图所示)时,您会看到一个新的导航窗口,其中左侧显示了所有可用数据源的类别。您还可以选择在顶部执行搜索。

When you click “More..” tab as shown in the above screenshot, you can see a new navigation window, where on the left side it shows a category of all available data sources. You also have an option to perform a search at the top.

more

以下是列出的各种 data sources

Following are the various data sources listed −

All

在此类别下,您可以看到 Power BI 桌面版下所有可用的数据源。

Under this category, you can see all the available data sources under Power BI desktop.

File

当您单击“文件”时,它将向您显示 Power BI 桌面版中支持的所有平面文件类型。要连接到任何文件类型,请从列表中选择文件类型,然后单击“连接”。您必须提供文件的位置。

When you click File, it shows you all flat file types supported in Power BI desktop. To connect to any file type, select the file type from the list and click Connect. You have to provide the location of the file.

file

Database

当您单击“数据库”选项时,它将显示您可以连接到的所有数据库连接的列表。

When you click the Database option, it shows a list of all the database connections that you can connect to.

database

要连接到任何数据库,请从列表中选择一个“数据库”类型,如上图所示。单击“连接”。

To connect to any database, select a Database type from the list as shown in the above screenshot. Click Connect.

您必须传递服务器名称/用户名和密码才能连接。您还可以使用“高级”选项通过直接 SQL 查询进行连接。您还可以选择连接模式——导入或 DirectQuery。

You have to pass Server name/ User name and password to connect. You can also connect via a direct SQL query using Advance options. You can also select Connectivity mode- Import or DirectQuery.

Note − 您不能在单个报表中组合导入和 DirectQuery 模式。

Note − You can’t combine import and DirectQuery mode in a single report.

Import vs DirectQuery

DirectQuery 选项限制了数据操作选项,并且数据保留在 SQL 数据库中。DirectQuery 是实时的,无需像在“导入”方法中那样计划刷新。

DirectQuery option limits the option of data manipulation and the data stays in SQL database. DirectQuery is live and there is no need to schedule refresh as in the Import method.

Import 方法允许执行数据转换和操作。当您将数据发布到 PBI 服务时,限制为 1GB。它会消耗数据并将其推送到 Power BI Azure 后端,并且可以在一天内刷新最多 8 次数据,并且可以为数据刷新设置计划。

Import method allows to perform data transformation and manipulation. When you publish the data to PBI service, limit is 1GB. It consumes and pushes data into Power BI Azure backend and data can be refreshed up to 8 times a day and a schedule can be set up for data refresh.

import method

Advantages of Using DirectQuery

  1. Using DirectQuery, you can build data visualizations on large datasets, which is not feasible to import in Power BI desktop.

  2. DirectQuery doesn’t apply any 1GB data set limit.

  3. With the use of DirectQuery, the report always shows current data.

Limitations of Using DirectQuery

  1. There is a limitation of 1 million row for returning data while using DirectQuery. You can perform aggregation of more number of rows, however, the result rows should be less than 1 million to return the dataset.

  2. In DirectQuery, all tables should come from a single database.

  3. When a complex query is used in the Query editor, it throws an error. To run a query, you need to remove the error from the query.

  4. In DirectQuery, you can use Relationship filtering only in one direction.

  5. It doesn’t support special treatment for time-related data in tables.

Azure

使用 Azure 选项,您可以在 Azure 云中连接到数据库。以下屏幕截图显示了 Azure 类别下可用的各种选项。

Using the Azure option, you can connect to the database in Azure cloud. Following screenshot shows the various options available under Azure category.

azure

Online Services

Power BI 还允许您连接到 Exchange、Salesforce、Google Analytics 和 Facebook 等各种在线服务。

Power BI also allows you to connect to different online services such as Exchange, Salesforce, Google Analytics, and Facebook.

以下屏幕截图显示了在线服务下可用的各种选项。

Following screenshots shown the various options available under Online Services.

connect online services
online services

Other

以下屏幕截图显示了其他类别中可用的各种选项。

Following screenshot shows the various options available under other category.

other category

Power BI - Comparison with Other BI Tools

在本章中,对 Power BI 和其他 BI 工具(如 Tableau 和 SSRS)进行了比较。

In this chapter, a comparison between Power BI and other BI tools such as Tableau and SSRS is carried out.

Power BI vs Tableau

Tableau 被认为是 BI 市场上的领先工具之一。Power BI 被认为是一款新兴工具,由于其后端数据操作功能和与数据源列表的连接性,与 Tableau 形成紧密竞争。Tableau 是市场上最好的数据可视化工具之一,被中大型企业使用。Power BI 与 Office 365 套件紧密集成,因此它与 SharePoint 等其他来源兼容。

Tableau is considered as one of the leading tools in the BI market. Power BI is considered as an emerging tool in close competition with Tableau because of its backend data manipulation features and connectivity with the list of data sources. Tableau is one of the best data visualization tools in the market and is used by medium and large enterprises. Power BI is closely integrated with Office 365 suite, and hence it is compatible other sources such as SharePoint.

Feature

Tableau

Power BI

Data Visualization

Tableau provides strong data visualization and is one of the main data visualization tool in the market.

Power BI provides a strong backend data manipulation feature with access to simple visualizations.

Size of Dataset

Tableau can connect much larger datasets as compared to Power BI.

Power BI has a limit of 1GB data in free version.

Data Sources

Tableau covers a vast range of data sources to connect with for data visualization. In Tableau, you select the dataset first and visualizations are used on the fly.

Power BI covers most of the data sources available in Tableau. It is closely integrated with Office 365, hence provides connectivity to SharePoint. Power BI online version also supports direct visualization on Search Engine, though, only Bling is supported at this point.

Costing

Tableau is expensive as compared to Power BI but still under budget for small and medium enterprise.

Power BI provides a free version with 1GB limit on dataset. Power BI Pro is also a cheaper solution when compared with any other BI tool.

License and Pricing

Tableau Desktop Profession: USD70/user/month and it can connect to hundreds of data sources. Tableau Desktop Personal: USD35/user/month and it can connect to data sources such as Google Sheets and Excel files. Tableau Server: Minimum 10 users with the cost of USD35/user/month Tableau Online with private cloud: USD 42/user/month

Power BI: Free 1 GB storage 10k rows/hour data streaming Power BI Pro: USD9.99/user/month 10 GB storage 1 million rows/hour

Implementation

Tableau provides different implementation types as per organizational needs panning from few hours to few weeks.

Power BI uses cloud storage and includes simple implementation process.

Power BI vs SSRS

Feature

SSRS

Power BI

Data Visualization

SSRS is mostly used for Pixel perfect reporting and average dash-boarding features.

Power BI provides a strong backend data manipulation feature with access to simple visualizations.

Size of Dataset

No such limit in SSRS. It can connect to much larger datasets as compared to Power BI.

Power BI has a limit of 1GB data in free version.

Data Sources

SSRS covers a vast range of data sources to connect with for BI reporting.

Power BI covers most of the data sources available in Tableau. It is closely integrated with Office 365, hence provides connectivity to SharePoint. Power BI online version also supports direct visualization on Search Engine, though, only Bling is supported at this point.

Costing

SSRS pricing details are available only upon request.

Power BI provides a free version with 1GB limit on dataset. Power BI Pro is also a cheaper solution when compared with any other BI tool.

License and Pricing

SQL Server Enterprise License. It is available on cloud - AWS, Azure, and other providers.

Power BI: Free 1 GB storage 10k rows/hour data streaming Power BI Pro: USD9.99/user/month 10 GB storage 1 million rows/hour

Implementation

SSRS implementation is complex as compared with Power BI.

Power BI uses cloud storage and includes simple implementation process.

Power BI - Data Modeling

在本章,您将了解 Power BI 中的数据建模。

In this chapter, you will learn about data modeling in Power BI.

Using Data Modeling and Navigation

数据建模是 BI 工具中利用关系来连接多个数据源的一项功能。关系定义了数据源如何彼此连接,您可以在多个数据源之上创建有趣的数据可视化。

Data Modeling is one of the features used to connect multiple data sources in BI tool using a relationship. A relationship defines how data sources are connected with each other and you can create interesting data visualizations on multiple data sources.

利用建模功能,您可以在现有表中构建自定义计算,而这些列可直接显示到 Power BI 可视化中。这使得业务能够定义新的度量并针对这些度量执行自定义计算。

With the modeling feature, you can build custom calculations on the existing tables and these columns can be directly presented into Power BI visualizations. This allows businesses to define new metrics and to perform custom calculations for those metrics.

modeling feature

在上面的图片中,您能看到一个通用的数据模型,其显示了两个表之间的关系。这两个表利用列名“Id”进行连接。

In the above image, you can see a common data model, which shows a relationship between two tables. Both tables are joined using a column name “Id”.

类似地,在 Power BI 中,您可以设置两个对象之间的关系。要设置关系,您必须在常见的列之间拖拽一条线。您还可以在 Power BI 中的数据模型中查看“关系”。

Similarly, in Power BI, you set the relationship between two objects. To set the relationship, you have to drag a line between the common columns. You can also view the “Relationship” in a data model in Power BI.

要在 Power BI 中创建数据模型,您需要将所有数据源添加到 Power BI 新报告选项中。要添加数据源,请转到“获取数据”选项。然后,选择您想要连接的数据源并单击“连接”按钮。

To create data model in Power BI, you need to add all data sources in Power BI new report option. To add a data source, go to the Get data option. Then, select the data source you want to connect and click the Connect button.

data model in power bi

一旦添加了数据源,它将显示在右侧边栏中。在以下图片中,我们使用 2 个 xls 文件来导入数据 - 客户和产品。

Once you add a data source, it is presented on the right side bar. In the following image, we have used 2 xls file to import data - Customer and Product.

add data source

在 Power BI 的屏幕左侧,您有以下三个选项卡 −

In Power BI on the left side of the screen, you have the following three tabs −

  1. Report

  2. Data

  3. Relationships

power bi screen

当您导航到“报告”选项卡时,您可以看到为数据可视化选择的一个仪表板和图表。您可以根据需要选择不同类型的图表。在我们的示例中,我们从可用可视化中选择了“表”类型。

When you navigate to the Report tab, you can see a dashboard and a chart selected for data visualization. You can select different chart types as per your need. In our example, we have selected a Table type from available Visualizations.

report tab

当您转到“数据”选项卡时,您可以看到来自数据源的所有数据,这些数据符合已定义的关系。

When you go to the Data tab, you can see all the data as per the defined Relationship from the data sources.

data tab

在“关系”选项卡中,您可以看到数据源之间的关系。当您将多个数据源添加到 Power BI 可视化时,该工具会自动试图检测列之间的关系。当您导航到“关系”选项卡时,您可以查看关系。您还可以使用“创建关系”选项在列之间创建一个关系。

In the Relationship tab, you can see the relationship between data sources. When you add multiple data sources to Power BI visualization, the tool automatically tries to detect the relationship between the columns. When you navigate to the Relationship tab, you can view the relationship. You can also create a Relationship between the columns using Create Relationships option.

relationship tab

您还可以在数据可视化中添加和移除关系。要移除关系,您必须右键单击并选择“删除”选项。要创建一个新的“关系”,您只需拖放您想要在数据源之间链接的字段即可。

You can also add and remove relationships in data visualization. To remove a relationship, you have to right-click and select the “Delete” option. To create a new “Relationship”, you just need to drag and drop the fields that you want to link between the data sources.

relationships

您还可以使用关系视图在报表中隐藏特定列。要隐藏某一列,请右键单击该列名称,并选择“在报表视图中隐藏”选项。

You can also use the Relationship view to hide a particular column in the report. To hide a column, right-click on the column name and select the “Hide in report view” option.

relationship view

Creating Calculated Columns

可以通过结合现有数据中的两个或更多元素在 Power BI 中创建计算列。您还可以对现有列应用计算,以定义新指标或结合两列来创建一列新列。

You can create calculated columns in Power BI by combining two or more elements of the existing data. You can also apply calculation on an existing column to define a new metric or combine two columns to create one new column.

您甚至可以创建计算列来建立表之间的关系,而且还可以使用它来设置两个表之间的关系。

You can even create a calculated column to establish a relationship between the tables and it can also be used to setup a relationship between two tables.

要创建新的计算列,请导航到屏幕左侧的数据视图选项卡,然后单击建模。

To create a new calculated column, navigate to Data View tab on the left side of the screen and then click Modeling.

new calculated column

当您导航到建模选项卡时,您可以在屏幕顶部看到一个新建列选项。这样也会打开公式栏,您可以在其中输入 DAX 公式以执行计算。DAX(数据分析表达式)是一种强大的语言,也用于 Excel 中执行计算。您还可以通过更改公式栏中的列文本重新命名该列。

When you navigate to the Modeling tab, you can see a New Column option at the top of the screen. This also opens the formula bar, where you can enter DAX formula to perform calculation. DAX- Data Analysis Expression is a powerful language also used in Excel to perform calculations. You can also rename the column by changing the Column text in the formula bar.

modeling tab

在以下示例中,让我们创建一个新列:产品代码 (Product_C),它是从 Prod_Id 列的最后三个字符派生的。然后,写入以下公式 −

In the following example, let us create a new column: Product Code (Product_C), which is derived from the last three characters of Prod_Id column. Then, write the following formula −

Product_C = RIGHT( Sheet1[Prod_Id],3)
create new column

还提供了很多公式,您可以使用它们来创建计算列。您必须输入用作计算的公式的第一个字符,如下面的屏幕截图所示。

A long list of formulas is also provided that you can use for creating calculated columns. You have to enter the first character of formula to be used in calculations as shown in the following screenshot.

creating calculated columns

Creating Calculated Tables

您还可以创建 Power BI 中的数据建模中的新计算表。要创建新表,请导航到屏幕左侧的数据视图选项卡,然后转到屏幕顶部的建模选项。

You can also create a new calculated table in data modeling in Power BI. To create a new table, navigate to the Data View tab on the left side of the screen, and then go to the Modeling option at the top of the screen.

modeling option

DAX 表达式用于创建新表。您必须在等号的左侧输入新表的名称和 DAX 公式以执行计算以在右侧形成该表。当计算完成后,新表会出现在您模型的“字段”窗格中。

DAX expression is used to create the new table. You have to enter the name of a new table on the left side of the equal sign and DAX formula to perform the calculation to form that table on the right. When the calculation is complete, the new table appears in the Fields pane in your model.

在以下示例中,让我们定义新表 - Table_CustC,它返回包含另一个表中一列中的唯一值的单列表。

In the following example, let us define a new table - Table_CustC that returns a one column table containing unique values in a column in another table.

table custc

如以下屏幕截图所示,新表会添加到 Power BI 屏幕中的“字段”部分下。一旦根据您的要求创建计算列和计算表,您就可以在 Power BI 的“报表”选项卡中使用字段。

A new table is added under the “Fields” section in Power BI screen as shown in the following screenshot. Once the calculated column and calculated tables are created as per your requirement, you can use the fields in the Report tab in Power BI.

要添加这些对象,您必须选择一个复选框,并且若可能,系统会自动检测到关系。如果不是,那么您可以拖动您要连接的列。

To add these objects, you have to select a checkbox and a relationship is automatically detected if possible. If not, then you can drag the columns that you want to connect.

select checkbox

要查看报表,请导航到报表选项卡,在报表视图中,您既可以查看“计算列”,还可以查看新“计算表”中的字段。

To view the report, you navigate to the Report tab and you can see both “Calculated columns” and fields from the new “Calculated table” in the report view.

calculated columns

Managing Time-Based Data

Power BI 默认允许深入钻取基于时间的数​​据。当您在分析中添加日期字段并在数据可视化中启用深入钻取后,它会带您深入了解下一层基于时间的数​​据。

Power BI allows to drill through time-based data by default. When you add a date field in your analysis and enable drill on your data visualization, it takes you to the next level of time-based data.

让我们考虑我们在 Power BI 可视化中添加了基于时间的表。我们在报表中添加了收入和年份列。

Let us consider we have added Time-based table in Power BI visualization. We have added Revenue and Year column in our report.

revenue column
year column

我们可以使用顶部的选项在可视化中启用深入钻取功能。一旦我们启用深入钻取功能,并单击图表中的条形图或折线图,它就会深入钻取到时间层级的下一层。 Example: 年份 → 季度 → 月份。

We can enable the drill feature in visualizations using the option at the top. Once we enable the drill feature and click the bars or lines in the chart, it drills down to the next level of time hierarchy. Example: Years → Quarters → Months.

我们还可以在层级中使用转到下一层选项来执行深入钻取。

We can also use Go to the next level in the hierarchy option to perform a Drill.

hierarchy option

Power BI - Dashboard Options

在本章中,您将了解 Power BI 中的各种仪表盘选项。

In this chapter, you will learn about the various dashboard options available in Power BI.

Exploring Different Datasets

Power BI 工具提供了很多选项来探索数据集。当您处理 BI 报表或仪表盘时,您可以使用 Power BI 查找快速见解。导航到工具用户界面的左侧数据集部分,单击 3 个点 (…) 并单击获取见解。

Power BI tool provides a lot of options to explore the datasets. When you are working on your BI report or dashboards, you can use Power BI look for quick insights. Navigate to the datasets section on the left side of the tool UI, click the 3 dots (…) and click Get Insights.

insights

当您选择“获取见解”选项时,它会运行数据集中的所有算法,一旦完成,您会收到通知,告知见解已准备好用于您的数据集。

When you select the Get Insights option, it runs all the algorithms in your dataset and once it is complete, you get a notification that insight is ready for your dataset.

get insights option

您可以单击“查看见解”选项,此工具会向您显示数据见解的所有图表表示形式。您随时都可以转到此选项并在您的数据集中查看见解选项。

You can click the View Insights option and the tool will show you all chart representations of your data insights. You can any time go to this option and check insights option in your dataset.

当您将报告发布到 Power BI 服务时,您还可以在首页获得快速见解选项。

When you publish a report to Power BI service, you also get an option of Quick Insight on the first page.

report power bi service
quick insight

Creating Dashboards

在 Power BI 中,您可以通过钉住使用 Power BI 电脑版发布的 BI 报告中的可视化效果来创建仪表板。使用 Power BI 服务创建的所有可视化效果也可用于钉住以创建仪表板。

In Power BI, you can create a dashboard by pinning visualizations from BI reports that are published using Power BI desktop. All the visualizations that are created using Power BI service are also available for pinning to create dashboards.

在 Power BI 中,如果您想钉住可视化效果,请在 Power BI 服务中打开 BI 报告。在可视化效果顶部,选择图钉图标。

In Power BI, if you want to pin a visual, open the BI report on the Power BI service. At the top of the visual, select the pin icon.

power bi service

当您使用钉住选项时,如上方的屏幕截图所示,会出现一个新的对话框,如下图所示。它要求您创建一个新仪表板或从下拉列表中选择一个现有仪表板以放置该可视化效果。如果您没有现有的仪表板,则此选项呈灰色显示。

When you use the Pin option as shown as shown in the above screenshot, a new dialog box appears as shown in the following screenshot. It asks you to create a new dashboard or select an existing dashboard to put the visual from the dropdown list. If you don’t have an existing dashboard, then this option is greyed out.

greyed out

一旦您单击“钉住”按钮,您会得到一个确认,即您的可视化效果已“钉住”到仪表板。您可以单击“我的工作区”并查看仪表板。

Once you click the Pin button, you will get a confirmation that your visualization is “Pinned” to the dashboard. You can click My Workspace and check the dashboard.

一旦创建仪表板,您可以使用不同的选项来配置仪表板。

Once your dashboard is created, you can use different options to configure the dashboard.

pinned

Sharing Dashboards

当您将 BI 报告发布到 Power BI 服务时,您可以与组织中的其他用户共享报告和仪表板。在 Power BI 中共享仪表板非常容易。

When you publish your BI report to Power BI service, you can share reports and dashboards with other users in your organization. Sharing a dashboard is very easy in Power BI.

您必须在 Power BI 服务中打开仪表板,并单击屏幕右上角的“共享”选项。

You have to open the dashboard in Power BI service and click the Share option at the top right corner of the screen.

dashboard power bi service

共享功能仅适用于 Power BI Pro 版本。您还可以使用 Power BI Pro 的 60 天免费试用版,如下图所示。

The sharing feature is only available with Power BI Pro version. You can also use the 60-days free trial for Power BI Pro as shown in the following screenshot.

free trial

单击“免费试用 Pro”以开始试用。选择“开始试用”和“完成”,您将收到确认已开始 60 天的试用。当您单击“共享仪表板”时,您会在一个新窗口中获得选项。您必须输入您希望与其共享此仪表板的用户的电子邮件 ID。

Click the Try Pro for free to start a trial. Select the Start Trial and Finish, and you will get a confirmation that 60-days trial has started. When you click the Share dashboard, you will get options in a new window. You have to enter the email Id of the user with whom you want to share this dashboard.

您可以允许收件人与其他用户共享仪表板或发送电子邮件通知。您还可以为用户提供直接 URL,他们可以直接访问仪表板。

You can allow recipients to share the dashboard with other users or send email notifications. You can also provide a direct URL to users and they can access the dashboard directly.

url to users

Tiles in Dashboard

当您在仪表板中查看更多选项时,您会在仪表板中看到焦点模式和其他不同选项的选项。

When you check More Options in the dashboard, you can see an option of Focus Mode and other different options in the dashboard.

Focus Mode 用于详细了解仪表板数据。当仪表板中有多个值时,您可以使用焦点模式来更好地查看仪表板中的对象。如果有由于空间问题而未显示的任何列,您还可以使用焦点模式查看它们。

Focus Mode is used to take a closer look at your dashboard data. When you have multiple values in the dashboard, you can use the Focus Mode for a better view of the objects in the dashboard. If there are any columns, which are not shown due to space issues, you can also view those using the Focus Mode.

focus mode

焦点模式用于查看仪表板/报告中的所有数据。还可以通过选择图钉图标直接从焦点模式将可视化效果钉住到另一个仪表板。

Focus Mode is used to see all the data in the dashboard/report. It is also possible to pin the visual directly from Focus Mode to a different dashboard by selecting the Pin icon.

要退出焦点模式,您可以选择“退出焦点模式”选项。

To exit the Focus Mode, you can select the Exit Focus Mode option.

exit focus mode option

您还可以使用“图块详细信息”选项编辑一些格式更改。此选项允许更改图块的标题、副标题、上次刷新时间和日期以及其他详细信息,例如为仪表板创建自定义链接。

You can also use the Tile Details option to edit few formatting changes. This option allows to change the tile’s title, subtitle, last refresh time and date, and other details, such as creating a custom link for your dashboard.

tile details option
custom link

Data Gateway

您可以使用数据网关将本地数据源连接到 Power BI 服务。您还可以使用无需任何管理配置的数据网关版本,它称为个人网关。

You can connect on-premise data sources to Power BI service using a data gateway. You can also use a version of data gateway that doesn’t include any administration configuration and it is called as Personal Gateway.

您可以登录 Power BI 服务来设置个人网关。您必须选择屏幕右上角的下载图标,然后单击数据网关。

You can set up Personal Gateway by logging into Power BI service. You have to select the download icon on the top right hand corner of the screen and click Data Gateway.

personal gateway

根据 Power BI 官方网站,使用数据网关与本地网关,您可以连接到本地数据源,保持数据完整,而无需移动数据。查询大型数据集,并从现有投资中受益。网关提供了满足个人需求和组织需求的灵活性。

As per Power BI official site, using Data Gateway with the on-premises gateways, you can keep your data fresh by connecting to your on-premises data sources without the need to move the data. Query large datasets and benefit from your existing investments. The gateways provide the flexibility you need to meet individual needs, and the needs of your organization.

power bi official site

若要设置下载网关,您必须运行安装程序,直到下载完成并安装向导完成。

To set up download gateways, you have to run the setup till it is downloaded and the installation wizard is complete.

download gateways

您可以选择以下一项:

You have an option to select either −

  1. On-premise data gateway or

  2. Personal gateway (Power BI only)

启动 Power BI 网关后,您必须登录到 Power BI 网关服务。

Once you launch Power BI Gateway, you have to login to Power BI gateway service.

您还可以通过导航到日程刷新和日程频率启用自动更新。

You can also enable automatic updates by navigating to Schedule Refresh and frequency of the schedule.

Power BI - Visualization Options

在本教程中,您将了解 Power BI 中的各种可视化选项。

In this chapter, you will learn about the various visualization options in Power BI.

Creating Simple Visualizations

可视化用于有效显示您的数据,是任何商业智能工具的基础组成部分。Power BI 包含各种默认数据可视化组件,其中包括从简单的条形图到饼图再到地图,还包括瀑布图、漏斗图、仪表以及许多其他组件等复杂模型。

Visualizations are used to effectively present your data and are the basic building blocks of any Business Intelligence tool. Power BI contains various default data visualization components that include simple bar charts to pie charts to maps, and also complex models such as waterfalls, funnels, gauges, and many other components.

business intelligence tool

在 Power BI 中,您可以通过两种方式创建可视化。首先是通过从右侧窗格添加到报告画布。默认情况下,它是 Power BI 中选中的表格类型的可视化。另一种方法是将右侧栏中的字段拖动到可视化下的轴和值轴。您可以根据要求向每个轴添加多个字段。

In Power BI, you can create visualization in two ways. First is by adding from the right side pane to Report Canvas. By default, it is the table type visualization, which is selected in Power BI. Another way is to drag the fields from right side bar to the axis and value axis under Visualization. You can add multiple fields to each axis as per the requirement.

report canvas

在 Power BI 中,还可以通过单击然后拖动来移动报告画布上的可视化。您还可以在可视化窗格中切换不同的图表和可视化类型。Power BI 会尽力将您选定的字段尽可能准确地转换成新的可视化类型。

In Power BI, it is also possible to move your visualization on the reporting canvas by clicking and then dragging it. You can also switch between different type of charts and visualizations from the Visualization pane. Power BI attempts to convert your selected fields to the new visual type as closely as possible.

Creating Map Visualizations

在 Power BI 中,我们有两种类型的地图可视化 - 气泡图和形状图。如果您要创建一个气泡图,请从可视化窗格中选择地图选项。

In Power BI, we have two types of map visualization - bubble maps and shape maps. If you want to create a bubble map, select the map option from the visualization pane.

create bubble map

若要使用气泡图,请将地图从可视化拖动到报告画布中。要显示值,您必须向轴添加任何位置对象。

To use a bubble map, drag the map from Visualizations to the Report Canvas. To display values, you have to add any location object to the axis.

display values

在值字段中,您可以看到它接受值轴,如城市和州,或者您可以添加经度和纬度值。要更改气泡大小,您需要向值轴添加一个字段。

In the value fields, you can see that it accepts values axis such as City and State and or you can also add longitude and latitude values. To change the bubble size, you need to add a field to the value axis.

您还可以通过将填充地图拖到报告画布中来在数据可视化中使用填充地图。

You can also use a filled map in data visualization, just by dragging the filled map to the Report Canvas.

filled map

Note - 如果你在地图可视化的顶部看到一个警告符号,这意味着你需要向地图图表添加更多位置。

Note − If you see a warning symbol on top of your map visualization, it means that you need to add more locations to your map chart.

Using Combination Charts

在数据可视化中,还需要在一个图表中绘制多维数据。Power BI 支持各种组合图表类型来绘制度量值。假设您想要在一个图表中绘制收入和 unit_solds。组合图表是此类要求最合适的选项。

In data visualization, it is also required to plot multiple measures in a single chart. Power BI supports various combination chart types to plot measure values. Let us say you want to plot revenue and unit_solds in one chart. Combination charts are the most suitable option for these kind of requirement.

Power BI 中最常见的组合图表之一是折线图和堆积柱状图。假设我们有一个收入字段,我们添加了一个新的数据源,其中包含以客户为单位的单位数量,并且我们希望在我们的可视化中绘制它。

One of the most common Combination chart in Power BI is Line and Stacked column charts. Let us say we have a revenue field and we have added a new data source that contains customer-wise unit quantity and we want to plot this in our visualization.

combination chart

一旦您添加了一个数据源,它将被添加到右侧字段的列表中。您可以将单位添加到列轴,如下面的屏幕截图所示。

Once you add a data source, it will be added to the list of fields on the right side. You can add units to the column axis as shown in the following screenshot.

data source

您可以在 Power BI 中使用其他类型的组合图表 - 折线图和簇状柱形图。

You have other type of combine chart that you can use in Power BI - Line and Clustered Column.

line and clustered column

Using Tables

在 Power BI 中,当您向可视化对象添加数据集时,它会向报表画布中添加一个表格图表。您可以拖动您要添加到报表中的字段。您还可以勾选每个字段前面的复选框,以将它们添加到报表区域。

In Power BI, when you add a dataset to your visualization, it adds a table chart to the Report canvas. You can drag the fields that you want to add to the report. You can also select the checkbox in front of each field to add those to the Report area.

对于表格中的数值,您可以在底部看到值的总和。

With the numerical values in a table, you can see a sum of values at the bottom.

numerical values

您还可以使用列顶部的箭头键对表格进行排序。要执行升序/降序排序,只需单击箭头标记,列中的值将按顺序排序。

You can also perform a sort in the table using an arrow key at the top of the column. To perform ascending/descending sort, just click the arrow mark, and the values in the column will be sorted.

ascending descending sort

表格中列的顺序由右侧值存储区中的顺序决定。如果您想要更改顺序,您可以删除任何列并添加另一个列。

The order of the columns in a table is determined by the order in the value bucket on the right side. If you want to change the order, you can delete any column and add the other one.

delete any column

您还可以撤消汇总或对表格中的数值应用不同的聚合函数。要更改聚合类型,单击度量前面的值存储区中的箭头,您将看到可用的公式列表。

You can also undo summarize or apply different aggregate function on numerical values in the table. To change the aggregation type, click the arrow in the value bucket in front of the measure and you will see a list of formulas that can be used.

aggregation type

Power BI 中的另一种表格类型是矩阵表格,它提供了许多特性,例如自动调整大小、列表格和设置颜色等。

Another table type in Power BI is the matrix table that provides a lot of features such as auto sizing, column tables, and setting colors, etc.

matrix table

Modify Colors in Charts

在 Power BI 中,您还可以修改图表中的颜色。当您选择任何可视化对象时,它都有一个选项来更改颜色。格式选项卡中有以下选项:

In Power BI, you can also modify the colors in the chart. When you select any visualization, it has an option to change the color. Following options are available under the Format tab −

  1. Legend

  2. Data Colors

  3. Detail Label

  4. Title

  5. Background

  6. Lock Aspect

  7. Border

  8. General

若要打开这些选项,请转至格式选项卡,如以下屏幕截图所示。单击后,您可以看到所有可用选项。

To open these options, go to the Format tab as shown in the following screenshot. Once you click, you can see all the options available.

format tab

展开图例字段时,您可以选择要显示图例的位置。您可以选择:

When you expand the Legend field, you have an option where you want to display the legend. You can select −

  1. Position

  2. Title

  3. Legend Name

  4. Color

  5. Text Size

  6. Font Family

legend field

类似地,您有数据颜色。如果您想更改任何数据字段的颜色,您可以使用此选项。它显示了图表中的所有对象及其对应的颜色。

Similarly, you have data colors. In case, you want to change the color of any data field, you can use this option. It shows all objects and their corresponding colors in the chart.

data colors

您还可以使用此工具中的分析特性,根据数据可视化中的要求绘制线。您在数据可视化中拥有以下线类型:

You also have Analytics feature in the tool, where you can draw lines as per requirement in data visualization. You have the following line types in data visualization −

  1. Constant Line

  2. Min Line

  3. Max Line

  4. Average Line

  5. Median Line

  6. Percentile Line

analytics feature

您可以选择虚线、点线或实线。您可以选择线的透明度级别、颜色和位置。您还可以为此线开启/关闭数据标签。

You can opt for a dashed, dotted, or a solid line. You can select Transparency level, color, and position of the line. You can also switch on/off data label for this line.

data label

Adding Shapes, Images and Text box

有时您需要向可视化中添加静态文本、图像或形状。如果您想向数据可视化中添加页眉/页脚或任何静态签名或消息,可以使用此选项。

Sometimes it is required that you need to add static text, images, or shapes to your visualization. In case you want to add header/footer or any static signatures, messages to data visualization this option can be used.

您还可以在文本框中添加 URL,Power BI 使用这些链接使其保持活动状态。

You can also add URLs in the text box and Power BI uses those link to make it live.

若要添加形状、图像和文本框,请导航到主页选项卡,在顶部您会找到一个添加图像的选项。

To add shapes, images and text box, navigate to the Home tab and at the top you will find an option to add images.

home tab

您可以在数据可视化中插入不同的形状。要查看可用形状,请单击形状按钮旁边的箭头。

You can insert different shapes in data visualization. To see the available shapes, click the arrow next to the Shapes button.

insert shapes

当您单击文本框时,它会在您的报表画布中添加一个文本框。您可以在文本框中输入任何文本,并使用富文本编辑器进行格式更改。

When you click on the text box, it adds a text box in your Report canvas. You can enter any text in the text box and use the rich text editor to make formatting changes.

text box

类似地,可以向数据可视化中添加图像以向数据可视化中添加徽标或其他图像。当您单击图像选项时,它会要求提供一个路径来传递图像文件。

Similarly, images can be added to data visualization to add logos or other images to data visualization. When you click the Image option, it asks for a path to pass the image file.

您可以通过从下拉列表中选择任意形状来添加形状。您还可以使用不同的选项对其进行调整。

You can add shapes by selecting any shape from the dropdown list. You can also resize it using different options.

selecting any shape

Styling Reports

在 Power BI 中,您有灵活的选项可用于调整页面布局和格式,例如方向和报表页面大小。从“开始”选项卡导航到“页面视图”菜单,系统将提供以下选项。

In Power BI, you have flexible options to adjust the page layout and formatting such as orientation and page size of your report. Navigate to Page View menu from the Home tab and the following options are provided.

  1. Fit to Page

  2. Fit to Width

  3. Actual Size

flexible options

默认情况下,报表中的页面大小为 16:9;但是,也可以更改报表的页面大小。若要更改页面大小,请导航到“可视化效果”窗格,然后选择“画笔”。

By default, the page size in a report is 16:9; however, it is also possible to change the page size of the report. To change the page size, navigate to the Visualization pane and select Paint brush.

Note - 若要更改页面大小,请勿向报表画布中添加任何可视化效果。在“页面布局”下有以下可用选项:

Note − To change page size, no visualization should be added to the Report canvas. You have the following options available under Page layout −

  1. Page Information

  2. Page Size

  3. Page Background

在“页面信息”下,您将看到“名称”和“问答”。

Under Page Information, you have Name and Q&A.

在“页面大小”下,您可从以下选项中进行选择:

Under Page Size, you can select from the following options −

  1. Type

  2. Width

  3. Height

under page size

在“页面背景”下,您可从以下选项中进行选择:

Under Page Background, you can select from the following options:

  1. Color

  2. Transparency

  3. Add Image

under page background

Duplicating Reports

在某些情况下,您可能想对不同的页面使用相同的布局和视觉对象。Power BI 提供了创建页面副本的选项。使用“复制页面”选项后,将添加一个具有类似布局和视觉对象的新页面。

In some scenarios, you may want to use the same layout and visuals for different pages. Power BI provides an option to create a copy of the page. When you use Duplicate Page option, a new page is added with similar layout and visuals.

若要复制页面,请右键单击“页面”,然后选择“复制页面”选项。这将创建一个具有相同页面名称的副本 - 复制的 Page1。

To duplicate a page, right-click the Page and select Duplicate Page option. This will create a copy of the same page with the name - Duplicate of Page1.

duplicate page option

现在,如果您想重命名现有页面或删除页面,您可以使用其他选项,如以上屏幕截图所示。

Now, if you want to rename an existing page or delete a page, you can use other options as shown in the above screenshot.

Power BI - Excel Integration

在本章中,您将学习如何将 Excel 与 Power BI 集成。

In this chapter, you will learn how to integrate excel with Power BI.

Using Excel Data

使用 Power BI,您还可以将 Excel 工作簿文件从本地驱动器导入到 Power BI 中。若要从 Excel 表格导入数据,您必须确保每列都有一个正确的名称。若要在 Power BI 中导入 Excel 文件,请导航到“获取数据 → 文件 → 本地文件”。

Using Power BI, you can also import Excel workbook file from the local drive into Power BI. To import data from the excel sheet, you have to ensure that each column has a proper name. To import an Excel file in Power BI, navigate to Get Data → Files → Local Files.

import excel file

Importing xls Files

在 Power BI 服务中,导航到“我的工作区 → 文件 → 本地文件”。

In Power BI Service, navigate to My Workspace → File → Local File.

my workspace

另外请注意,您的 Excel 文件不必只保存在本地驱动器上。您还可以从 OneDrive 甚至从 SharePoint 导入 Excel 工作簿。

Also note that it is not necessary your Excel file should only be saved on the Local Drive. You can also import an Excel workbook from OneDrive or even from SharePoint.

导入数据集后,您就可以在 Power BI 中创建报表了。已导入的数据集在 Power BI 菜单中的“数据集”选项下可用。

Once the dataset is imported, you are ready to create the reports in Power BI. Imported dataset is available under “DATASETS” option in Power BI menu.

双击“数据集”。然后,导航到“探索”选项卡。这将打开一个新的报表画布。来自表格和对应列的所有字段在屏幕右侧的“字段”选项下可用。

Double-click Datasets. Then, navigate to the Explore tab. This will open a new Report Canvas. All the fields from your table and corresponding columns are available under the Fields option on the right side of the screen.

doubleclick datasets

若要创建报表,请选择任何可视化效果并将表格中的字段添加到可视化效果中。

To create a report, select any visualization and add the fields from the table to visualization.

Sharing Power BI Dashboards

在本章中,您将了解如何共享 Power BI 仪表板以用于报表共享、打印、发布等操作。

In this chapter, you will learn how to share Power BI dashboard for report sharing, printing, publishing, etc.

Using Power BI Desktop for Report Sharing

在 Power BI 桌面中创建了 BI 报表后,您还可以与其他业务用户共享这些报表。组织中的所有 BI 报表、仪表板和数据都可以与其他同事和业务用户共享。

Once BI reports are created in Power BI desktop, you can also share the reports with other business users. All BI reports, dashboards, and data can be shared with other colleagues and business users in the organization.

您可以使用以下方法共享报表 −

You can share reports using the following methods −

  1. Publish reports using Power BI Service

  2. Content Packs combine dashboard, report, and datasets obtained in BI desktop tool

  3. Create Groups and assign specific rights to different users for report sharing

  4. Use Power BI mobile apps to access share dashboards and reports

让我们了解如何使用 Power BI 桌面工具发布 BI 报表。

Let us see how to publish a BI report using Power BI desktop tool.

创建报表后,导航到 Power BI 桌面中“开始”选项卡上的“发布”按钮。

Once the report is created, navigate to the Publish button on the Home tab in Power BI desktop.

publish bi report

一旦您选择“发布服务”,您的可视化、自定义度量和报表将全部打包并发布到 Power BI 服务。Power BI 文件具有 .pbix 文件扩展名。当上传过程正在进行时,您将看到一个“正在发布”对话框。

Once you select the Publish service, your visuals, custom measures and reports are all packaged and published to Power BI service. Power BI files have an extension .pbix files. When the upload is in process, you get a dialog box that Publishing is in process.

publish service

一旦上传完成,您将收到宣布“成功”的确认消息。您还可以从对话框中查看快速见解并打开共享的报表。

Once the upload is complete, you will get a confirmation message announcing the “Success”. You can also view Quick Insights and open the shared report from the dialog box.

confirmation message

Printing Power BI Dashboards

有时还需要打印报表和仪表板。使用 Power BI,您可以打印 BI 报表和仪表板。要打印报表,请导航到 Power BI 服务并单击“…”选项。

It is also required sometimes to take printouts of your reports and dashboards. With Power BI, you can take prints of your BI reports and dashboards. To take a Printout of the report, navigate to Power BI service and click the “…” option.

reports and dashboards

它将打开一个“打印”对话框。您可以选择想要在其中打印报表的打印机。您还可以选择不同的打印选项,如纵向/横向、页边距、页眉或比例。

It will open a Print dialog box. You can select the Printer on which you want to take the printout of the report. You can also select different Print options such as Portrait/Landscape, Margins, Header or Scale.

print dialog box

Export Options

在 Power BI 中,您还可以使用不同的“导出”选项从 BI 报表中导出数据。要使用导出选项,请导航到 Power BI 服务并选择您要导出的 BI 报表。

In Power BI, you can also use different Export options to export data from BI report. To use the export option, navigate to Power BI service and select the BI report you want to export.

bi report export

当您单击“导出到”选项时,它将生成一个 CSV 文件。在 Power BI 中,您还可以通过导航到“文件 → 打印”选项直接导出/查看报表。

When you click the Export to option, it generates a CSV file. In Power BI, you can also export/view a report directly by navigating to File → Print option.

csv file

Publishing Report to Web

在 Power BI 中,还可以将 BI 报表发布到网络或通过电子邮件进行共享。要将报表发布到网络,您必须导航到 Power BI 服务 → 我的工作区。

In Power BI, it is also possible to publish a BI report to web or share it via email. To publish a report to the web, you have to navigate to Power BI service → My Workspace.

publishing report to web

打开您想要发布的报表后,导航到“文件”选项卡 → “发布到网络”。选中此选项后,它将打开一个新对话框,为该报表创建一个嵌入代码以包含在网站或电子邮件中。

Once you open the report that you want to publish, navigate to the File tab → Publish to Web. Once you select this option, it opens a new dialog that creates an embed code for this report to include in the website or email.

选项说:获取您可以在公共网站上包含的链接或嵌入代码。您可能使用发布到网络功能在公开网站上共享内容。您可能不会使用此功能在内部共享内容,包括通过您的电子邮件、内部网络或内部网站。发布一个实时版本,该版本将保持与 Power BI 中的源报表同步。您对报表所做的任何更改将立即反映在已发布的公开版本中。

Option says: Get a link or embed code that you can include on a public website. You may use publish to web functionality to share content on a publicly available website. You may not use this functionality to share content internally, which includes through your email, your internal network, or intranet site. Publish a live version that will remain synchronized with the source report in Power BI. Any changes you make to the report will immediately be reflected in the published public version.

publish to web

当您选择 - 创建嵌入代码时,Power BI 会提示您希望与互联网上的每个人共享您的数据。

When you select - Create Embed code, Power BI prompts that you want to share your data with everyone on the internet.

显示以下消息:您正准备为此报表创建一个嵌入代码。一旦发布,互联网上的任何人都将能够访问该报表及其包含的数据,并且 Microsoft 可能会在公共网站或公共图库中展示该报表。

The following message is displayed: You are about to create an embed code for this report. Once published, anyone on the Internet will be able to access the report and the data it contains, and Microsoft may display the report on a public website or a public gallery.

在发布此报表之前,请确保您有权公开共享数据和可视化。请勿发布机密或专有信息或个人的个人数据。如果有疑问,请在发布前查看您组织的政策。

Before publishing this report, ensure you have the right to share the data and visualizations publicly. Do not publish confidential or proprietary information, or an individual’s personal data. If in doubt, check your organization’s policies before publishing.

Note - 您可以将报告发布为网页,拥有链接的任何用户都可以查看它。可以通过电子邮件发送链接或将其用作网页中的 iframe。

Note − You can publish the report as a web page and any user with the link can view it. The link can be sent via email or it can be used as an iframe in a web page.

sent via email

Deleting an Embed Code

假设你想删除嵌入代码。导航至屏幕顶部的齿轮图标,如下面的屏幕截图所示。然后转到“管理嵌入代码”。

Let us say, you want to delete an embed code. Navigate to the Gear icon at the top of the screen as shown in the following screenshot. Then go to Manage Embed codes.

deleting embed code

要删除嵌入代码,请单击报告名称前方的省略号标记 (…​) 并选择“删除”选项。

To remove an embed code click the ellipsis mark (…) in front of the report name and select the Delete option.

ellipsis mark

当你单击“删除”选项时,它将询问你是否要删除已发布到网络的代码。一旦你确定,单击“删除”。

When you click the Delete option, it will ask you if you want to delete publish to web code. Once you are sure, click Delete.

delete publish web code

Using Content Pack

在 Power BI 中,你还可以与同事共享仪表板、报告和数据集作为包。要创建内容包,请单击 Power BI 工作区中的齿轮箱图标,如下面的屏幕截图所示。

In Power BI, you can also share dashboard, report, and dataset as a package with your colleagues. To create a content pack, click the Gear box icon in Power BI workspace as shown in the following screenshot.

using content pack

一旦你选择“创建内容包”,将提示你输入一个新对话框。你可以选择是否使用特定组或我的整个组织来分发此内容包。

Once you select Create content pack, you will be prompted with a new dialog box. You can choose if you want to distribute this content pack with Specific Groups or My Entire Organization.

如果你想与特定人员共享此内容包,你必须输入电子邮件地址。你还可以添加内容包的标题和说明,如下面的屏幕截图所示。

If you want to share this with specific people, you have to enter email addresses. You can also add a Title and description of the content pack as shown in the following screenshot.

email addresses

在页面的底部,你有一个选项可以让你选择你想要发布的组件。你可以从以下选项中进行选择 -

At the bottom of the page, you have an option to select the components you want to publish. You can select from the following −

  1. Dashboards

  2. Reports

  3. Datasets

select components publish

Editing Content Pack

创建内容包后,你还可以返回并编辑内容包的共享对象。每当你更新任何仪表板、BI 报告时,系统会提示你是否要更新共享内容。

When a content pack is created, you can also go back and edit the shared objects of the content pack. Whenever you update any dashboard, BI report, you are prompted if you want to update the shared content.

单击“我的工作区”下的齿轮箱图标 → “查看内容包”。

Click the Gear box icon under My Workspace → View Content Pack.

editing content pack

如果你看到内容包名称前有一个小图标,这表示内容包已更新。当你选择编辑按钮时,你将到达主页屏幕,在那里你可以创建新的内容包。

If you see a small icon in front of the name of the content pack, it shows that the content pack is updated. When you select the edit button, you will reach the home screen, where you can create a new content pack.

create new content pack

Power BI 会接受你对内容包所做的所有更改,并将更新后的内容包发布到内容包库。

Power BI accepts all the changes you make to the content pack and publishes the updated content pack to the content pack gallery.

DAX Basics in Power BI

在本章中,你将学习如何在 Power BI 中使用各种 DAX 函数。

In this chapter, you will learn how to use various DAX functions in Power BI.

DAX Introduction

DAX(数据分析表达式)是一种公式表达式语言,可以用在不同的 BI 和可视化工具中。DAX 也被称为函数语言,其中完整代码保留在函数中。DAX 编程公式包含两种数据类型:数字型和其他类型。数字型包括整数、货币和小数,而其他类型包括字符串和二进制对象。

DAX (Data Analysis Expressions) is a formula expression language and can be used in different BI and visualization tools. DAX is also known as function language, where the full code is kept inside a function. DAX programming formula contains two data types: Numeric and Other. Numeric includes - integers, currency and decimals, while Other includes: string and binary object.

以下是 DAX 公式的一个示例,它使用一个函数来计算表中的一列。

Following is an example of DAX formula, which uses a function to calculate a column in a table.

dax formula

DAX 函数还可以包括其他函数、条件语句和值引用。

DAX function can also include other functions, conditional statements, and value references.

DAX Functions

在 Power BI 中,你可以使用不同类型的函数来分析数据,并创建新的列和度量。它包括来自不同类别的函数,例如 -

In Power BI, you can use different function types to analyze data, and create new columns and measures. It includes functions from different categories such as −

  1. Aggregate

  2. Text

  3. Date

  4. Logical

  5. Counting

  6. Information

Power BI 提供了一种查看所有函数列表的简单方法。当你开始在公式栏中输入函数时,你可以看到从该字母开头的所有函数的列表。

Power BI provides an easy way to see the list of all functions. When you start typing your function in the formula bar, you can see the list of all functions starting with that alphabet.

all functions

Aggregate Functions

DAX 具有许多聚合函数。

DAX has a number of aggregate functions.

  1. MIN

  2. MAX

  3. Average

  4. SUM

  5. SUMX

Counting Functions

DAX 中的其他计数函数包括 −

Other counting functions in DAX include −

  1. DISTINCTCOUNT

  2. COUNT

  3. COUNTA

  4. COUNTROWS

  5. COUNTBLANK

Logical Functions

以下是对逻辑函数的收集 −

Following are the collection of Logical functions −

  1. AND

  2. OR

  3. NOT

  4. IF

  5. IFERROR

TEXT Functions

  1. REPLACE

  2. SEARCH

  3. UPPER

  4. FIXED

  5. CONCATENATE

DATE Functions

  1. DATE

  2. HOUR

  3. WEEKDAY

  4. NOW

  5. EOMONTH

INFORMATION Functions

  1. ISBLANK

  2. ISNUMBER

  3. ISTEXT

  4. ISNONTEXT

  5. ISERROR

DAX Calculation Types

在 Power BI 中,可以使用 DAX 创建两种主要计算 −

In Power BI, you can create two primary calculations using DAX −

  1. Calculated columns

  2. Calculated measures

导航到“建模”选项卡时,可以在屏幕顶部看到“新建列”选项。它还将打开可在此处输入 DAX 公式以执行计算的公式栏。DAX - 数据分析表达式在 Excel 中是一种用于执行计算的强大语言。还可以通过更改公式栏中的“列”文本来重新命名此列。

When you navigate to the Modeling tab, you can see a New Column option at the top of the screen. This also opens the formula bar where you can enter DAX formula to perform the calculation. DAX - Data Analysis Expression is a powerful language used in Excel to perform calculations. You can also rename the column by changing the Column text in the formula bar.

excel to perform calculations

在以下示例中,我们创建了一个新列:产品编码 (Product_C),它派生自 Prod_Id 列的最后 3 个字符。以下是该公式 −

In the following example, we have created a new column: Product Code (Product_C), which is derived from the last 3 characters of Prod_Id column. Following is the formula −

Product_C = RIGHT( Sheet1[Prod_Id],3)

若要创建计算度量值,请导航到“建模”下方的“新建度量值”选项卡。这将在“字段”选项卡下添加一个新对象,并将其命名为度量值。

To create a calculated measure, navigate to New Measure tab under Modeling. This will add a new object under the Fields tab with the name Measure.

create calculated measure
new measure tab

可以编写 DAX 公式来计算新度量值的值,就像我们对新计算列所做的那样。

You can write DAX formula to calculate the value of the new measure, as we did for the new calculated column.

Power BI - Administration Role

Power BI 管理角色分配给那些在不授予 Office 365 访问权限的情况下在 BI 管理员门户上需要管理员权限的人员。

Power BI administration role is assigned to those who require admin privilege on BI Admin portal, without granting Office 365 access.

若要提供管理员访问权限,请导航到 Office 365 管理中心,选择“用户”,然后选择“活动用户”。

To provide admin access, navigate to Office 365 Admin Center, select Users and then Active Users.

导航到“角色”选项卡,然后单击“编辑”选项。

Navigate to the Roles tab and click the Edit option.

roles tab

导航到“自定义管理员”选项卡,然后选择“Power BI 服务管理员”。

Navigate to the Customized Administrator tab and select Power BI Service Administrator.

customized administrator tab

Purchasing

Power BI 是 Microsoft 新设计的工具,由以下组件组成 −

Power BI is a newly designed tool from Microsoft, which consists of the following components −

  1. Power BI Desktop

  2. Power BI Service

  3. Connector Gateway

Power BI 桌面版是一个可以从 Microsoft 网站安装且没有任何额外费用的免费工具。

Power BI desktop is a free tool that can be installed from the Microsoft site without any additional cost.

power bi desktop free tool

这是直接下载 Power BI 文件的链接 -

This is the link to directly download Power BI files −

download power bi files
choose the download

Power BI Pro 有 60 天的免费试用期,之后可按 9.99 美元/用户/月的价格购买。Power BI Premium 按每个节点/月容量定价。

Power BI Pro has 60-days free trial and then it can be purchased for 9.99$/user/month. Power BI Premium is as per the capacity pricing per node/month.

Power BI 还提供内部部署报表服务器,该服务器可用于发布报表,并具备日后移至云环境的灵活性。

Power BI also provides on-premise report server, which can be used for publishing a report with the flexibility to move to the cloud environment later.

onpremise report server

Power BI Pro 报表服务器也有试用版,根据公司网站所示,Power BI 报表服务器可以在现代内部部署解决方案中访问数据和见解,并具备 SQL Server Reporting Services 的企业级报告功能。

A trial version is also available for Power BI Pro Report Server and as per the company website - Power BI Report Server provides access to data and insights, and the enterprise reporting capabilities of SQL Server Reporting Services in a modern, on-premises solution.

它有助于以可视化方式浏览数据并快速发现模式,以便更快地做出更佳决策。同时,它根据业务需求生成格式准确的报表。此外,由于 Power BI 报表服务器基于久经考验的企业级平台,因此还可以自信地扩展到数千个用户。

It assists in visually exploring data and quickly discovering patterns to make better, faster decisions. At the same time, it generates precisely formatted reports based on the business needs. You’ll also be able to confidently scale to thousands of users as Power BI Report Server is based on a proven, enterprise-grade platform.

REST API

在 Power BI 中,还可以使用 REST API 实时推送数据。借助 Power BI REST API,您可以创建数据集、仪表板、添加和删除行以及获取组。

In Power BI, it is also possible to push data in real time using REST APIs. With Power BI REST API, you can create data sets, dashboards, add and delete rows and get groups.

可以使用以下任何技术创建 Power BI REST API−

A Power BI REST API can be created using any of the following technologies −

  1. .NET

  2. JQuery

  3. Ruby

要验证 Power BI 的身份,您需要获取 Azure Active Directory 令牌,这可以允许您的应用访问 Power BI 仪表板。

To authenticate Power BI, you need to get an Azure Active Directory token and this can allow your app to access Power BI dashboards.

以下是从 Power BI 服务中的 Azure AD 获取授权代码的 C# 代码。

Following is the C# code to get an authorization code from Azure AD in Power BI service.

azure ad power bi service

Security

当用户使用 Power BI 服务验证身份时,将在 Power BI 中使用 Azure Active Directory (AAD) 验证。Power BI 登录凭据可以是用户用于设置其 BI 帐户的电子邮件帐户,并且是一个有效的用户名。

Azure Active Directory (AAD) authentication is used in Power BI when a user authenticates using Power BI service. Power BI login credentials can be an email account used by users to set up their BI account and is an effective username.

Power BI 提供了 Azure 云使用的安全级别,包括以下安全级别−

Power BI provides security level used by Azure cloud that includes the following level of security −

  1. Multitenant Environment Security

  2. Networking Security

  3. AAD based Security

在数据存储方面,Power BI 中使用了两种不同的存储库−

For data storage, there are two different repositories used in Power BI −

  1. Azure BLOB

  2. Azure SQL Database

用户上传的数据使用 Azure BLOB 存储,Azure SQL 数据库用于存储系统数据。Power BI 安全性主要基于 Azure 云中可用的数据和网络安全功能,并且验证也基于 Azure AD。

Azure BLOB storage is used for data uploaded by users and Azure SQL database is used to store system data. Power BI security is mostly based on data and network security features available in Azure cloud and authentication is also based on Azure AD.