本文介绍了在MDX中过滤今天的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把一个动态的日期过滤器(如今天的日期)放在一个MDX查询中,但是我无法从查询中得到任何结果,有些人可以帮我检查我的查询是什么问题?



我首先用指定的过期值测试了MDX查询,查询是

 会员[昨天] AS VBAMDX.Format(VBAMDX.Now() -  1,MM / dd / yy)

select {[Measures]。[Order Root Total],[Measures] 。[昨天]}列,
过滤器([D日期]。[DAY ID]。& [09/19/13],
[Measures]。[Order Root Total]> 0 )$]

返回结果

 订单总额昨天
09/19/13 1481.2225483463 09/19/13

然后我尝试了:

 与会员[昨天] AS VBAMDX.Format(VBAMDX.Now()-1,MM / dd / yy)

select {[Measures]。[Order Root Total],[Measures]。[Yesterday ]}列
过滤器([D日期]。[DAY ID]。& [Yesterday],
[Measures]。[Order Root Total]> 0)和销售]

然后我没有回报..



有人可以帮我吗很多欣赏!!!

解决方案

你必须使用 StrToMember 作为昨天是一种措施,不能直接在成员名称中使用。我建议在 [D日期] [DAY ID] 层级而不是 Measures 之间定义Yesterday: / p>

  WITH MEMBER [D Date]。[DAY ID]。[Yesterday] AS 
StrToMember('[D Date] 。[DAY ID]。&'+ VBAMDX.Format(VBAMDX.Now() - 1,MM / dd / yy)+']')

select {[Measures]。[
过滤器([D日期]] [DAY ID] [昨天],
[Measures]。[Order Root Total]> ; 0)在[根产品利润和销售]


Hi I am trying to put a dynamic date filter (like today's date) in a MDX query, but I cannot get any result from the query, can some one help to check what is it wrong with my query?

I first tested the MDX query with a specified dated value, the query is

WITH MEMBER [Yesterday] AS VBAMDX.Format(VBAMDX.Now()-1,"MM/dd/yy")

select {[Measures].[Order Root Total], [Measures].[Yesterday]} on columns,
filter ([D Date].[DAY ID].&[09/19/13],
[Measures].[Order Root Total]>0) on rows
from [Root Product Profit and Sales]

It return the result

            Order Root Total    Yesterday
09/19/13    1481.2225483463         09/19/13

Then I tried:

WITH MEMBER [Yesterday] AS VBAMDX.Format(VBAMDX.Now()-1,"MM/dd/yy")

select {[Measures].[Order Root Total], [Measures].[Yesterday]} on columns,
filter ([D Date].[DAY ID].&[Yesterday],
[Measures].[Order Root Total]>0) on rows
from [Root Product Profit and Sales]

Then I return nothing..

Can Someone Please help me! Much Appreciate!!!

解决方案

You would have to use StrToMember, as Yesterday is a measure, and cannot directly be used in a member name. I would suggest defining Yesterday on the [D Date].[DAY ID] hierarchy instead of the Measures one:

WITH MEMBER [D Date].[DAY ID].[Yesterday] AS
     StrToMember('[D Date].[DAY ID].&' + VBAMDX.Format(VBAMDX.Now()-1,"MM/dd/yy") + ']')

select {[Measures].[Order Root Total], [Measures].[Yesterday]} on columns,
filter ([D Date].[DAY ID].[Yesterday],
[Measures].[Order Root Total]>0) on rows
from [Root Product Profit and Sales]

这篇关于在MDX中过滤今天的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 22:18