简体   繁体   English

如何在事实表中添加非聚合列?

[英]How to add an non aggregated column in a fact table?

I'm working on a SSAS cube to allow user to analyze some sales. 我正在研究SSAS多维数据集,以允许用户分析一些销售。 So, I created a fact table to record all sales and few dimensions to browse inside data (category / location & store, etc...). 因此,我创建了一个事实表来记录所有销售额,并浏览一些维度以浏览内部数据(类别/位置和商店等)。

This is a example of the fact table output (from SQL Server Management Studio) : 这是事实表输出的示例(来自SQL Server Management Studio):

在此处输入图片说明

When I browse my cube, I can review all sales including date, quantity, etc. However, when I add some fields like the "unit price" or the "unit cost", it returns me a strange result probably due to an aggregate behavior. 当我浏览我的多维数据集时,我可以查看所有销售,包括日期,数量等。但是,当我添加诸如“单价”或“单价”之类的某些字段时,由于综合行为,它返回的结果很奇怪。 It seems it return the sum of all matching rows (aggregateFunction property). 似乎它返回所有匹配行的总和(aggregateFunction属性)。

How to simply display the unit price of a sale without apply any calculation to the unit price column. 如何简单地显示销售单价,而不对单价列进行任何计算。 The None value for the AttributeFunction display BLANK/NULL. AttributeFunction的None值显示BLANK / NULL。

If your unitCost and unitPrice are the same for each product (I mean unitCost can be only 77.6 for product_id = 2), you can just use average (or even emulate average by SUM/COUNT) - but only for product dimension on axis! 如果每种产品的unitCost和unitPrice都相同(我的意思是product_id = 2的unitCost只能是77.6),则可以只使用平均值(甚至可以通过SUM / COUNT模拟平均值),但只能用于轴上的产品尺寸! Another dimensions will show real average values. 其他尺寸将显示实际平均值。

Maybe it's better to use this 'static' fields like attribute properties in 'Product' dimension? 也许最好使用这种“静态”字段,例如“产品”维度中的属性? But you still need to add some logic to choose one value for several (or all) product members selected. 但是您仍然需要添加一些逻辑,以便为选定的几个(或全部)产品成员选择一个值。

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

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