MDX 计算测量计数 [英] MDX Calculated Measure Count

查看:75
本文介绍了MDX 计算测量计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向简单的 MDX 查询添加计算度量.

I'm attempting to add a calculated measure to a simple MDX query.

尽管在我显然没有充分理解 MDX 以完成这项工作之前,我已经管理了简单的计算度量.

Although I have managed simple calculated measures before I clearly don't understand MDX sufficiently to make this work.

无论如何,我想要做的是计算每条卡车路线的不同订单数量.我曾尝试计算订单维度键,但所有这些都是在系统中生成订单总数,而不是每条路线的订单数量.有人可以帮我吗?感觉一旦理解了这一点,后续的MDX查询就会简单很多.

Anyway, what I am trying to do is count the number of distinct orders per each of our truck routes. I have tried counting the Order Dimension Keys but all this does is produce the total number of orders in the system rather than the number of orders per route. Can someone help me out? I feel that once I understand this it will make subsequent MDX queries a lot simpler.

With Member Deliveries as

Count([Dim Order].[Order Key].children) --clearly wrong

Select non empty

[Deliveries] on 0,
[Dim Route].[Route Code].Children on 1

From [Defacto DW]

推荐答案

假设您有一个度量值组连接到这个订单"dim.假设您在此度量值组中有一个度量值,名为 Measures.Order Count(我假设您应该有一个度量值).

Let's say you have a measure group which connects to this "Orders" dim. Lets say you have a measure in this measure group called Measures.Order Count (I am assuming you should be having one).

如果对于任何订单,采用任何路线,那么对于该订单-路线组合,该订单将不会是NULL.

If for any order, any route is taken, then for that order-route combination, that order won't be NULL.

然后您可以利用 NonEmpty 函数来获取这些非空交叉点的计数.

You can then leverage the NonEmpty function to get a count of those non-null intersections.

With member Deliveries as
NonEmpty
        (
         [Dim Order].[Order Key].[All].children, 
         [Measures].[Order Count]
        ).count

Select 
Deliveries on 0,
[Dim Route].[Route Code].members on 1
From [Defacto DW]

用多维数据集中的实际度量替换度量.

Replace the measure with the actual measure in the cube.

这篇关于MDX 计算测量计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆