MDX 计算成员 选定成员汇总的总和

发布于 2024-10-28 04:31:27 字数 352 浏览 3 评论 0原文

我正在尝试编写一个计算成员,它将根据轴上提供的选定值沿维度滚动。

产品->子类别->类别 雷克萨斯->轿车->车 雷克萨斯轿跑车 ->轿跑车->车 宝马->轿车->车 宝马轿跑车 ->情侣->车 福特->拾取 ->卡车 雪佛兰->拾取 ->卡车 福特 suv ->越野车->卡车 林肯导航 ->越野车->卡车

[计算的测量值] = [测量值].[a]+[测量值].[b]

假设用户希望在汽车级别查看雷克萨斯轿跑车和宝马的[计算的测量值]。如何创建一个计算度量,该度量将根据维度中选择的内容在汽车级别上汇总?

先感谢您!

I'm trying to write a calculated member that will roll up along a dimension based on the selected values provided on the axes.

Product -> subcategory -> category
lexus -> sedan -> car
lexus-coupe -> coupe -> car
bmw -> sedan -> car
bmw-coupe -> couple -> car
ford -> pickup -> truck
chev -> pickup -> truck
ford-suv -> suv -> truck
lincoln-nav -> suv -> truck

[Calculated measure] = [measures].[a]+[measures].[b]

suppose the user wants to see [Calculated measure] at the car level for just lexus-coupe and bmw. How do you create a calculated measure that will roll up at the car level based on what has been selected in the dimension?

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难以启齿的温柔 2024-11-04 04:31:27

我之前编写过 MDX 来检查行(或列)上使用的维度并更改度量的计算方式。有点乱。

此示例查看轴 1(行?)是否正在使用任何度量,并且可以相应地更改计算:

IIF(InStr(1, SetToStr(StrToSet("Axis(1)")), "[Measures].") = 0, blah, blah)

不记得为什么我先执行 StrToSet,然后执行 SetToStr,但它有效!

您可以使用 VBA 字符串函数(如 InStr())来检查用户在行和列上选择的内容,并相应地调整计算的成员...

I have previously written MDX to check what dimensions are being used on rows (or columns) and change the way a measure is being calculated. It is a bit messy.

This example looks to see if axis 1 (rows?) is using any Measures, and can change the calculation accordingly:

IIF(InStr(1, SetToStr(StrToSet("Axis(1)")), "[Measures].") = 0, blah, blah)

Can't remember why I did StrToSet and then SetToStr, but it worked!

You may be able to use VBA string functions like InStr() to examine what the user has selected on rows and columns, and fiddle with your calculated members accordingly...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文