微软SSAS产品团队近日在其博客上正式发布了关于SQL Server vNext CTP1.1版(社区技术预览版)的消息,vNext是SQL Server 2016的下一个版本,Power BI本地部署功能极有可能在这个版本上实现。
借助PowerQuery强大的数据获取能力,用户可以在SSDT中连接更多的数据源,使用与Power BI Desktop和Excel中相同的处理方式将数据导入表格模型,统一了不同工具之间的数据获取、数据混合、数据转换操作的体验。
微软将此次更新称之为:
Introducing a Modern Get Data Experience for SQL Server vNext
为SQL Server vNext引入现代化的数据获取能力。
配置界面,这一特性仅支持最新的1400表格模型(稍后详细介绍这一型号)

数据获取界面,从这里开始就到了Excel和Power BI用户熟悉的操作界面,只不过作为SSDT上的第一版,数据获取能力有所限制,只能连接很少的数据库,后续会逐步增加。

操作台界面,可以看到Visual Studio提供的界面功能相比Excel和PBI的PQ界面少之又少,产品团队承诺会在接下来的CTP版本中完善。
高级编辑器界面,这一版对M语法错误的兼容性不高,运行包含错误的语句会导致没有响应,产品团队建议先在Excel或Power BI Desktop的环境下调试成功后再导入SSDT。

使用M语言进行表分区,这是Excel和Power BI不具备的强大特性。

作为第一个支持M语言的版本,CTP1.1在使用中还有很多限制和需要注意的问题,具体内容可以参考链接:
表格模型从2012推出至今,经历过几个大的版本:

1. 支持度量和表格(Measures and Tables)的详细级别行表达式,通过SELECTCOLUMNS函数实现,这是在1200版本中新加入的函数。

1.1 示例语句
SELECTCOLUMNS(
'Internet Sales',
"Customer First Name", RELATED(Customer[Last Name]),
"Customer Last Name", RELATED(Customer[First Name]),
"Order Date", 'Internet Sales'[Order Date],
"Internet Total Sales", [Internet Total Sales]
)
值得注意的是selectcolumns函数只能创建行上下文,需要借助Related进行上下文转换.
1.2 实现效果,与MDX解法相同

2. 不规则层级(Ragged Hierarchies)
DAX已经具备处理父子层级的能力,本次更新增加了对不规则层级的支持,所谓不规则层级,指层级内部子成员数量分布不均的情况,例如按行政区划建立层级,直辖市在省份级别没有成员,属于不规则层级。
下图也展示了一种典型情景,在不规则层级下,成员为空的层级不能隐藏

2.1 在CTP1.1中,支持隐藏空成员

可以预见,未来Excel PowerPiovt也将获得此特性。
3. 表级别安全性
在行级别安全性的基础上,引入了表级别安全性,除了限制获取表格本身的数据外,表级别安全性也支持对表名的保护,防止恶意用户探测某些表的存在性。
目前编写表安全性的语言支持JSON、表格模型脚本语言TMSL、表格对象模型TOM,以下是JSON示例:
"roles": [
{
"name": "Users",
"description": "All allowed users to query the model",
"modelPermission": "read",
"tablePermissions": [
{
"name": "Product",
"metadataPermission": "none"
}
]
}
4. DAX语法增强
增加 IN 运算符,相当于一个可以匹配多个值的条件表达式,与SQL用法类似。简化了DAX的语法。(之前做过介绍,可参考 公众号文章:Power BI支持 IN 和 NOT IN 运算符)
传统的匹配多条件的表达式写法:
Filtered Sales:=CALCULATE(
[Internet Total Sales],
'Product'[Color] = "Red"
|| 'Product'[Color] = "Blue"
|| 'Product'[Color] = "Black"
)新写法:
Filtered Sales:=CALCULATE(
[Internet Total Sales], 'Product'[Color] IN { "Red", "Blue", "Black" }
)新写法的等价函数:
Filtered Sales:=CALCULATE(
[Internet Total Sales], CONTAINSROW({ "Red", "Blue", "Black" }, 'Product'[Color])
)复杂条件:
Filtered Sales:=CALCULATE(
[Internet Total Sales],
FILTER( SUMMARIZE( ALL(Product), Product[Color], Product[Product Category name] ),
( 'Product'[Color] = "Red" && Product[Product Category Name] = "Accessories" )
|| ( 'Product'[Color] = "Blue" && Product[Product Category Name] = "Bikes" )
|| ( 'Product'[Color] = "Black" && Product[Product Category Name] = "Clothing" )
)
)简化之后:
Filtered Sales:=CALCULATE(
[Internet Total Sales],
FILTER( SUMMARIZE( ALL(Product), Product[Color], Product[Product Category name] ),
('Product'[Color], Product[Product Category Name]) IN
{ ( "Red", "Accessories" ), ( "Blue", "Bikes" ), ( "Black", "Clothing" ) }
)
)行/表构造器的使用,传统写法:
EVALUATE
UNION(
ROW(
"Value1", "Red Product Sales",
"Value2", CALCULATE([Internet Total Sales], 'Product'[Color] = "Red")
),
ROW(
"Value1", "Blue Product Sales",
"Value2", CALCULATE([Internet Total Sales], 'Product'[Color] = "Blue")
),
ROW(
"Value1", "Total",
"Value2", CALCULATE([Internet Total Sales], 'Product'[Color] IN { "Red", "Blue" })
)
)简化写法:
EVALUATE
{
("Red Product Sales", CALCULATE([Internet Total Sales], 'Product'[Color] = "Red")),
("Blue Product Sales", CALCULATE([Internet Total Sales], 'Product'[Color] = "Blue")),
("Total", CALCULATE([Internet Total Sales], 'Product'[Color] IN { "Red", "Blue" }))
}参考文章:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31537575/viewspace-3142974/ ,如需转载,请注明出处,否则将追究法律责任。