简体   繁体   English

SSAS计算的度量值,不包括空值

[英]SSAS calculated measure excluding nulls

I have a fact-table like so: 我有一个事实表,如下所示:

Account# | 帐号#| Age 年龄

============= =============

1|10 1 | 10

2|20 2 | 20

3|NULL 3 | NULL

I want to construct a calculated measure that gives me the average age when slicing through my datamodel. 我想构造一个计算尺度,以便在切片数据模型时给我平均年龄。 When using: '[measure].Age/CountOfAccount#' I dont get the right average. 使用时:'[measure] .Age / CountOfAccount#'我没有得到正确的平均值。 It seems as if the NULL values of Age are seen as zero's and also get used in the calculation. 似乎Age的NULL值被视为零,并且也可以在计算中使用。 So in the above example ssas in my case does (10+20+0)/3 = 6.67 and this is wrong! 所以在上面的示例中,ssas在我的情况下是(10 + 20 + 0)/ 3 = 6.67,这是错误的! In reality the average is: (10+20)/2 = 15 实际上,平均值为:(10 + 20)/ 2 = 15

Could someone please help me out on how to construct the right SSAS calculated measure? 有人可以帮我解决如何构建正确的SSAS计算量度吗?

Thank you from Holland ! 谢谢荷兰人!

You can change the presentation values NULL as by selecting each measure that you would like to retain the original NULL value. 您可以通过选择要保留原始NULL值的每个度量来更改表示值NULL。 Go to the properties menu (F4) and expand the Source property. 转到属性菜单(F4)并展开Source属性。 From there you want to change the NULLProcessing to Preserve. 从那里您想将NULLProcessing更改为Preserve。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM