![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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 |
#7
| |||
| |||
|
|
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: |
#8
| |||
| |||
|
|
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 |
#9
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |