Good morning,
I'm sure this is a very easy question! I'm not very familiar with MDX, so if you could please explain verbosely what's going on, I'd appreciate it.
I'm attempting to build up some calculations in my cube to assist with date related projections of sales measures. For example, generating an "projection" for what sales will be, based on the sum of sales so far in the year, and how far in the (fiscal) year we currently are. I'm sure I'm not doing it in the most efficient manner, but bear with me for a moment - the actual "end use" I'm working on isn't the crux of the problem I'm currently having.
As a general tool I've always been able to pull out of the "toolbox" in virtually every language/environment I've worked with was the ability to decompose a problem into smaller parts, make sure those worked, then compose the results together. So instead of a big and complex formula, I could create two or three subparts of it, then express the formula as an addition of those parts.
I'm expecting MDX to work the same way, such that if I define a named set, I can then define a calculated measure using that named set. However, this is NOT working for me all the time, and I can't seem to see a pattern as to why it does in some cases, and doesn't in others. I can give quite a simple example (I think). First, I define this calculated measure:
CREATE MEMBER CURRENTCUBE.[Measures].[Days in Fiscal Year] AS Descendants(Ancestor([Dates].[Fiscal Calendar].CurrentMember, [Dates].[Fiscal Calendar].[Year]), [Dates].[Fiscal Calendar].[Day]).Count, VISIBLE = 1 , DISPLAY_FOLDER = 'Intermediate Calculations' ;
When I deploy the cube and browse, I can see "Days in Fiscal Year" in my Measures, in an "Intermediate Calculations" folder. When I pull the Fiscal Calendar hierarchy and "Days in Fiscal Year" measure into the browser, it works as expected (showing me the number of days in each fiscal period).
Next, I define this named set (you should see the set definition is EXACTLY the same as in the above measure):
CREATE DYNAMIC SET CURRENTCUBE.[Days in Fiscal Year Set] AS Descendants(Ancestor([Dates].[Fiscal Calendar].CurrentMember, [Dates].[Fiscal Calendar].[Year]), [Dates].[Fiscal Calendar].[Day]), DISPLAY_FOLDER = 'Intermediate Calculations' ;
And change my calculated measure to:
CREATE MEMBER CURRENTCUBE.[Measures].[Days in Fiscal Year] AS [Days in Fiscal Year Set].Count, VISIBLE = 1 , DISPLAY_FOLDER = 'Intermediate Calculations' ;
I deploy and reconnect to the cube. But now, my browser shows ZEROS for "Days in Fiscal Year". What simple rule don't I know? (I also do NOT see "Days in Fiscal Year Set" anywhere in the model, and I think I should.)
![]() | Talk to me now on![]() |