Power BI Desktop 入门

Power BI Desktop 入门Get started with Power BI Desktop

  • 2020/08/19

欢迎使用 Power BI Desktop 入门指南。Welcome to the getting started guide for Power BI Desktop. 本教程介绍 Power BI Desktop 的工作原理和功能,并介绍如何生成可靠的数据模型和奇妙的报表来提升你的商业智能。This tour shows you how Power BI Desktop works, what it can do, and how to build robust data models and amazing reports to amplify your business intelligence.

要快速了解 Power BI Desktop 的工作原理及其使用方式,只需花几分钟浏览一下本指南中的屏幕。For a quick overview of how Power BI Desktop works and how to use it, you can scan the screens in this guide in just a few minutes. 要更深入地了解,可通读各个部分,执行相关步骤,创建自己的 Power BI Desktop 文件并将其发布到 Power BI 服务以与他人共享。For a more thorough understanding, you can read through each section, perform the steps, and create your own Power BI Desktop file to post on the Power BI service and share with others.

还可观看 Power BI Desktop 入门视频,并下载 财务示例 Excel 工作簿按视频进行操作。You can also watch the Getting Started with the Power BI Desktop video, and download the Financial Sample Excel workbook to follow along with the video.

重要

每月更新并发布 Power BI Desktop,在其中包含客户反馈和新增功能。Power BI Desktop is updated and released on a monthly basis, incorporating customer feedback and new features. 仅支持 Power BI Desktop 的最新版本;将要求联系 Power BI Desktop 支持的客户升级到最新版本。Only the most recent version of Power BI Desktop is supported; customers who contact support for Power BI Desktop will be asked to upgrade to the most recent version. 可以从 Windows 应用商店获取 Power BI Desktop 的最新版本,也可以在计算机上以单个可执行文件的形式下载并安装所有受支持的语言。You can get the most recent version of Power BI Desktop from the Windows Store, or as a single executable containing all supported languages that you download and install on your computer.

Power BI Desktop 工作原理How Power BI Desktop works

使用 Power BI Desktop,可以:With Power BI Desktop, you can:

  1. 连接到数据,包括多个数据源。Connect to data, including multiple data sources.
  2. 借助可生成见解深刻、令人信服数据模型的查询来调整数据。Shape the data with queries that build insightful, compelling data models.
  3. 使用数据模型创建可视化效果和报表。Use the data models to create visualizations and reports.
  4. 共享报表文件以供他人使用、用作基础文件和共享。Share your report files for others to leverage, build upon, and share. 可像任何其他文件一样共享 Power BI Desktop“.pbix”文件,但最具吸引力的方法是将其上传到 Power BI 服务。You can share Power BI Desktop .pbix files like any other files, but the most compelling method is to upload them to the Power BI service.

Power BI Desktop 集成了久经考验的 Microsoft 查询引擎、数据建模和可视化技术。Power BI Desktop integrates proven Microsoft query engine, data modeling, and visualization technologies. 数据分析师和其他人员可以创建查询、数据连接、模型和报表集合,并轻松与他人共享。Data analysts and others can create collections of queries, data connections, models, and reports, and easily share them with others. 通过组合 Power BI Desktop 和 Power BI 服务,数据世界的新见解将更易于建模、生成、共享和扩展。Through the combination of Power BI Desktop and the Power BI service, new insights from the world of data are easier to model, build, share, and extend.

Power BI Desktop 会集中、简化并效率化设计与创建商业智能存储库和报表的程序,这些程序可能是散乱、不相关且棘手的。Power BI Desktop centralizes, simplifies, and streamlines what can otherwise be a scattered, disconnected, and arduous process of designing and creating business intelligence repositories and reports.准备好要试一试吗?Ready to give it a try? 现在就开始吧。Let's get started.

备注

对于必须保留在本地的数据和报表,Power BI 提供一个单独的专业版本,名为 Power BI 报表服务器。For data and reporting that must remain on-premises, there's a separate and specialized version of Power BI called Power BI Report Server. Power BI 报表服务器使用单独的专业版 Power BI Desktop,该版本名为用于 Power BI 报表服务器的 Power BI Desktop,并且仅适用于 Power BI 的报表服务器版本。Power BI Report Server uses a separate and specialized version of Power BI Desktop called Power BI Desktop for Power BI Report Server, which works only with the Report Server version of Power BI. 本文介绍标准版 Power BI Desktop。This article describes standard Power BI Desktop.

安装并运行 Power BI DesktopInstall and run Power BI Desktop

要下载 Power BI Desktop,请前往 Power BI Desktop 下载页面,然后选择“免费下载”。To download Power BI Desktop, go to the Power BI Desktop download page and select Download Free. 或者对于下载选项,选择查看下载或语言选项。Or for download options, select See download or language options.

还可从 Power BI 服务下载 Power BI Desktop。You can also download Power BI Desktop from the Power BI service. 在顶部菜单栏中选择“下载”图标,然后选择“Power BI Desktop” 。Select the Download icon in the top menu bar, and then select Power BI Desktop.

在 Microsoft Store 页面上,选择“获取”,然后按照提示在计算机上安装 Power BI Desktop。On the Microsoft Store page, select Get, and follow the prompts to install Power BI Desktop on your computer. 从 Windows“开始”菜单或从 Windows 任务栏中的图标启动 Power BI Desktop。Start Power BI Desktop from the Windows Start menu or from the icon in the Windows taskbar.

Power BI Desktop 首次启动时,会显示“欢迎”屏幕。The first time Power BI Desktop starts, it displays the Welcome screen.

在“欢迎”屏幕中,可获取数据,查看最近使用的源,打开最近使用的报表,打开其他报表,或选择其他链接 。From the Welcome screen, you can Get data, see Recent sources, open recent reports, Open other reports, or select other links. 还可选择在启动时是否始终显示“欢迎”屏幕。You can also choose whether to always show the Welcome screen at startup. 选择关闭图标可关闭“欢迎”屏幕。Select the close icon to close the Welcome screen.

Power BI Desktop 左侧为三个 Power BI Desktop 视图的图标:“报表”、“数据”和“关系”。Along the left side of Power BI Desktop are icons for the three Power BI Desktop views: Report, Data, and Relationships, from top to bottom. 左侧的黄色栏指示当前视图,可通过选择任一图标来更改视图。The current view is indicated by the yellow bar along the left, and you can change views by selecting any of the icons.

“报表”视图为默认视图。Report view is the default view.

Power BI Desktop 还包括“Power Query 编辑器”,它将在在单独的窗口中打开。Power BI Desktop also includes the Power Query Editor, which opens in a separate window. 在“Power Query 编辑器”中,可生成查询和转换数据,然后将经过细化的数据模型加载到 Power BI Desktop 以创建报表。In Power Query Editor, you can build queries and transform data, then load the refined data model into Power BI Desktop to create reports.

连接到数据Connect to data

安装 Power BI Desktop 后,便可连接到不断扩展的数据世界。With Power BI Desktop installed, you're ready to connect to the ever-expanding world of data. 要查看多种可用的数据源,请在 Power BI Desktop 的“主页”选项卡中选择“获取数据” > “更多”,然后在“获取数据”窗口中,滚动浏览“所有”数据源的列表 。To see the many types of data sources available, select Get Data > More in the Power BI Desktop Home tab, and in the Get Data window, scroll through the list of All data sources. 在本快速教程中,你将连接到几个不同的“Web”数据源。In this quick tour, you connect to a couple of different Web data sources.

假设你是一家太阳镜零售商的数据分析师。Imagine you're a data analyst working for a sunglasses retailer. 你希望帮助客户在四季阳光充足的州销售太阳镜。You want to help your client target sunglasses sales where the sun shines most frequently. Bankrate.com 最佳和最糟退休州页面上提供了关于本主题的有趣数据。The Bankrate.com Best and worst states for retirement page has interesting data on this subject.

在 Power BI Desktop 的“主页”选项卡中,选择“获取数据” > “Web”以连接到 Web 数据源 。On the Power BI Desktop Home tab, select Get Data > Web to connect to a web data source.

在“来自 Web”对话框中,将地址 https://www.bankrate.com/retirement/best-and-worst-states-for-retirement/ 粘贴到“URL”字段中,然后选择“确定” 。In the From Web dialog box, paste the address https://www.bankrate.com/retirement/best-and-worst-states-for-retirement/ into the URL field, and select OK.

如果出现提示,请在“访问 Web 内容”屏幕上,选择“连接”以使用匿名访问 。If prompted, on the Access Web Content screen, select Connect to use anonymous access.

Power BI Desktop 的查询功能开始运行并与 Web 资源联系。The query functionality of Power BI Desktop goes to work and contacts the web resource. “导航器”窗口返回它在网页上找到的内容,在本例中,它返回一个名为“最佳和最糟退休州排名”的表和一个文档 。The Navigator window returns what it found on the web page, in this case a table called Ranking of best and worst states for retirement, and a document. 你对该表有兴趣,因此选择它以查看预览。You're interested in the table, so select it to see a preview.

此时,你可以选择“加载”来加载该表,也可以选择“转换数据”以在表中进行更改,然后再加载 。At this point you can select Load to load the table, or Transform data to make changes in the table before you load it.

如果选择“转换数据”,Power Query 编辑器将会启动,并显示表的代表性视图。When you select Transform data, Power Query Editor launches, with a representative view of the table. “查询设置”窗格在右侧,你也可以通过如下操作来显示它:在 Power Query 编辑器的“视图”选项卡上,选择“查询设置” 。The Query Settings pane is on the right, or you can always show it by selecting Query Settings on the View tab of Power Query Editor.

有关连接到数据的详细信息,请参阅连接到 Power BI Desktop 中的数据。For more information about connecting to data, see Connect to data in Power BI Desktop.

调整数据Shape data

现在你已经连接到数据源,你可以调整数据以符合需求。Now that you're connected to a data source, you can adjust the data to meet your needs. 要调整数据,请在加载和呈现数据时为 Power Query 编辑器提供调整数据的分步说明。To shape data, you provide Power Query Editor with step-by-step instructions for adjusting the data while loading and presenting it. 调整不会影响原始数据源,只会影响数据的这一特定视图。Shaping doesn't affect the original data source, only this particular view of the data.

备注

本指南中使用的表数据可能随时更改。The table data used in this guide might change over time. 因此,你需要遵循的步骤可能有所不同,这就要求你在调整步骤或结果方面具有创造性,这也体现了学习的乐趣。As such, the steps you need to follow might vary, requiring you to be creative about how you adjust steps or outcomes, which is all part of the fun of learning.

调整可能意味着转换数据,例如,重命名列或表、删除行或列,或者更改数据类型。Shaping can mean transforming the data, such as renaming columns or tables, removing rows or columns, or changing data types. Power Query 编辑器在“查询设置”窗格中的“已应用步骤”下依次捕获这些步骤 。Power Query Editor captures these steps sequentially under Applied Steps in the Query Settings pane. 每当此查询连接到数据源时,都会执行这些步骤,这样,数据将始终以指定的方式进行调整。Each time this query connects to the data source, those steps are carried out, so the data is always shaped the way you specify. 每当你在 Power BI Desktop 中使用查询时,或任何人使用你的共享查询(例如在 Power BI 服务中)时,都会执行此过程。This process occurs when you use the query in Power BI Desktop, or when anyone uses your shared query, such as in the Power BI service.

注意,“查询设置”中的“已应用步骤”已经包含了一些步骤 。Notice that the Applied Steps in Query Settings already contain a few steps. 你可以选择每个步骤来查看其在 Power Query 编辑器中的效果。You can select each step to see its effect in the Power Query Editor. 一开始,你指定了一个 Web 源,然后在“导航器”窗口中预览了表。First, you specified a web source, and then you previewed the table in the Navigator window. 在第三步中,更改了类型,Power BI 在导入时识别了整数数据,并自动将原始 Web“文本”数据类型更改为了“整数” 。In the third step, Changed type, Power BI recognized whole number data when importing it, and automatically changed the original web Text data type to Whole numbers.

如果需要更改数据类型,请选择一列或多列进行更改。If you need to change a data type, select the column or columns to change. 按住“Shift”键可选择多个相邻的列,按住“Ctrl”键可选择非相邻列 。Hold down the Shift key to select several adjacent columns, or Ctrl to select non-adjacent columns. 右键单击列标题,选择“更改类型”,然后在菜单中选择新数据类型;或者在“主页”选项卡的“转换”组中,下拉“数据类型”旁边的列表,然后选择新数据类型 。Either right-click a column header, select Change Type, and choose a new data type from the menu, or drop down the list next to Data Type in the Transform group of the Home tab, and select a new data type.

备注

Power BI Desktop 中的 Power Query 编辑器使用功能区或右键单击菜单来执行可用任务。The Power Query Editor in Power BI Desktop uses the ribbon or the right-click menus for available tasks. 大部分可在“主页”或功能区的“转换”选项卡上选择的任务,也可以通过右键单击一个项目并在出现的菜单中进行选择来实现 。Most of the tasks you can select on the Home or Transform tabs of the ribbon are also available by right-clicking an item and choosing from the menu that appears.

现在,你可以对数据应用自己的更改和转换,并在“已应用步骤”中查看。You can now apply your own changes and transformations to the data and see them in Applied Steps.

例如,对于太阳镜销售,你最想了解的是天气排名,因此,你决定按照“天气”列而不是“整体排名”来对表进行排序 。For example, for sunglasses sales you're most interested in the weather ranking, so you decide to sort the table by the Weather column instead of by Overall rank. 下拉“天气”标头旁边的箭头,并选择“升序排序” 。Drop down the arrow next to the Weather header, and select Sort ascending. 数据现在按照天气排名排序,并且“已应用步骤”中会出现“已对行排序”这一步骤 。The data now appears sorted by weather ranking, and the step Sorted Rows appears in Applied Steps.

你不是很想把太阳镜卖给天气最糟糕的州,所以你决定将它们从表中删除。You're not very interested in selling sunglasses to the worst weather states, so you decide to remove them from the table. 从“主页”选项卡的“减少行”组,选择“删除行” > “删除最后几行” 。From the Reduce Rows group of the Home tab, select Remove Rows > Remove Bottom Rows. 在“删除最后几行”对话框中,输入“10”,然后选择“确定” 。In the Remove Bottom Rows dialog box, enter 10, and then select OK.

将从表中删除最后 10 行天气最糟糕的州,并且“已应用步骤”中会出现“已删除最后几行”这一步骤 。The bottom 10 worst weather rows are removed from the table, and the step Removed Bottom Rows appears in Applied Steps.

你认为表中包含太多不必要的信息,决定删除“可购性”、“犯罪”、“文化”和“健康”列 。You decide the table has too much extra information for your needs, and to remove the Affordability, Crime, Culture, and Wellness columns. 选择要删除的各列的标头。Select the header of each column that you want to remove. 按住“Shift”键可选择多个相邻的列,按住“Ctrl”键可选择非相邻列 。Hold down the Shift key to select several adjacent columns, or Ctrl to select non-adjacent columns.

然后,从“主页”选项卡的“管理列”组中,选择“删除列” 。Then, from the Manage Columns group of the Home tab, select Remove Columns. 你还可右键单击其中一个选定的列标头,然后在菜单中选择“删除列”。You can also right-click one of the selected column headers and select Remove Columns from the menu. 此操作将删除选定的列,并且“已应用步骤”中会出现“已删除列” 。The selected columns are removed, and the step Removed Columns appears in Applied Steps.

再想想,“可购性”可能与太阳镜的销售有关。On second thought, Affordability might be relevant to sunglasses sales after all. 你希望恢复该列。You'd like to get that column back. 通过选择步骤旁边的“X”删除图标,可以轻松撤消“已应用步骤”窗格中的最后一步 。You can easily undo the last step in the Applied Steps pane by selecting the X delete icon next to the step. 现在重新执行步骤,仅选择要删除的列。Now redo the step, selecting only the columns you want to delete. 为了获得更大的灵活性,可以分步删除每一列。For more flexibility, you could delete each column as a separate step.

你可以右键单击“已应用步骤”窗格中的任何步骤,然后选择删除它、对其进行重命名、在序列中上移或下移,或在其后添加或删除步骤。You can right-click any step in the Applied Steps pane and choose to delete it, rename it, move it up or down in the sequence, or add or delete steps after it. 对于中间步骤,如果更改可能会影响后续步骤并中断查询,Power BI Desktop 将向你发出警告。For intermediate steps, Power BI Desktop will warn you if the change could affect later steps and break your query.

例如,如果不再希望根据“天气”对表进行排序,可以尝试删除“已对行排序”步骤 。For example, if you no longer wanted to sort the table by Weather, you might try to delete the Sorted Rows step. Power BI Desktop 会警告你删除此步骤可能会导致查询中断。Power BI Desktop warns you that deleting this step could cause your query to break. 按天气排序后,你删除了最后 10 行,因此,如果删除排序,将删除不同的行。You removed the bottom 10 rows after you sorted by weather, so if you remove the sort, different rows will be removed. 如果选择“已对行排序”步骤,并尝试在此添加新的中间步骤,也会出现警告。You also get a warning if you select the Sorted Rows step and try to add a new intermediate step at that point.

最后,将表标题更改为关于太阳镜销售,而不是退休。Finally, you change the table title to be about sunglass sales instead of retirement. 在“查询设置”窗格中的“属性”下,将旧的标题替换为“最佳太阳镜销售州” 。Under Properties in the Query Settings pane, replace the old title with Best states for sunglass sales.

完成后的已调整数据查询如下所示:The finished query for your shaped data looks like this:

有关调整数据数据的详细信息,请参阅在 Power BI Desktop 中调整和合并数据。For more information about shaping data, see Shape and combine data in Power BI Desktop.

合并数据Combine data

有关各州的那份数据很有趣,而且适用于生成其他分析工作和查询。The data about various states is interesting, and will be useful for building additional analysis efforts and queries. 但是有一个问题:大多数数据使用两个字母的州代码缩写,而不是完整名称。But there's one problem: most data out there uses two-letter abbreviations for state codes, not the full names of the states. 要使用该数据,需要通过某种方式来将州名与其缩写关联。To use that data, you need some way to associate your state names with their abbreviations.

你很幸运。You're in luck. 另一个公共数据源可以做到这一点,但你需要对数据进行大量的调整,然后才能将数据合并到太阳镜表。Another public data source does just that, but the data will need a fair amount of shaping before you can combine it with your sunglass table.

要将州缩写数据导入 Power Query 编辑器,请在功能区“主页”选项卡上的“新建查询”组中,选择“新增源” > “Web” 。To import the state abbreviations data into Power Query Editor, select New Source > Web from the New Query group on the Home tab of the ribbon.

在“来自 Web”对话框中,输入州缩写站点的 URL:https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations。In the From Web dialog box, enter the URL for the state abbreviations site: https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations.

在“导航器”窗口中,选择“美国各州、联邦地区、领地及其他区域的代码和缩写”表,然后选择“确定” 。In the Navigator window, select the table Codes and abbreviations for U.S. states, federal district, territories, and other regions, and then select OK. 该表将在 Power Query 编辑器中打开。The table opens in Power Query Editor.

删除“区域的名称和状态”、“区域 2 的名称和状态”,以及“ANSI”之外的所有列 。Remove all columns except for Name and status of region, Name and status of region2, and ANSI. 要仅保留这些列,请按住“Ctrl”并选择相应的列。To keep only these columns, hold down Ctrl and select the columns. 然后,右键单击其中一个列标头并选择“删除其他列”,或者在“主页”选项卡的“管理列”组中,选择“删除其他列” 。Then, either right-click one of the column headers and select Remove Other Columns, or, from the Manage Columns group of the Home tab, select Remove Other Columns.

下拉“区域 2 的名称和状态”列标头旁边的箭头,并选择“筛选器” > “等于” 。Drop down the arrow next to the Name and status of region2 column header, and select Filters > Equals. 在“筛选行”对话框中,下拉“等于”旁边的“输入或选择值”字段,然后选择“州” 。In the Filter Rows dialog box, drop down the Enter or select a value field next to equals and select State.

选择“或”,然后在第二个“等于”字段旁边,选择“州(联邦)” 。Select Or, and next to the second equals field, select State ('Commonwealth'). 选择“确定”。Select OK.

删除了“联邦地区”和“岛”这样的额外值后,现在就有了一个包含 50 个州及其官方双字母缩写形式的列表 。With extra values like Federal district and island removed, you now have a list of the 50 states and their official two-letter abbreviations. 你可以重命名列以便更好理解,例如“州名”、“状态”和“缩写”,方法是右键单击列标头并选择“重命名” 。You can rename the columns to make more sense, for example State name, Status, and Abbreviation, by right-clicking the column headers and selecting Rename.

注意,所有这些步骤都记录在“查询设置”窗格中的“已应用步骤”下 。Note that all of these steps are recorded under Applied Steps in the Query Settings pane.

调整后的表现在如下所示:Your shaped table now looks like this:

在“查询设置”的“属性”字段中,将表重命名为“州代码” 。Retitle the table to State codes in the Properties field of Query Settings.

“州代码”表调整完成后,你可以将这两个表合并为一个表。With the State codes table shaped, you can combine these two tables into one. 由于你现在拥有的表是你向数据应用查询之后的结果,因此它们也称为“查询”。Since the tables you now have are a result of queries you applied to the data, they're also called queries. 有两种主要方法可合并查询:合并和追加 。There are two primary ways of combining queries: merge and append.

当你有一列或多列要添加到另一个查询时,你可合并这些查询。When you have one or more columns you'd like to add to another query, you merge the queries. 当你有其他数据行要添加到现有查询时,你可追加查询。When you have additional rows of data you'd like to add to an existing query, you append the query.

在本例中,你希望将“州代码”查询合并到“最佳太阳镜销售州”查询 。In this case, you want to merge the State codes query into the Best states for sunglasses query. 要合并查询,请切换到“最佳太阳镜销售州”查询,方法是从 Power Query 编辑器左侧的“查询”窗格中选择它 。To merge the queries, switch to the Best states for sunglasses query by selecting it from the Queries pane on the left side of Power Query Editor. 然后在功能区“主页”选项卡中的“合并”组中,选择“合并查询” 。Then select Merge Queries from the Combine group in the Home tab of the ribbon.

在“合并”窗口中,下拉字段,可从其他可用查询中选择“州代码” 。In the Merge window, drop down the field to select State codes from the other queries available. 在每个表中选择要匹配的列,在本例中,为“最佳太阳镜销售州”查询中的“州”和“州代码”查询中的“州名” 。Select the column to match from each table, in this case State from the Best states for sunglasses query and State name from the State codes query.

如果出现“隐私级别”对话框,请选择“忽略此文件的隐私级别检查”,然后选择“保存” 。If you get a Privacy levels dialog, select Ignore privacy levels checks for this file and then select Save. 选择“确定”。Select OK.

“最佳太阳镜销售州”表的右侧将出现一个名为“州代码”的新列 。A new column called State codes appears on the right of the Best states for sunglass sales table. 它包含与“最佳太阳镜销售州”查询合并的“州代码”查询。It contains the state code query that you merged with the best states for sunglass sales query. 合并后的表中的所有列都压缩到“州代码”列中。All the columns from the merged table are condensed into the State codes column. 你可以展开合并后的表并仅包含所需的列。You can expand the merged table and include only the columns you want.

要展开合并后的表,并选择要包含的列,请选择列标头中的“展开”图标。To expand the merged table and select which columns to include, select the Expand icon in the column header. 在“展开”对话框中,仅选择“缩写”列 。In the Expand dialog box, select only the Abbreviation column. 取消选中“使用原始列名作为前缀”,然后选择“确定” 。Deselect Use original column name as prefix, and then select OK.

备注

你可以尝试一下如何引入“州代码”表。You can play around with how to bring in the State codes table. 尝试一下,如果不喜欢结果,只需从“查询设置”窗格中的“已应用步骤”列表中删除该步骤即可 。Experiment a bit, and if you don't like the results, just delete that step from the Applied Steps list in the Query Settings pane. 这就像是个自由重做的机会,你可以不限次数地任意执行,直到展开过程看起来是你要的方式为止。It's a free do-over, which you can do as many times as you like until the expand process looks the way you want it.

有关调整及合并数据步骤的更完整说明,请参阅在 Power BI Desktop 调整和合并数据。For a more complete description of the shape and combine data steps, see Shape and combine data in Power BI Desktop.

现在,你在单个查询表中合并了两个数据源,每个数据源都已根据需要进行调整。You now have a single query table that combines two data sources, each of which has been shaped to meet your needs. 此查询可以作为许多其他有趣数据连接的基础,例如各州的人口统计、财富水平或娱乐机会。This query can serve as a basis for lots of additional, interesting data connections, such as demographics, wealth levels, or recreational opportunities in the states.

到目前为止,你有足够的数据在 Power BI Desktop 内创建有趣的报表。For now, you have enough data to create an interesting report in Power BI Desktop. 由于这是一个里程碑,请在“Power Query 编辑器”中应用更改,并将其加载到 Power BI Desktop 中,方法是:在功能区的“主页”选项卡中选择“关闭并应用” 。Since this is a milestone, apply the changes in Power Query Editor and load them into Power BI Desktop by selecting Close & Apply from the Home tab of the ribbon. 你还可以仅选择“应用”,以确保在 Power Query 工作时使查询在 Power Query 编辑器处于打开状态。You can also select just Apply to keep the query open in Power Query Editor while you work in Power BI Desktop.

将表加载到 Power BI Desktop 后,你可以对其进行更多更改,并重新加载模型以应用所做的任何更改。You can make more changes to a table after it is loaded into Power BI Desktop, and reload the model to apply any changes you make. 要从 Power BI Desktop 重新打开“Power Query 编辑器”,请在 Power BI Desktop 功能区的“主页”选项卡上选择“编辑查询” 。To reopen Power Query Editor from Power BI Desktop, select Edit Queries on the Home tab of the Power BI Desktop ribbon.

生成报表Build reports

在 Power BI Desktop“报表”视图中,你可以生成可视化效果和报表。In Power BI Desktop Report view, you can build visualizations and reports. “报表”视图包含六个主要区域:The Report view has six main areas:

  1. 功能区位于顶部,它显示与报表和可视化效果相关联的常见任务。The ribbon at the top, which displays common tasks associated with reports and visualizations.
  2. 画布区域位于中间,可在其中创建和排列可视化效果。The canvas area in the middle, where visualizations are created and arranged.
  3. 页面选项卡区域位于底部,它用于选择或添加报表页。The pages tab area at the bottom, which lets you select or add report pages.
  4. “筛选器”窗格,可在其中筛选数据可视化效果。The Filters pane, where you can filter data visualizations.
  5. “可视化效果”窗格,可在其中添加、更改或自定义可视化效果,并应用钻取。The Visualizations pane, where you can add, change, or customize visualizations, and apply drillthrough.
  6. “字段”窗格,它显示查询中的可用字段。The Fields pane, which shows the available fields in your queries. 你可以将这些字段拖放到画布、“筛选器”窗格或“可视化效果”窗格,以创建或修改可视化效果 。You can drag these fields onto the canvas, the Filters pane, or the Visualizations pane to create or modify visualizations.

通过选择窗格顶部的箭头,可以展开和折叠“筛选器”、“可视化效果”和“字段”窗格 。You can expand and collapse the Filters, Visualizations, and Fields panes by selecting the arrows at the tops of the panes. 折叠窗格可在画布上提供更多空间来生成炫酷的视觉化效果。Collapsing the panes provides more space on the canvas to build cool visualizations.

要创建简单的可视化效果,只需在“字段”列表中选择任意字段,或将字段从“字段”列表拖到画布上。To create a simple visualization, just select any field in the fields list, or drag the field from the Fields list onto the canvas. 例如,将“州”字段从“最佳太阳镜销售州”拖到画布上,看看会发生什么 。For example, drag the State field from Best states for sunglass sales onto the canvas, and see what happens.

看一下!Look at that! Power BI Desktop 识别到“州”字段包含地理位置数据并自动创建了基于地图的可视化效果。Power BI Desktop recognized that the State field contained geolocation data and automatically created a map-based visualization. 可视化效果在数据模型中显示了 40 个州的数据点。The visualization shows data points for the 40 states from your data model.

“可视化效果”窗格显示有关可视化效果的信息,并允许你对其进行修改。The Visualizations pane shows information about the visualization and lets you modify it.

  1. 图标显示创建的可视化效果的类型。The icons show the type of visualization created. 你可以通过选择不同的图标来更改所选可视化效果的类型,或通过选择未选定现有可视化效果的图标来创建新的可视化效果。You can change the type of a selected visualization by selecting a different icon, or create a new visualization by selecting an icon with no existing visualization selected.
  2. 可利用“可视化效果”窗格中的“字段”选项将数据字段拖动到“图例”和窗格中的其他字段 。The Fields option in the Visualization pane lets you drag data fields to Legend and other field wells in the pane.
  3. 可利用“格式”选项将格式设置和其他控件应用到可视化效果。The Format option lets you apply formatting and other controls to visualizations.

“字段”和“格式”区域中的可用选项取决于你拥有的可视化效果和数据类型 。The options available in the Fields and Format areas depend on the type of visualization and data you have.

你希望地图可视化效果仅显示天气最佳的前 10 个州。You want your map visualization to show only the top 10 weather states. 要仅显示前 10 个州,请在“筛选器”窗格中,将鼠标悬停在“州为(所有)”上并展开出现的箭头 。To show only the top 10 states, in the Filters pane, hover over State is (All) and expand the arrow that appears. 在“筛选器类型”下,下拉并选择“前 N 个” 。在“显示项目”下,选择“最后”,因为你希望显示数字级别最低的项目,并在下一个字段中输入“10” 。Under Filter type, drop down and select Top N. Under Show items, select Bottom, because you want to show the items with the lowest numerical ranks, and enter 10 in the next field.

在“字段”窗格中,将“天气”字段拖动到“按值”字段中,然后选择“应用筛选器” 。Drag the Weather field from the Fields pane into the By value field, and then select Apply filter.

现在,地图可视化效果中仅显示天气最佳的前 10 个州。You now see only the top 10 weather states in the map visualization.

通过以下方式可重新设置可视化效果标题:在“可视化效果”窗格中选择“格式”图标,选择“标题”,并在“标题文本”下键入“天气最佳的前 10 个州” 。Retitle your visualization by selecting the Format icon in the Visualization pane, selecting Title, and typing Top 10 weather states under Title text.

要添加显示天气最佳的前 10 个州的名称及其从 1 到 10 的排名,请选择画布的空白区域,然后在“可视化效果”窗格中选择“柱状图”图标 。To add a visualization that shows the names of the top 10 weather states and their ranks from 1 to 10, select a blank area of the canvas and then select the Column chart icon from the Visualization pane. 在“字段”窗格中,选择“州”和“天气” 。In the Fields pane, select State and Weather. 柱状图显示了查询中的 40 个州,从最高到最低的数字级别或者从最糟到最佳天气进行排名。A column chart shows the 40 states in your query, ranked from highest to lowest numerical rank, or worst to best weather.

要切换排序顺序以使数字 1 第一个出现,请在可视化效果的右上角选择“更多选项”省略号,然后在菜单中选择“升序排序” 。To switch the order of the ranking so that number 1 appears first, select the More options ellipsis at the upper right of the visualization, and select Sort ascending from the menu.

要将表限制为前 10 个州,请应用与地图可视化效果相同的后 10 筛选器。To limit the table to the top 10 states, apply the same bottom 10 filter as you did for the map visualization.

以与地图可视化效果相同的方式重新命名可视化效果。Retitle the visualization the same way as for the map visualization. 同样在“可视化效果”窗格的“格式”部分,将“Y 轴” > “轴标题”从“天气”更改为“天气排名”,使其更易于理解 。Also in the Format section of the Visualization pane, change Y axis > Axis title from Weather to Weather ranking to make it more understandable. 然后,将“Y 轴”选择器切换到“关闭”,并将“数据标签”切换到“打开” 。Then, turn the Y axis selector to Off, and turn Data labels to On.

现在,天气最佳的前 10 个州按排名顺序显示,并显示其数字排名。Now, the top 10 weather states appear in ranked order along with their numerical rankings.

你可以为“可购性”和“总体排名”字段提供类似或其他可视化效果,或将多个字段合并为一个可视化效果 。You can make similar or other visualizations for the Affordability and Overall ranking fields, or combine several fields into one visualization. 你可以创建各种相关报表和可视化效果。There are all sorts of interesting reports and visualizations you can create. 这些“表”和“折线和簇状柱形图”可视化效果显示天气最佳的前 10 个州以及其可购性和总体排名 :These Table and Line and clustered column chart visualizations shows the top 10 weather states along with their affordability and overall rankings:

你可以在不同的报表页上显示不同的可视化效果。You can show different visualizations on different report pages. 要添加新页面,请选择页面栏上现有页面旁边的 + 符号,或在功能区的“主页”选项卡中选择“插入” > “新页面” 。To add a new page, select the + symbol next to the existing pages on the pages bar, or select Insert > New Page in the Home tab of the ribbon. 要重命名某个页面,请在页面栏中双击该页面的名称,或右键单击它并选择“重命名页面”,然后键入新名称。To rename a page, double-click the page name in the pages bar, or right-click it and select Rename Page, and then type the new name. 要切换到报表的其他页面,请从页面栏中选择该页面。To go to a different page of the report, select the page from the pages bar.

你可以通过“主页”选项卡的“插入”组将文本框、图像和按钮添加到报表页 。要设置可视化效果的格式设置选项,请选择可视化效果,然后在“可视化效果”窗格中选择“格式”图标 。You can add text boxes, images, and buttons to your report pages from the Insert group of the Home tab. To set formatting options for visualizations, select a visualization and then select the Format icon in the Visualizations pane. 要配置页面大小、背景和其他页面信息,请选择未选定可视化效果的“格式”图标。To configure page sizes, backgrounds, and other page information, select the Format icon with no visualization selected.

创建好页面和可视化效果后,选择“文件” > “保存”,可保存报表 。When you finish creating your pages and visualizations, select File > Save and save your report.

有关报表的详细信息,请参阅 Power BI Desktop 中的报表视图。For more information about reports, see Report View in Power BI Desktop.

共享工作Share your work

现在,你已经有了一个 Power BI Desktop 报表,可以与他人共享。Now that you have a Power BI Desktop report, you can share it with others. 有几种方法可以共享你的工作。There are a few ways to share your work. 你可以像任何其他文件一样分发“.pbix”文件报表,你可以从 Power BI 服务上传“.pbix”文件,也可以直接从 Power BI Desktop 发布到 Power BI 服务 。You can distribute the report .pbix file like any other file, you can upload the .pbix file from the Power BI service, or you can publish directly from Power BI Desktop to the Power BI service. 必须拥有 Power BI 帐户才能将报表发布或上传到 Power BI 服务。You must have a Power BI account to be able to publish or upload reports to Power BI service.

要从 Power BI Desktop 发布到“Power BI”服务,请在功能区的“主页”选项卡中,选择“发布” 。To publish to the Power BI service from Power BI Desktop, from the Home tab of the ribbon, select Publish.

系统可能会提示你登录 Power BI 或选择一个目标。You may be prompted to sign in to Power BI, or to select a destination.

当此发布过程完成时,你将看到以下对话框:When the publish process is complete, you see the following dialog:

在 Power BI 中选择打开报表的链接时,报表将在 Power BI 站点中的“我的工作区” > “报表”下打开 。When you select the link to open the report in Power BI, your report opens in your Power BI site under My workspace > Reports.

另一种共享工作的方式是从 Power BI 服务内加载它。Another way to share your work is to load it from within the Power BI service. 前往 https://app.powerbi.com 可在浏览器中打开 Power BI。Go to https://app.powerbi.com to open Power BI in a browser. 在 Power BI“主页”上,选择左下方的“获取数据”,可开始加载 Power BI Desktop 报表的过程 。On your Power BI Home page, select Get data at lower left to start the process of loading your Power BI Desktop report.

在下一页上,在“文件”部分选择“获取” 。On the next page, select Get from the Files section.

在下一页上,选择“本地文件”。On the next page, select Local File. 浏览到你的 Power BI Desktop“.pbix”文件并选择,然后选择“打开”。Browse to and select your Power BI Desktop .pbix file, and select Open.

导入文件后,可以看到它在 Power BI 服务左窗格中的我的工作区” > “报表”下列出 。After the file imports, you can see it listed under My workspace > Reports in the left pane of the Power BI service.

选择该文件时,将显示报表的第一页。When you select the file, the first page of the report appears. 可以在报表左侧的选项卡中选择不同的页面。You can select different pages from the tabs at the left of the report.

你可以在 Power BI 服务中通过从报表画布顶部选择“更多选项” > “编辑”来更改报表 。You can make changes to a report in the Power BI service by selecting More options > Edit from the top of the report canvas. 要保存更改,请选择“保存副本”。To save your changes, select Save a copy.

你可以在 Power BI 服务中,从你的报表创建各种有趣的视觉对象,并可以将该报表固定到“仪表板”。There are all sorts of interesting visuals you can create from your report in the Power BI service, which you can pin to a dashboard. 要了解 Power BI 服务中的仪表板,请参阅设计出色仪表板的提示。To learn about dashboards in the Power BI service, see Tips for designing a great dashboard. 有关创建、共享和修改仪表板的详细信息,请参阅共享仪表板。For more information about creating, sharing, and modifying dashboards, see Share a dashboard.

要共享报表或仪表板,请在打开的报表或仪表板页面的顶部选择“共享”,或者在“我的工作区” > “报表”或“我的工作区” > “仪表板”列表中,选择报表或仪表板名称旁边的“共享”图标 。To share a report or dashboard, select Share at the top of the open report or dashboard page, or select the Share icon next to the report or dashboard name in the My workspace > Reports or My workspace > Dashboards lists.

完成“共享报表”或“共享仪表板”屏幕中的信息,以发送电子邮件或获取链接,与他人共享报表或仪表板 。Complete the Share report or Share dashboard screen to send an email or get a link to share your report or dashboard with others.

你可以使用 Power BI Desktop 和 Power BI 服务来制作各种与数据相关的惊艳混搭和可视化效果。There are many compelling data-related mash-ups and visualizations you can do with Power BI Desktop and the Power BI service.

后续步骤Next steps

Power BI Desktop 支持连接到诊断端口。Power BI Desktop supports connecting to a diagnostics port. 诊断端口允许连接其他工具并执行跟踪以进行诊断。The diagnostics port allows other tools to connect to and perform traces for diagnostic purposes. 使用诊断端口时,不支持对模型进行任何更改 更改模型可能会导致损坏和数据丢失。When using the diagnostics port, making any changes to the model is not supported. Changes to the model may lead to corruption and data loss.

要详细了解 Power BI Desktop 的多种功能,请查看以下资源:For more information on the many capabilities of Power BI Desktop, check out the following resources:

(0)

相关推荐

  • 《数据可视化基础》:使用颜色的常见陷阱

    以下部分是基于<Fundamentals of Data Visualization>学习笔记,要是有兴趣的话,可以直接看原版书籍:https://serialmentor.com/dat ...

  • 如何打造并复用属于自己的 BI 数据模型?

    文/大脸猫 8年汽车行业数据分析经验,擅长跨行业快速理解业务并搭建模型,利用Power BI,Python等工具实现业务及报表自动化,相比技术更关注如何落实实际业务场景的解决方案. 相信很多人使用Po ...

  • PowerBI技巧:编辑交互

    PowerBI可视化与传统图表的一大区别,就是可视化分析是动态的,通过页面上筛选.钻取.突出显示等交互功能,可以快速进行访问.发现.探索数据背后的规律.但是,不必要的交互会将优异的分析变成无用分析,本 ...

  • 体验Power BI | 分分钟生成一份可视化图表

    微软宣称Power BI只要几分钟就可以将数据转化为精美的图表,要不要尝试一下? 首先我们准备一份数据,Excel格式 数据是从2006年到2015年10年间,中国大陆31个省市的三个产业的GDP,我 ...

  • 三分钟制作报表

    文字版教程 在日常工作当中,我们经常会遇到一些数据处理的需求,大量繁复的数据犹如乱麻般让人毫无头绪,传统的excel软件已经无法满足我们日益膨胀的分析需要, 那么今天我将带大家使用FineReport ...

  • Power BI Desktop的下载、安装

    前段时间有很多朋友说下载Power BI Desktop发现是英文版的,目前这个问题貌似已经改善了,但是,如果要下载32位的,链接还是有点儿问题,故撰此文特以说明.不想看文章而直接下载的,可直接复制以 ...

  • Power BI Desktop 中的 DAX 基本概念

    在 Power BI Desktop 中应用 DAX 的基础知识 2019/10/21 M o 本文适用于刚开始使用 Power BI Desktop 的用户. 为你提供有关如何使用数据分析表达式 ( ...

  • PBI-基础入门:通过一个简单的案例体会Power BI的数据分析过程

    小勤:用个例子给我讲讲Power BI怎么用的呗. 大海:好吧,Power Query你学了那么多,Power Pivot也基本入门了,Power BI也可以同步开始学了,反正PQ和PP的知识除了操作 ...

  • PBI-基础入门:Power BI是什么?

    按照微软的艰涩定义(不喜欢看的可直接略过本段):Power BI 是软件服务.应用和连接器的集合,它们协同工作以将相关数据来源转换为连贯的视觉逼真的交互式见解.无论你的数据是简单的 Excel 电子表 ...

  • PBI-基础入门:Power BI的基本组成

    Power BI主要有3大块产品组成: PowerBI Desktop:即数据分析人员用来做数据处理.构建模型和数据分析的客户端,是数据模型和分析的设计器. PowerBI Service:即经过Po ...

  • PBI-基础入门:使用Power BI的基本过程

    对于不同的用户,可能会用到Power BI的不同部分,比如数据分析人员可能需要使用Power BI Desktop来导入数据.做数据处理并创建报表,然后再发布到Power BI Service上制作仪 ...

  • PBI-基础入门:为什么Power BI(敏捷/自助BI)会这么有用?

    小勤:为什么Power BI这么有用? 大海:其实Power BI属于敏捷BI工具中的一个,敏捷BI也就是自助式BI,即业务人员可以自己就可以用来做数据的整合.整理和分析,并且能出来很好的图表效果,而 ...

  • Power BI入门文章整理:从概念到动手15篇

    回头把此前写过的关于Power BI的文章稍作梳理,挑出其中15篇作为入门系列,供大家查阅,也请多多转发.分享支持.感谢大家一路来的关注!Power  BI入门系列文章及链接Power  BI是什么? ...

  • Power BI for Excel入门教程

    Power BI for Excel入门教程