简体   繁体   English

如何对汇总指标应用费率

[英]How to apply a rate on a aggregated measures

I'm currently designing a new measures into my cube. 我目前正在为我的多维数据集设计新的度量。 The logic is quite simple : 逻辑很简单:

I have a measure which is the number of page loaded on my site (a count of rows in the table PageLoad). 我有一个衡量标准,即网站上加载的页面数量(表PageLoad中的行数)。

And I have a data which is : a page loaded on a given month is worth 0.01 cents for example. 我的数据是:例如,给定月份加载的页面价值0.01美分。

My structure is as follow : 我的结构如下:

Fact_PageLoad -> Dim_Calendar -> Dim_PricePerPage Fact_PageLoad-> Dim_Calendar-> Dim_PricePerPage

And I need the measure Page Loaded Earning (which is : count of row * rate) 我需要衡量“网页加载的收入”(即:行数*费率)

And now I'm wondering how I can implement this data. 现在我想知道如何实现这些数据。 I thought of a calculated member. 我想到一个有思想的成员。 But even if this is possible how SSAS is gonna handle it if I ask it to give me how much I earned between the 15 august and the 15th of september whereas the august rate is 0.01 and the september rate is 0.05 ? 但是,即使这是可能的,如果我要求SSAS给我8月15日至9月15日之间的收入是多少,而8月的比率是0.01而9月的比率是0.05,则如何处理? Will it be able to count the august row and multiply them by 0.01 and add it the count of september rows multiplied by 0.05 ? 能否计算出8月份的行并将它们乘以0.01,然后加上9月的行数乘以0.05?

I thought of another solution which should work : add a calculated field in my PageLoad table which is simply the rate. 我想到了另一个应该起作用的解决方案:在我的PageLoad表中添加一个计算字段,该字段就是速率。 And then I simply have to sum this field. 然后我只需要总结一下这个领域。 But I'm not sure it is the best solution. 但是我不确定这是最好的解决方案。

Thanks for your help 谢谢你的帮助

I am not sure if I fully understood your question but based on my speculation, two tables and a piece of code should do the job. 我不确定我是否完全理解您的问题,但是基于我的推测,应该有两个表和一段代码来完成这项工作。 Its more of a logic side problem than database design side. 它比数据库设计方面更多的是逻辑方面的问题。

Store each hit in one table with the time stamp. 将每个匹配项与时间戳一起存储在一张表中。 Store monthly rate in another table. 将月费率存储在另一个表中。

When a request of calculation is made, calculate number of hits for 1 months, multiply with the month rate, calculate number of hits second month and do the same and add them. 提出计算要求后,计算1个月的点击数,乘以月率,计算第二个月的点击数,然后将其相加并相加。 I don't see any other way when there is a rate variation. 速率变化时,我看不到其他任何方式。

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

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