SSAS-> MDX->根据计数在查询中创建列百分比

发布于 2024-12-27 02:23:22 字数 541 浏览 3 评论 0原文

SELECT
   NON EMPTY {[Measures].[Fact Order Count]} 
   ON COLUMNS,
   { ([Front Manager].[Front Manager Id].[Front Manager Id].ALLMEMBERS * [Order Type].[Order Type].[Order Type].ALLMEMBERS ) } 
   ON ROWS 
FROM
   [TEST_DW] CELL PROPERTIES VALUE

因此,输出中有三列:

前台经理、订单类型、订单计数

上面的查询显示了每个经理和订单类型组合的计数。我需要第四列,它是每个前台经理的订单类型的百分比。

因此,如果有四种类型的订单(A、B、C、D),并且经理每种订单有 25 个,总计 100 个。第四列将显示 25%......

我已经在网上搜索了如何这样做,但在这方面确实做得不够。对此的任何指导将不胜感激,我绝对是 MDX 的新手。谢谢。

SELECT
   NON EMPTY {[Measures].[Fact Order Count]} 
   ON COLUMNS,
   { ([Front Manager].[Front Manager Id].[Front Manager Id].ALLMEMBERS * [Order Type].[Order Type].[Order Type].ALLMEMBERS ) } 
   ON ROWS 
FROM
   [TEST_DW] CELL PROPERTIES VALUE

So, I have three columns in the output:

Front Manager, Order Type, Order Count

The above query shows me the counts for each manager and order type combination. I need a fourth column which would be a percentage of the types of orders for each front manager.

So, if there are four types of orders (A, B, C, D), and a manager had 25 of each order totaling 100. The fourth column would read 25%.....

I have scoured the web on how to do this, but have really come up short on this one. Any direction on this would be greatly appreciated, I am definitely new to MDX. Thanks.

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

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

发布评论

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

评论(1

神魇的王 2025-01-03 02:23:22

您要查找的是MDX 计算成员

假设订单 A 的成员名为:[订单类型].[订单类型].[订单 A],我们要计算总数的百分比。

WITH 
   MEMBER [Order A] AS ([Order Type].[Order Type].[Order A],[Measures].[Fact Order Count]) / ([Measures].[Fact Order Count]) , FORMAT_STRING = 'Percent'
SELECT
   {[Measures].[Fact Order Count],[Measures].[Order A]} on 0
...

计算成员中重要的是您可以评估任何 MDX 元组(例如 ([Order Type].[Order Type].[Order A],[Measures].[Fact Order Count]) )。如果需要,这会更改来自枢轴的值(在 0 和 1.. 中定义)。请注意,您可以为度量以及其他维度添加计算成员。

What you're looking for are MDX Calculated members.

Let's assume the member for order A is called : [Order Type].[Order Type].[Order A] and we want to calculate the percentage from the total.

WITH 
   MEMBER [Order A] AS ([Order Type].[Order Type].[Order A],[Measures].[Fact Order Count]) / ([Measures].[Fact Order Count]) , FORMAT_STRING = 'Percent'
SELECT
   {[Measures].[Fact Order Count],[Measures].[Order A]} on 0
...

What is important in the calculated members is that you can evaluate any MDX tuple (e.g ([Order Type].[Order Type].[Order A],[Measures].[Fact Order Count]) ). This changing if needed the values coming from the pivot axis (defined in on 0 and on 1..). Note you can add calculated members for the measures as well as the other dimensions.

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