Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date() function in MDX

10 views
Skip to first unread message

Piotr Zawada

unread,
Aug 21, 2006, 4:34:02 AM8/21/06
to
I have recently migrated from AS2000 to 2005.
On previous platform I was able to use functions such as date() in MDX
queries in order to automatically get data for current date or prev date.
For example :
SELECT
NON EMPTY {StrToMember("[Time2].[" + Format(DateAdd("d", -1, Date()),
"yyyy-mm-dd") + "]")} ON ROWS,
NON EMPTY
{{[Measures].[IloscOW],[Measures].[IloscPU],[Measures].[SkutecznoscPUvOW],[Measures].[IloscPN]}} ON COLUMNS
FROM Forms_RdR

When I execute this query on AS2005, I get this error :
'Query (2, 68) Parser: The syntax for 'Date' is incorrect.'

What is wrong? Something has changed in new MDX?
Is there any other way to get this kind of query?

ZULFIQAR SYED

unread,
Aug 21, 2006, 9:26:06 PM8/21/06
to
Piotr,

In AS2005, you could use now() function to accomplish some thing
similar. Here is a very simple example on how to use it using adventure
works sample cube.

with
member measures.x as
"[Date].[Calendar].[Calendar Year].&["
+
cstr(year(now())-3)
+"]"
select
{
[Date].[Calendar].[Calendar Year].&[2002]
,
strtomember(measures.x)
}
on 1,
[Measures].[Reseller Sales Amount] on 0
from
[Adventure Works]

HTH..

Thanks

ZULFIQAR SYED
HTTP://ZULFIQAR.TYPEPAD.COM

0 new messages