![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
| Writing multiselect friendly MDX calculations |
#3
| |||
| |||
|
|
Assuming that it occurs when multiple members of Product or of [Fiscal Time] are selected, this blog entry by Mosha explains the error: http://sqljunkies.com/WebLog/mosha/a...iselect_friend ly_mdx.aspx Writing multiselect friendly MDX calculations .. The exact error message for the error says: The MDX function CURRENTMEMBER failed because the coordinate for 'Store State' attribute contains a set. .. Current coordinate in the cube in fact is not limited by single value in each attribute. Some attributes can have multiple values - i.e. sets. (Again, it is actually even more generic then that, since sets can freely cross attribute and dimension boundaries, but for the subject of multiselects the above is enough). The sets in the coordinate are preserved throughout all the calculation execution. Many MDX functions don't have problems with it, however when it comes to things which rely on hierarchy current member - such as Store.CurrentMember expression - it doesn't know what to do - since there are multiple current members for that coordinate. While theoretically (and perhaps in some future version) CurrentMember can be generalized to work over sets - in AS2005 it simply cannot work, and therefore returns abovementioned error - current coordinate contains a set. Now, equipped with all this knowledge we can start thinking how to rewrite the expression for our calculated measure in such a way that it will continue to work and work correctly in the presence of sets in the coordinates on Store hierarchy. The rewrite is actually quite easy, once we notice, that Exists function and EXISTING operator are generalization of hierarchy related functions such as Descendants. .. So, since the .CurrentMember can't directly return a set (in AS2005), you have to use Existing or Exists() to compute the set of current members. The exact expression will depend on what you're trying to compute, and how you expect it to work when multiple members are selected - can you provide more details of the usage scenarios? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
|
Thanks for your reply deepak. My usage scenario is something like this. I have a measure group called usageunits which has dimension UsageUnitsProduct. There I have measure called usageunits. I have another measure group called SR whose grain is something else. This measureGroup has dimension called product. Now based on the product dimension selected , For each current member selected on product , I need to get usageunits from the UsageUnits measure group. For this purpose Iam using linkMember function to link UsageUnitsProduct hierarchy with the current selection(member) of Product dimension. Not able to imagine how to handle this during multi selection. Similarily , In some other function , Iam using this code. IIF([CreatedTime].[Time_Fiscal].CurrentMember.Level is [CreatedTime].[Time_Fiscal].[Month],........ Iam just checking whether currentmember level is month. It fails during filter selection of Time_Fiscal. Not sure how to handle this. Thanks for your help in advance. Regards, Siva Deepak Puri wrote: Assuming that it occurs when multiple members of Product or of [Fiscal Time] are selected, this blog entry by Mosha explains the error: http://sqljunkies.com/WebLog/mosha/a...iselect_friend ly_mdx.aspx Writing multiselect friendly MDX calculations .. The exact error message for the error says: The MDX function CURRENTMEMBER failed because the coordinate for 'Store State' attribute contains a set. .. Current coordinate in the cube in fact is not limited by single value in each attribute. Some attributes can have multiple values - i.e. sets. (Again, it is actually even more generic then that, since sets can freely cross attribute and dimension boundaries, but for the subject of multiselects the above is enough). The sets in the coordinate are preserved throughout all the calculation execution. Many MDX functions don't have problems with it, however when it comes to things which rely on hierarchy current member - such as Store.CurrentMember expression - it doesn't know what to do - since there are multiple current members for that coordinate. While theoretically (and perhaps in some future version) CurrentMember can be generalized to work over sets - in AS2005 it simply cannot work, and therefore returns abovementioned error - current coordinate contains a set. Now, equipped with all this knowledge we can start thinking how to rewrite the expression for our calculated measure in such a way that it will continue to work and work correctly in the presence of sets in the coordinates on Store hierarchy. The rewrite is actually quite easy, once we notice, that Exists function and EXISTING operator are generalization of hierarchy related functions such as Descendants. .. So, since the .CurrentMember can't directly return a set (in AS2005), you have to use Existing or Exists() to compute the set of current members. The exact expression will depend on what you're trying to compute, and how you expect it to work when multiple members are selected - can you provide more details of the usage scenarios? - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |