Showing posts with label determine. Show all posts
Showing posts with label determine. Show all posts

Friday, February 17, 2012

Default Time Member Issue

We have a DW/BI solution that use the now() function to determine the default week to set the time dimension to. This has been in place for over a year and has worked fine. For some reason it is not working due to a wacky time stamp being returned.

Example code ....

-- The First Calculated member is the value of NOW()
WITH MEMBER [Measures].[Full Date] as 'now()'
-- The Second Calculated Member is the Day part of the first calculated member.
MEMBER [Measures].[What Day] as 'DAY([Full Date])'
-- The Third Calculated Member is the Month part of the first calculated member.
MEMBER [Measures].[What Month] as 'MONTH([Full Date])'
-- The Fourth Calculated Member is the Year part of the first calculated member.
Member [Measures].[What Year] as 'YEAR([Full Date])'
SELECT

{[Full Date],[What Day],[What Month],[What Year]} ON COLUMNS

FROM [Cube]

Returned Datetime.....

Full Date What Day What Month What Year

10/15/4376 6:17:06 PM 138 207 46161

1. I verified the server has the correct system date and time.

2. I can run this same code against another analysis server and the correct time is returned.

Any ideas?

If I run this MDX in the sample app with a solve_order=1 it works fine. When setting the default member of a dimension there is no place to indicate a solve_order....we have restarted SQL Server/Olap services and rebooted the server but still not working.

Any Ideas?

|||

Maybe there is any other calculation interfering with your measures.

For example Time Inteligence with YTD or some Utility dimension you have with changed default members ...

To be sure you should do your default member without measures - only use StrToMember and the Now Function...

At the end of the cubes mdx script - for example

Code Snippet

alter cube currentcube update dimension [Time].[Year], default_member=StrToMember("[Time].[Year].&[" + cStr(Year(Now())) + "]");

Hannes

|||I don't think so. In the example I posted, the MDX is using the now() function. When I run this now() function on one server the correct time is returned on the other server I am getting an incorrect time. Thanks for your help.

Default Time Member Issue

We have a DW/BI solution that use the now() function to determine the default week to set the time dimension to. This has been in place for over a year and has worked fine. For some reason it is not working due to a wacky time stamp being returned.

Example code ....

-- The First Calculated member is the value of NOW()
WITH MEMBER [Measures].[Full Date] as 'now()'
-- The Second Calculated Member is the Day part of the first calculated member.
MEMBER [Measures].[What Day] as 'DAY([Full Date])'
-- The Third Calculated Member is the Month part of the first calculated member.
MEMBER [Measures].[What Month] as 'MONTH([Full Date])'
-- The Fourth Calculated Member is the Year part of the first calculated member.
Member [Measures].[What Year] as 'YEAR([Full Date])'
SELECT

{[Full Date],[What Day],[What Month],[What Year]} ON COLUMNS

FROM [Cube]

Returned Datetime.....

Full Date What Day What Month What Year

10/15/4376 6:17:06 PM 138 207 46161

1. I verified the server has the correct system date and time.

2. I can run this same code against another analysis server and the correct time is returned.

Any ideas?

If I run this MDX in the sample app with a solve_order=1 it works fine. When setting the default member of a dimension there is no place to indicate a solve_order....we have restarted SQL Server/Olap services and rebooted the server but still not working.

Any Ideas?

|||

Maybe there is any other calculation interfering with your measures.

For example Time Inteligence with YTD or some Utility dimension you have with changed default members ...

To be sure you should do your default member without measures - only use StrToMember and the Now Function...

At the end of the cubes mdx script - for example

Code Snippet

alter cube currentcube update dimension [Time].[Year], default_member=StrToMember("[Time].[Year].&[" + cStr(Year(Now())) + "]");

Hannes

|||I don't think so. In the example I posted, the MDX is using the now() function. When I run this now() function on one server the correct time is returned on the other server I am getting an incorrect time. Thanks for your help.

Default Stored Procedure Parameters

Hello, does anyone know how to determine (within the stored procedure)
whether a parameter has been passed explicitly to a stored procedure as
opposed to a parameter that has taken on the default value.
Many thanks
Phil<testemail@.skunkbox.com> wrote in message
news:1106552302.930765.327230@.z14g2000cwz.googlegr oups.com...
> Hello, does anyone know how to determine (within the stored procedure)
> whether a parameter has been passed explicitly to a stored procedure as
> opposed to a parameter that has taken on the default value.
> Many thanks
> Phil

Not as far as I know. You could add code which compares the initial
parameter values to a list of the defaults, but that wouldn't cover the case
where someone explicitly passes the default value.

Simon|||I don't know of a passive way, but you could create another parameter such
as a bool bIsDefault that defaults to TRUE. Then have calling functions pass
a FALSE value to this if they pass any other parameters.

Just a thought.
Cheers!

"Simon Hayes" <sql@.hayes.ch> wrote in message
news:41f4af32_1@.news.bluewin.ch...
> <testemail@.skunkbox.com> wrote in message
> news:1106552302.930765.327230@.z14g2000cwz.googlegr oups.com...
>> Hello, does anyone know how to determine (within the stored procedure)
>> whether a parameter has been passed explicitly to a stored procedure as
>> opposed to a parameter that has taken on the default value.
>> Many thanks
>> Phil
>>
> Not as far as I know. You could add code which compares the initial
> parameter values to a list of the defaults, but that wouldn't cover the
> case where someone explicitly passes the default value.
> Simon|||There are no BOOLEAN data types in SQL-92; they would make no sense in
terms of 3VL and NULL rules.

The guy can check the values as they come into the procudure with an IF
statement in the body or with a CASE expression in the SQL.|||--CELKO-- (jcelko212@.earthlink.net) writes:
> There are no BOOLEAN data types in SQL-92; they would make no sense in
> terms of 3VL and NULL rules.

Don't be silly. In such case neither AND or OR would make sense. Or anything
make sense. Real-world databases are full of boolean values, because
real-world business needs is full of boolean values.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp