dbTalk Databases Forums  

Default member of dimension

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Default member of dimension in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
LegeDoos
 
Posts: n/a

Default Default member of dimension - 10-06-2004 , 03:43 AM






Hi there!

I'm building a Cube that automatically processe every night using DTS. Now
I want the default member of a dimension set to the maximum value of that
dimension.

I tried some of the MDX functions, such as lastChild or Max, but this
doesn't work. Is there a way to do this?

Regards,

--
Rob
6-10-2004 10:37:14
legedoos _ at _ hotmail _ dot _ com

Reply With Quote
  #2  
Old   
Jamie
 
Posts: n/a

Default RE: Default member of dimension - 10-06-2004 , 05:29 AM






You'll have to clarify what you mean by "the maximum value of that
dimension". Also what dimension is this?

If the dimension is a time dimension then nested calls to .LastChild will
return the last day in your time dimension.

"LegeDoos" wrote:

Quote:
Hi there!

I'm building a Cube that automatically processe every night using DTS. Now
I want the default member of a dimension set to the maximum value of that
dimension.

I tried some of the MDX functions, such as lastChild or Max, but this
doesn't work. Is there a way to do this?

Regards,

--
Rob
6-10-2004 10:37:14
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #3  
Old   
LegeDoos
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 06:01 AM



Op Wed, 6 Oct 2004 03:29:04 -0700 schreef Jamie:

Quote:
You'll have to clarify what you mean by "the maximum value of that
dimension". Also what dimension is this?

If the dimension is a time dimension then nested calls to .LastChild will
return the last day in your time dimension.
Well, I have a dimension with reportnames. Every month there is a new
report. Example: 10-2004 or 09-2004. I want the default member to be the
most recent report: 10-2004. But next month it has to be 11-2004.


--
Rob
6-10-2004 12:59:51
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #4  
Old   
Jamie
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 07:01 AM



This is a dimension ordernig issue. I suspect your dimension is being ordered
by member name rather than member key. You have 2 options to fix this:
1) Change the ordering to order by member key
2) Change the format of your report name from MM-YYYY to YYYY-MM ensuring
that for months January-September you always include a zero before the month
number.

Thereafter you should be able to use the LastChild() or Tail() functions to
get what you want. I don't know which one performs better.

Regards
Jamie Thomson
http://www.conchango.com

"LegeDoos" wrote:

Quote:
Op Wed, 6 Oct 2004 03:29:04 -0700 schreef Jamie:

You'll have to clarify what you mean by "the maximum value of that
dimension". Also what dimension is this?

If the dimension is a time dimension then nested calls to .LastChild will
return the last day in your time dimension.

Well, I have a dimension with reportnames. Every month there is a new
report. Example: 10-2004 or 09-2004. I want the default member to be the
most recent report: 10-2004. But next month it has to be 11-2004.


--
Rob
6-10-2004 12:59:51
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #5  
Old   
LegeDoos
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 07:48 AM



Op Wed, 6 Oct 2004 05:01:04 -0700 schreef Jamie:

Quote:
This is a dimension ordernig issue. I suspect your dimension is being ordered
by member name rather than member key. You have 2 options to fix this:
1) Change the ordering to order by member key
2) Change the format of your report name from MM-YYYY to YYYY-MM ensuring
that for months January-September you always include a zero before the month
number.

Thereafter you should be able to use the LastChild() or Tail() functions to
get what you want. I don't know which one performs better.

Regards
Jamie Thomson
http://www.conchango.com

I tried the LastChild function.
The dimension name is [Overzicht] so I call [Overzicht].LastChild in the
defaultmember property. I don't get an error message but I don't get the
last Child as default. Am I doing something wrong here?

(btw, I reprocessed the cube)


--
Rob
6-10-2004 14:46:03
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #6  
Old   
Jamie
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 08:13 AM



Did you re-order the dimension as I suggested?
How many levels do you have in the [Overzicht] dimension? What are the
levels called?

Tip: Putting Overzicht.<leaf_level_name>.members on one of the axes will
display the members in the order that they are ordered within AS and
therefore help you to understand why you are not getting what you are
expecting!

Regards
Jamie Thomson


"LegeDoos" wrote:

Quote:
Op Wed, 6 Oct 2004 05:01:04 -0700 schreef Jamie:

This is a dimension ordernig issue. I suspect your dimension is being ordered
by member name rather than member key. You have 2 options to fix this:
1) Change the ordering to order by member key
2) Change the format of your report name from MM-YYYY to YYYY-MM ensuring
that for months January-September you always include a zero before the month
number.

Thereafter you should be able to use the LastChild() or Tail() functions to
get what you want. I don't know which one performs better.

Regards
Jamie Thomson
http://www.conchango.com


I tried the LastChild function.
The dimension name is [Overzicht] so I call [Overzicht].LastChild in the
defaultmember property. I don't get an error message but I don't get the
last Child as default. Am I doing something wrong here?

(btw, I reprocessed the cube)


--
Rob
6-10-2004 14:46:03
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #7  
Old   
LegeDoos
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 08:28 AM



Op Wed, 6 Oct 2004 06:13:03 -0700 schreef Jamie:

Quote:
Did you re-order the dimension as I suggested?
How many levels do you have in the [Overzicht] dimension? What are the
levels called?

Tip: Putting Overzicht.<leaf_level_name>.members on one of the axes will
display the members in the order that they are ordered within AS and
therefore help you to understand why you are not getting what you are
expecting!

Regards
Jamie Thomson


"LegeDoos" wrote:
I didn's reorder the dimension because I'm stuck on the default member. I
understand how I can change the sort order, but setting the default member
is the problem.

I have one level in de Overzicht dimension. This level is called
"Overzichtnaam".
In Overzichtnaam there are the following members (in this sort order):
06-2004
07-2004
08-2004
test

When I call [Overzicht].LastChild as the default member for the dimension
Overzicht, I expext test as result, but I get 06-2004. When I call
FirstChild I also get 06-2004.


--
Rob
6-10-2004 15:19:05
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #8  
Old   
Jamie
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 08:59 AM



Aha. I think I have it now.

Judging by your last email you don't have an "All" level. Correct? If so,
neither do you have an "All" member and therefore .LastChild doesn't really
have any logical meaning. Analysis Services asks itself "LastChild of what?"
and probably just returns the first member that it finds as a default. This
would explain why LastChild & FirstChild return the same thing.

Try defining your default member to be:
Tail(Overzicht.Overzichtnaam.members, 1)

This may or may not work because it actually returns a set (containing 1
tuple) and AS expects a member.

Try it anyway and see. If it doesn't work try:
Tail(Overzicht.Overzichtnaam.members, 1).Item(0)
which will return the first tuple from the set. As this tuple only has 1
member this should be satisfactory. If it isn't, just stick another
".Item(0)" on the end of it.

I wish I had an AS environment to hand where I could try this. In summary,
one of the following should work:
Tail(Overzicht.Overzichtnaam.members, 1)
Tail(Overzicht.Overzichtnaam.members, 1).Item(0)
Tail(Overzicht.Overzichtnaam.members, 1).Item(0).Item(0)
(probably the second one)

Regards
Jamie Thomson
http://www.conchango.com

"LegeDoos" wrote:

Quote:
Op Wed, 6 Oct 2004 06:13:03 -0700 schreef Jamie:

Did you re-order the dimension as I suggested?
How many levels do you have in the [Overzicht] dimension? What are the
levels called?

Tip: Putting Overzicht.<leaf_level_name>.members on one of the axes will
display the members in the order that they are ordered within AS and
therefore help you to understand why you are not getting what you are
expecting!

Regards
Jamie Thomson


"LegeDoos" wrote:

I didn's reorder the dimension because I'm stuck on the default member. I
understand how I can change the sort order, but setting the default member
is the problem.

I have one level in de Overzicht dimension. This level is called
"Overzichtnaam".
In Overzichtnaam there are the following members (in this sort order):
06-2004
07-2004
08-2004
test

When I call [Overzicht].LastChild as the default member for the dimension
Overzicht, I expext test as result, but I get 06-2004. When I call
FirstChild I also get 06-2004.


--
Rob
6-10-2004 15:19:05
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
  #9  
Old   
LegeDoos
 
Posts: n/a

Default Re: Default member of dimension - 10-06-2004 , 09:55 AM



Op Wed, 6 Oct 2004 06:59:07 -0700 Jamie wrote:

Quote:
Judging by your last email you don't have an "All" level. Correct? If so,
neither do you have an "All" member and therefore .LastChild doesn't really
have any logical meaning. Analysis Services asks itself "LastChild of what?"
and probably just returns the first member that it finds as a default. This
would explain why LastChild & FirstChild return the same thing.

Try defining your default member to be:
Tail(Overzicht.Overzichtnaam.members, 1)

This may or may not work because it actually returns a set (containing 1
tuple) and AS expects a member.

Try it anyway and see. If it doesn't work try:
Tail(Overzicht.Overzichtnaam.members, 1).Item(0)
which will return the first tuple from the set. As this tuple only has 1
member this should be satisfactory. If it isn't, just stick another
".Item(0)" on the end of it.

I wish I had an AS environment to hand where I could try this. In summary,
one of the following should work:
Tail(Overzicht.Overzichtnaam.members, 1)
Tail(Overzicht.Overzichtnaam.members, 1).Item(0)
Tail(Overzicht.Overzichtnaam.members, 1).Item(0).Item(0)
(probably the second one)

Regards
Jamie Thomson
http://www.conchango.com

Yes, it worked. Indeed, there was no all level. The second option works.
Thank you very much!

--
Rob
6-10-2004 16:53:26
legedoos _ at _ hotmail _ dot _ com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.