sql2018 ssas

介绍 (Introduction)

I am a DBA consultant and several times, in the past, I have been asked for a good tool to generate fast reports to get information about the company like total sales, sales per year, month, week, etc

我是一名DBA顾问,过去曾多次要求我提供一个很好的工具来生成快速报告,以获取有关公司的信息,例如总销售额,每年,每月,每周的销售额等。

SSAS is a Business Intelligence (BI) technology that Microsoft bought from Panorama Software in 1996. After the acquisition, the technology was upgraded and evolved and now it is part of the tools that come with SQL Server. This tool is an extremely powerful tool to create analytical reports fast. It works with cubes that are designed to generate reports with optimal performance using aggregated information stored in the cube.

SSAS是Microsoft于1996年从Panorama Software手中购买的一种商业智能(BI)技术。收购后,该技术得到了升级和发展,现在已成为SQL Server随附工具的一部分。 该工具是一种非常强大的工具,可以快速创建分析报告。 它与多维数据集一起使用,这些多维数据集旨在使用存储在多维数据集中的聚合信息来生成具有最佳性能的报告。

SSAS generally does consume a lot of space because it contains a lot of information ready to be used.

SSAS通常确实会占用很多空间,因为它包含了很多可供使用的信息。

In this article, we will learn how to create your first cube from scratch. If you do not know anything about SSAS, this will be a great opportunity to learn.

在本文中,我们将学习如何从头开始创建第一个多维数据集。 如果您对SSAS一无所知,这将是一个很好的学习机会。

要求 (Requirements)

  1. SSAS multidimensional database installed 已安装SSAS多维数据库
  2. SSDT 固态硬盘
  3. SQL Server 2016 Installed 已安装SQL Server 2016
  4. AdventureworksDW database AdventureworksDW数据库
  5. SSMS 2017 installed 已安装SSMS 2017

入门 (Getting started)

A cube in SSAS requires a data warehouse. The data warehouse is a special database designed to store enterprise information from different sources like Excel, ERPs, CRMs, flat files, legacy data and more.

SSAS中的多维数据集需要数据仓库。 数据仓库是一个特殊的数据库,旨在存储来自不同来源(如Excel,ERP,CRM,平面文件,旧数据等)的企业信息。

If you want to have an SSAS cube, creating the data warehouse is a process that takes a bit of time and resources. You can use SSIS to extract the information from sources to the data warehouse or use other ETL (Extract Transformation and load) tools like Talend Open Studio, SpagoBI Business Intelligence, Jaspersoft ETL and several other external tools.

如果要使用SSAS多维数据集,则创建数据仓库是一个过程,需要一些时间和资源。 您可以使用SSIS从源中提取信息到数据仓库,也可以使用其他ETL(提取转换和加载)工具,例如Talend Open Studio,SpagoBI Business Intelligence,Jaspersoft ETL和其他一些外部工具。

In this article, we will use the AdventureworksDW sample ready to be used. However, in the real-life, you will need to create some ETLs to automatically extract your business information to the Data Warehouse.

在本文中,我们将使用准备使用的AdventureworksDW示例。 但是,在现实生活中,您将需要创建一些ETL以自动将您的业务信息提取到数据仓库中。

We will create a cube based on the fact table FactResellerSales:

我们将基于事实表FactResellerSales创建一个多维数据集:

FactResellerSales shows information about resellers’ sales like discount amounts, tax amounts, freight, sales amount and other related information.

FactResellerSales显示有关经销商销售的信息,例如折扣金额,税额,运费,销售金额和其他相关信息。

We will create reports about the fact information combined with 2 dimensions:

我们将创建有关事实信息的报告,并结合以下两个维度:

  • currency 货币
  • sales territory 销售地区

The Currency dimension, will help us to detect amounts in different currencies around the world and Sales territory will help to detect sales, discounts, etc. per region.

货币维度 ,将帮助我们检测世界各地不同货币的金额,而销售地区将有助于检测每个地区的销售,折扣等。

In order to start get started in SQL Server Data Tools aka SSDT, open a new project and select Analysis Services Multidimensional and Data Mining models:

为了开始使用SQL Server数据工具(也称为SSDT)入门,请打开一个新项目,然后选择Analysis Services多维和数据挖掘模型:

In the Solution Explorer, right-click Data Sources and select New Data Source:

在解决方案资源管理器中,右键单击“数据源”,然后选择“新建数据源”:

You will receive a Welcome wizard, press next:

您将收到一个欢迎向导,请按下一步:

Select the option to create a new Data Source based on existing or new connection and press the new button:

选择选项以基于现有或新连接创建新的数据源,然后按新按钮:

In the Provider, select a Native OLEDB\SQL Server Native Client 11.0. For Server name, select the SQL Server with the AdventureworksDW database:

提供程序中 ,选择本机OLEDB \ SQL Server本机客户端11.0。 对于“ 服务器名称” ,选择带有AdventureworksDW数据库SQL Server:

Select the data connection, just created, and press next:

选择刚刚创建的数据连接,然后按下一步:

In Impersonation information specify a user with access to the AdventureworksDW database:

模拟信息中,指定有权访问AdventureworksDW数据库的用户:

In the Completing the wizard, press finish:

在“完成”向导中,按“完成”:

We created the credentials to connect to the AdventureworksDW database. We will create now the views. In this process, we will select the tables to be included in the cube.

我们创建了凭据以连接到AdventureworksDW数据库。 我们现在将创建视图。 在此过程中,我们将选择要包含在多维数据集中的表。

In solution explorer, select New Data Source View:

在解决方案资源管理器中,选择“新建数据源视图”:

Select the data source just created:

选择刚创建的数据源:

Select the table FactResellerSales:

选择表FactResellerSales:

Include the dimensions DimSalesTerritory and DimCurrency. These dimensions include information about sales regions and currencies:

包括维度DimSalesTerritory和DimCurrency。 这些维度包括有关销售地区和货币的信息:

Once the wizard is completed, press finish:

向导完成后,按完成:

As you can see, the fact table and the dimensions have a relationship. If the common columns are equal, the relationships are detected automatically:

如您所见,事实表和维度具有关系。 如果公共列相等,则将自动检测到这些关系:

To create a cube, we will add dimensions to the cube.

要创建一个多维数据集,我们将向多维数据集添加尺寸。

In the Solution Explorer, right click and select New Dimension:

在解决方案资源管理器中,右键单击并选择“新建维度”:

You can create a dimension based on templates, time tables or based on existing tables. Select the option Use an existing table:

您可以基于模板,时间表或现有表创建维度。 选择选项使用现有表

Select DimCurrency as the main table. By default, the key column is currency key:

选择DimCurrency作为主表。 默认情况下,键列为货币键:

In available attributes, select currency name:

在可用属性中,选择货币名称:

In the Completing the Wizard step, press finish:

在“ 完成向导”步骤中,按完成:

Now, you will have a dimension created like this one.

现在,您将创建一个像这样的尺寸。

Drag and drop the Currency Name from the attributes pane to Hierarchy:

货币名称从属性窗格拖放到层次结构:

Once that you have the first dimension created, Currency name, we will create the sales territory dimension. In solution explorer, right click Dimensions and select New dimension:

创建第一个维度( 货币名称)后 ,我们将创建销售地区维度。 在解决方案资源管理器中,右键单击尺寸,然后选择新尺寸:

Select the option use an existing table:

选择使用现有表的选项:

Select the table dimsalesterritory:

选择表dimsalesterritory:

Select the attributes that you want to be browsable in the reports:

选择要在报告中浏览的属性:

Once that the wizard is completed, press finish:

向导完成后,按完成:

In the new dimension created, click the process icon to process the dimension. The process will generate the structure and load data to the dimension from the SQL Server table:

在创建的新维度中,单击“处理”图标以处理该维度。 该过程将生成结构并将数据从SQL Server表加载到维度:

Press run to process the dimension:

按下运行以处理尺寸:

In the Process Progress, close the process once that the process is succeed:

在过程进度中,一旦过程成功,则关闭该过程:

You can refresh the dimension to view the dimension just processed:

您可以刷新维度以查看刚刚处理的维度:

Process the Dim currency dimension also:

还要处理点心货币维度:

Once processed, you can verify in the Browser tab:

处理后,您可以在“浏览器”标签中进行验证:

We will now create the cube. In the Solution Explorer, right click Cubes and select New Cube:

现在,我们将创建多维数据集。 在解决方案资源管理器中,右键单击“ 多维数据集”,然后选择“ 新建多维数据集”:

In Select Measure Groups Tables select FactResellerSales table. Measure group tables are used to include the table with data to measure. A measure can be the number of sales, amount sold, freight, etc.:

在“ 选择度量值组表”中,选择“ FactResellerSales表”。 度量值组表用于将表包含要度量的数据。 度量可以是销售数量,销售数量,运费等:

Select the data to measure. We will uncheck the keys and check the other attributes to measure:

选择要测量的数据。 我们将取消选中键并检查其他要测量的属性:

Select the dimensions that you want to add to the cube:

选择要添加到多维数据集的尺寸:

You can also add the fact table as a dimension (degenerate dimension). In this example, we will not add it:

您还可以将事实表添加为维(退化维)。 在此示例中,我们将不添加它:

Once that the cube is created, press finish:

创建多维数据集后,按完成:

You will have the cube created with the fact table (in yellow) and the dimensions (in blue). Press the process icon to process the cube:

您将使用事实表(黄色)和维度(蓝色)创建多维数据集。 按过程图标以处理多维数据集:

In Process Cube, press run to process the cube:

在“ 处理多维数据集”中,按运行以处理多维数据集:

Once processed, go to the browser:

处理后,转到浏览器:

Press the refresh icon:

按刷新图标:

Drag and drop some measures from the Measure Group to the design pane:

将一些度量从“度量值组”拖放到设计窗格中:

Now drag and drop the currency name to the graph pane, you will be able to see the measures grouped by currency:

现在,将货币名称拖放到图形窗格中,您将可以看到按货币分组的度量:

Drag and drop the Sales Territory Country. You will now be able to see the measures grouped by currency and territory:

拖放销售地区国家/地区。 现在,您将可以看到按货币和地区分组的度量:

结论 (Conclusion)

In this article, we learned how to create a cube in SSAS. We first need to create a data source to connect to our database. In this example, we connected to a data warehouse already created. For our example, we used AdventureworksDW, which is a sample database created for learning purposes.

在本文中,我们学习了如何在SSAS中创建多维数据集。 我们首先需要创建一个数据源以连接到我们的数据库。 在此示例中,我们连接到已经创建的数据仓库。 对于我们的示例,我们使用了AdventureworksDW,这是一个为学习目的而创建的示例数据库。

The next step was to add the fact table and 2 dimensions as data source views. SSAS detected the primary keys and relationships by default.

下一步是添加事实表和2维作为数据源视图。 默认情况下,SSAS检测到主键和关系。

After that, we added 2 dimensions based on 2 data source views. The currency and sales territory dimensions.

之后,我们基于2个数据源视图添加了2个维度。 货币和销售地区维度。

Finally, we created a cube based on the table factresellersales. We selected some columns as measures and we added the dimensions created. With the process buttons, we loaded data to the cubes. The cube as you can see is a simple way to generate multiple reports. You can create multiple reports without SQL knowledge or other reporting tools. With SSAS you can easily generate thousands of reports to accomplish your company needs.

最后,我们根据表factresellersales创建了一个多维数据集。 我们选择了一些列作为度量,并添加了创建的维。 使用处理按钮,我们将数据加载到了多维数据集。 如您所见,多维数据集是生成多个报告的一种简单方法。 您可以在不具备SQL知识或其他报告工具的情况下创建多个报告。 借助SSAS,您可以轻松生成数千份报告来满足您的公司需求。

参考资料 (References)

For more information about SSAS refer to these links:

有关SSAS的更多信息,请参考以下链接:

  • What is Analysis Services? 什么是分析服务?
  • Analysis Services Tutorials (SSAS) 分析服务教程(SSAS)
  • Analysis Services (SSAS) Cubes – Dimension Attributes and Hierarchies Analysis Services(SSAS)多维数据集–维度属性和层次结构
  • SSAS Multidimensional or SSAS Tabular SSAS多维或SSAS表格

翻译自: https://www.sqlshack.com/build-cube-scratch-using-sql-server-analysis-services-ssas/

sql2018 ssas

sql2018 ssas_如何使用SQL Server Analysis Services(SSAS)从头开始构建多维数据集相关推荐

  1. 使用SQL Server Analysis Services数据挖掘的关联规则实现商品推荐功能(五)

    假如你有一个购物类的网站,那么你如何给你的客户来推荐产品呢?这个功能在很多电商类网站都有,那么,通过SQL Server Analysis Services的数据挖掘功能,你也可以轻松的来构建类似的功 ...

  2. 使用SQL Server Analysis Services数据挖掘的关联规则实现商品推荐功能(七)

    假如你有一个购物类的网站,那么你如何给你的客户来推荐产品呢?这个功能在很多电商类网站都有,那么,通过SQL Server Analysis Services的数据挖掘功能,你也可以轻松的来构建类似的功 ...

  3. 【MDX】一文带你搞懂SQL Server Analysis Services 的安装和使用

    目录 Step 1: Install developer and management tools 安装 new stand-alone SQL Server installation or add ...

  4. SQL Server商业智能功能–创建简单的OLAP多维数据集

    介绍 (Introduction) 多维多维数据集和事务数据库是两个非常不同的事物. 从经验中,我什至是经验丰富的DBA都完全避免使用多维数据集这一主题,因为对于他们而言,多维数据集实在是一个未知领域 ...

  5. 使用SQL Server Analysis Services Tabular Model建立分析模型

    微软在最新版本的SQL Server中加入了Tabular Model,目的在于降低数据分析的门槛,使各个业务部门的人员通过简单的IT培训,制作出符合自己需要的分析模型. 由于其降低了操作门槛,所以各 ...

  6. 关于 SQL Server Analysis Services

    参考微软官方文档: https://docs.microsoft.com/zh-cn/sql/analysis-services/analysis-services?view=sql-server-2 ...

  7. SQL Server Intergration Services(SSIS)

    ** 一. 软件下载与安装 注:软件安装一般在安装SQL Server Management Studio(SSMS)之后安装 1.软件下载 百度网盘地址:https://pan.baidu.com/ ...

  8. 转: SQL Server Analysis Service中Cube的结构

    SSAS中Cube的结构 在SSAS(SQL Server Analysis Services)中构建Cube和编写MDX的时候,我们很容易被一些名词弄糊涂,比如:Dimension(维度),Meas ...

  9. aws rds监控慢sql_在AWS RDS SQL Server上的SSAS中部署表格数据库

    aws rds监控慢sql In this article, we are going to explore Analysis Service for AWS RDS SQL Server in de ...

最新文章

  1. 提供《华容道与数据结构》代码供测试
  2. easyui js拼接html,class属性失效的问题
  3. javascript写入xml_Javascript学习笔记(1)
  4. vue项目获取下拉框选中id_vue treeselect获取当前选中项的label实例
  5. 2019_7_31python
  6. 塔菲克蓝牙适配器驱动_小身材,大功能,biaze毕亚兹USB蓝牙适配器开箱体验
  7. 如何利用 JConsole观察分析Java程序的运行,进行排错调优(转)
  8. Java网络编程之Socket和ServerSocket详解
  9. Linux基本命令(二)
  10. BZOJ 1041 数学
  11. [转载] java中抽象类的定义和使用
  12. Vue使用Axios实现http请求以及解决跨域问题
  13. 互联网网站的反爬虫策略浅析
  14. 使用OpenRefine清洗数据实例
  15. Android 手机做麦克风扩音器demo
  16. 【python中级】 获取系统的局域网ip地址
  17. java fastjson 格式化_json的格式化展示(基于 fastjson)
  18. Glide加载图片会出现淡绿色的背景
  19. PHP易联云打印机实现打印小票
  20. 计算机换内存条解决方案

热门文章

  1. 10分钟python游戏_牛得一批!10分钟用Python编写一个贪吃蛇小游戏
  2. 浅谈电子数字取证技术
  3. 【LeetCode 剑指offer刷题】树题4:104 Maximum Depth of Binary Tree
  4. 虚拟世界来自现实世界,同时又促进现实世界
  5. JS获取JSON对象数组某个属性最大值
  6. svn提交代码失败提示清理(清理失败并且报错信息乱码解决办法)
  7. py thon 多线程(转一篇好文章)
  8. MySQL-数据操作-增删改查
  9. [bzoj3531][Sdoi2014]旅行
  10. git进阶(撤销pull、撤销merge、撤销add)