当前位置:网站首页>PowerBI scripture series
PowerBI scripture series
2022-08-04 22:03:00 【m0_67595943】
Learning required code
public void string main(String agrs[]){
//获取课程vx 80407290
}
图0.6 “编辑关系”Dialog allows to modify the filter across the table
缺省情况下,Across the screen direction as“单向”(一对多).如果需要,You can change it to a two-way,In order to filter also spread to the side from multiple directions.图0.7Shows the filter is set to the two-way,它是如何传播的:
图0.7 在双向模式下,Filter the bidirectional transmission.
如果需要在Power Pivot的ExcelActivate the bi-directional filtration,你必须使用 CROSSFILTER Function activate it,如下例所示,适用于图0.8所示的模型:
Num of Customers =
CALCULATE (
COUNTROWS ( Customer ) ,
CROSSFILTER ( Sales[CustomerKey], Customer[CustomerKey], BOTH )
)
图0.8 The two relations have been set to the default mode,Unidirectional mode.
CROSSFILTER Function allows the calculation during the execution of the statement two-way selection.在对 COUNTROWS ( Customer ) 进行评估时,The filter will be fromSales移动到Customer,只显示SalesReferenced in the client.例如,When you need to calculate the number of customers buy the product,This technology is very convenient.事实上,The filter naturally shift from products to sell.Then you need to use the two-way selection,Make it through the sales flow to customer.举例来说,There are two kinds of calculation methods is shown in figure0.9所示.An activation two-way selection,Another use the default spread screening.
图0.9 Only in the two methods differ across the table filter direction,结果完全不同
从结果上看,The first measure is clearly not correct.These two measures are defined as follows:
CustomerCount := COUNTROWS ( Customer )
CustomerFiltered :=
CALCULATE (
COUNTROWS ( Customer ) ,
CROSSFILTER ( Customer[CustomerKey], Sales[CustomerKey] , BOTH )
)
可以看到 CustomerCount Using the default screen.因此,Product 筛选 Sales ,但 Sales 不筛选Customer.In the second kind of measure,筛选器从 Product 流向 Sales ,然后到达 Customer,So formula calculation only buy filter products, one of the customers.
一、表格
Table is to save the information of the container,分为行和列.Each row contains information about a single entity,And each cell contains a database of each row has said that the minimum pieces of information.例如,The customer table contains all the customer's information.A line contains all the information about a customer,The name or address of a column may contain all customers.A cell can contain the address of a customer.
在构建模型时,To avoid some problems.例如,如图0.1,At the same table of two lines of stored information about an order.在一行中,Store the order amount and the date of order.In another line,The amount of storage was delivered,Also contains the delivery date.Do an entity will be divided into the same table of two lines,Thus not conducive to match.
图0.1 Collect all the data to a table
应该这样做:如图0.2,Set up two separate table,A place orders、Data delivery another place.
图0.2 分开两张表
二、数据类型
设计模型时,每个列都有一个数据类型.Data types are listed in the type of content.数据类型可以是整数、字符串、货币、浮点数等等.There are many data types to choose from.Column data type is very important,Because it will affect the availability、Can be used on columns of function and formatting options.
Shipment in contains the number of columns in the,The integer is a good data type.In the column of the sales need to store,Money is the correct data type.使用纯Excel时,Each cell can contain any data type of value.但是,When using table data model,Data types are defined at the column level.This means that all rows in a table need data stored in the column of the same type.Cannot be used to form a column in the compound data types.
三、关系
When the model contains more than one entity,通常情况下,The information stored in multiple tables,And through the relationship between link them up.In the table column model,Relationships always link two tables,It is based on a single column.如图0.3,Said one of the most common form is an arrow,It starts from the source table,Point to the target table.
表0.3 表之间的关系
When defining a relationship,There is always a unidirectional and multidirectional.In the example model,For each product,There are many sales,And for every sales,Only one product.因此,The product table on one side,But on the sales table in many side.Arrow always points to a side from multiple directions.
在不同版本的Excel Power Pivot和Power BI中,The user interface using different relations visualization.在Excel和Power BI的最新版本中,Will draw a line,At the tail with 1 或 * 标记,To identify relationship between one or more parties.在Power BI Desktop中,You can also choose to create a one-to-one relationship.One-to-one relationship is always a two-way,Because each line for a table,In another table can have only0或1行.因此,在这个特殊的情况下,Relationship between no multidirectional.
@ 3. Contains the bridge table model
Bridge table usually lies between two dimensions,In order to create a many-to-many relationship between dimensions.例如,图0.13Shows a customer may belong to multiple categories.Marco Category belongs to men and Italy,而 Kate Category belongs only to women.如果有这样的场景,Starting from the bridge and connection design two relations,分别是 Customer 和 Category.
图0.13 Bridge table allows a single customer belong to different categories
When the model contains the bridge table,采用BIHas never been named the new shape.如图0.14,Add a client's ability to the multiple customer categories:
图0.14 Bridge table to connect two dimensions,Different from general snowflake schema
Conventional snowflake schema and the use of bridge table model between the difference between,Relationship between customer category and sales is not a direct relationship between the two dimensions.事实上,Customer's relationship with bridge is the opposite of the.If it is from the customer to the bridge,So it will be a snowflake schema.It became a many-to-many relationship.
六、Measurement and additivity
When the definition,An important concept is whether the metrics for a particular dimension has the additivity.
@ 1. 可加性度量.When a measurement with a simple and to aggregate,It is known as the additive of.例如,Sales for product's additive,This means that the total sales from a single product sales sum.另一个例子是,Sales of all dimensions are additive,Because the total sales of a year is produced by each day of the sale sum.
@ 2. The additivity measure.If the products sold to different count,So a year of different counts is not the sum of different count every month.The same applies to the customer、Country and any other aspect.When you need to calculate the nonadditive measure,Must apply to each level are viewing the hierarchical structure of the executive table full scan,Because we can not from their child aggregate values.
@ 3. Half additivity measure.Half additivity is one of the most complex measure,Because they are of certain dimensions is additive,For other dimensions is an additive.通常,As the dimension of the anomaly is time.例如,Year-to-Date,Calculations are additive,Because according to the sum of the value is not a single day for a month.
图0.15Show the additivity、非可加性、Half additivity contrast:
图0.15 Three kinds of additivity is
DAXProvides a set of functions to deal with change over time and a half additive.When time is additive dimensions,像DATESYTD, TOTALYTD And so on can write half additive measure.Handle different dimensions of half additivity need more complex screening function,Because there are no predefined functions to handle has nothing to do with the time dimension of additive.
四、Selection and cross table selection
When the pivot table or usePower BIBrowsing the model,Screening is very important.事实上,It is the basis of the report, most computing.使用DAX语言时,规则非常简单:The filter is always from the relationship of a move to more parties.如图0.4,在用户界面中,This represented by an arrow in the middle of the relationship between,The arrow shows how the filter through relationship.
图0.4 Relations within the line of small arrows represent the direction of the filter
When screeningDate的时候,Also the screenSales.This is why in the pivot table,Can be easily divided by sales:DateThe filter directly intoSales筛选器.相反的方向,By default, is doesn't work.SalesThe filter will not spread to theDate.图0.5Shows the default filter is how to spread the graphical representation of.
图0.5 Large arrows indicate how to spread in open unidirectional screening filter
The relationship can be changed by setting to change the direction of transmission of the filter,Called across the table filter.例如,在Power BI中,This is achieved by double-clicking the relationship itself.如图0.6,打开“编辑关系”对话框:
五、不同类型的模型
在典型的模型中,There are many through relationship link table.According to these tables usage,It can be classified:
% 1. 事实表.The fact table contains to aggregate value.The fact table is normally stored at a certain time point of、可以度量的事件.The fact table is usually the biggest table model,Contain tens or even hundreds of millions of line.The fact table usually only store the number,The dimension of key or to aggregate value.(Is simply the most primitive data source.)
% 2. 维度表.With the dimension to slit the fact table is very useful,The typical dimensions including product、客户、时间和类别.Dimension tables are usually contains hundreds or thousands of lines of small table,Often there are a lot of string properties,Main purpose is to slice value.
% 3. 桥接表.Bridge table in a more complex model is used to represent many-to-many relationship.例如,A customer may belong to multiple categories can be used to bridge table modeling,The bridge connect table contains customer of each category of a row.
@ 1. 星型模式
When checking model chart,If it is only based on the fact table and dimension build,You can put the fact table in the center,Is surrounded by all of the dimensions.如图0.10,This arrangement is known as the star schema.
图0.10 Will the fact table in the middle,And put it around all dimensions in the middle,There will be the star schema
The star schema has a lot of great features,它们快速、Easy to understand and manage.Most star schema is the basis of analyzing the database,However, sometimes need to build the model in different ways.
@ 2. 雪花模式
Sometimes a dimension is a link to another dimension to further classify the.例如,Products may have a category,Need to these categories are stored in a separate table.再比如,Storage can be according to the division of business units,Can also decided to business unit stored in a separate table.例如,图0.11The products shown in,No category name as column,而是存储了一个 Category 键,The key is that Category 表.
图0.11 Categories in the table stored in its own,Products refer to the table
If you use this mode,Product categories and business units are still dimensions,But they are not directly related to the fact table,But by the middle dimensions related to.例如,Sales表包含ProductKey列,But to get the category name,必须从Sales到达Product,然后从Product到达category.如图0.12,This case is called snowflake schema.
图0.12 Snow pattern on the basis of the star schema,With extra dimensions from the original dimension
There has been no contact between the dimension itself.例如,Categories and the relationship between the sales can be regarded as direct relationship,但它是通过StorePass the.Can direct link shops and location.事实上,在这种情况下,Model will become blur,Because from sales to the geographical position exist multiple paths.
Snowflake schema in商业智能(BI)In the field of some common.In addition to the performance slightly down,还是一个不错的选择.尽管如此,It is best to avoid a snowflake schema,And insist to use more standard star schema,因为DAXCode is often easier to develop,更不容易出错.
边栏推荐
- 【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
- [Linear Algebra 02] 2 interpretations of AX=b and 5 perspectives of matrix multiplication
- 【组成原理 六 存储器类型】
- 未知点云结构文件转换需求
- AI/ML无线通信
- Go----Go 语言基础之标识符、关键字、命名规范、变量、常量
- Develop your own text recognition application with Tesseract
- docker 搭建mysql 主从复制
- The upgrade and transformation plan of the fortress machine for medium and large commercial banks!Must see!
- Lecture 2 Software Life Cycle
猜你喜欢
打卡第 1 天:正则表达式学习总结
rk3399 驱动屏参的几种方式
Is the International Project Manager PMP certificate worth taking?
【线性代数03】消元法展示以及AX=b的4种解情况
开发deepstram的自定义插件,使用gst-dseaxmple插件进行扩充,实现deepstream图像输出前的预处理,实现图像自定义绘制图(精四)
硬件开发定制全流程解析
LeetCode 199: 二叉树的右视图
力扣24-两两交换链表中的节点——链表
搬走地下空间开发利用“绊脚石” 中地数码取得地下空间透明化技术突破
【社媒营销】WhatsApp Business API:您需要知道的一切
随机推荐
硬件开发定制全流程解析
milvus配置相关
Go----Go 语言基础之标识符、关键字、命名规范、变量、常量
【SQL之降龙十八掌】01——亢龙有悔:入门10题
2022精选最新金融银行面试真题——附带答案
puzzle(022.1)黑白迭代
Autowired自动装配
快速web开发框架——learun framework
[Linear Algebra 03] Elimination method display and 4 solutions of AX=b
rk3399 驱动屏参的几种方式
立方度量(Cubic Metric)
QT 子窗口—>主窗口 信号和槽的交互
docker 部署redis集群
numpy关于两个array叠加操作
Domestic PMP certificate of gold content how
信创是什么意思?涉及哪些行业?为什么要发展信创?
MQTT[一]基础知识介绍
七夕特制:《牛郎会织女》
OC-拷贝
How to solve the problem that the alarm information cannot be transmitted after EasyGBS is connected to the latest version of Hikvision camera?