如何获取最新日期在mdx? [英] how to get latest date in mdx?

查看:94
本文介绍了如何获取最新日期在mdx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我像这样通过我的mdx,我就会得到我所期望的..

if i pass my mdx like this i am get what i am expecting..

With
Set [TimeLimit] as 
 '{([CurrDate].[All CurrDate].[2010].[Q3].[Jul].[2010-07-21])}'
select 
 NON EMPTY {[Measures].[Balance], [Measures].[Peso Equiv]} ON COLUMNS,
 NON EMPTY {
  [PARTICULARS].[All Particulars], 
  [PARTICULARS].[All Particulars].[RESIDENTS], 
  [PARTICULARS].[All Particulars].[NON-RESIDENTS]
 } ON ROWS
from [depositlib_22]
where ([TimeLimit])"

问题?:-我不想对"[2010].[Q3].[Jul].[2010-07-21]"这部分进行硬编码,我需要从我的多维数据集获取日期(多维数据集始终从中获取最新日期数据库表).

Question?:- i dont want hardcode this part "[2010].[Q3].[Jul].[2010-07-21]",i need to get date from my cube(cube always geting latest date from database table).

让我知道任何人我们如何获得?

let me know any one how we can possible to get?

请在过去2天的尝试中为我们提供帮助...仍然无法解决问题.

pls,help us on this i am trying past 2 days...still unable to fondout solution.

感谢您的撤离...

推荐答案

在MDX中,您有两种方法来处理类似日期的问题.一种是使用VBA日期函数使用所需的日期来构建字符串.如果使此字符串与维中的成员名称匹配,则可以将其转换为集合.请参阅 Sql Analysis Services当前日期

You have two ways to deal with date issues like this in MDX. One is to use a VBA date function to build a string using the date you want. If you make this string match the member name in your dimension you can then convert it into a set. See Sql Analysis Services Current Date

我认为您需要查看的第二种方法是使用MDX函数来找出哪个是[CurrDate]维中的最后一个(即最新的)成员.然后,您可以在查询中使用该成员.只要您的维度仅包含过去的日期,此方法就可以正常工作.我曾经实施过这个想法,然后偶然发现了2015年的未来日期,然后我的MDX没有向我显示今天的日期(通常是最近的成员).

The second way, which I think you need to look at, is to use MDX functions to find out which is the last (i.e. most recent) member in your [CurrDate] dimension. You can then use that member in your query. This will work fine as long as your dimension contains only dates in the past. I once implemented this idea and then found a future date of 2015 crept in the cube by accident, and then my MDX didn't show me todays date (which was usually the most recent member).

您需要的集合可能是:
{[CurrDate].[Date].members.Item([CurrDate].[Date].members.count-1)}
或同样不雅致的:
{[CurrDate].lastChild.lastChild.lastChild.lastChild.lastChild}

The set you need might be:
{[CurrDate].[Date].members.Item([CurrDate].[Date].members.count-1)}
Or the equally un-elegant:
{[CurrDate].lastChild.lastChild.lastChild.lastChild.lastChild}

这篇关于如何获取最新日期在mdx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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