MDX calculated member total -
i'm using calculated member "previous period" as:
case // test current coordinate being on (all) member. when [<<target dimension>>].[<<target hierarchy>>].currentmember.level [<<target dimension>>].[<<target hierarchy>>].[(all)] "na" else ( parallelperiod ( [<<target dimension>>].[<<target hierarchy>>].[<<target level>>], <<number of periods>>, [<<target dimension>>].[<<target hierarchy>>].currentmember ), [measures].[<<target measure>>] ) end // expression evaluates difference between value of numeric // expression in previous period , of current period. (snippet code taken directly microsoft suggestion)
it works expected when presenting totals whole year total, if months selected on rows.
so, if select year 2015, months jan jun, 6 correct values 2014 months 2014 grand total instead of sum of 6 presented values.
any way "correct" sum value? correct mean sum of selected rows.
edited add actual code:
case when [dim time].[calendar].currentmember.level [dim time].[calendar].[(all)] "na" else (parallelperiod([dim time].[calendar].[year], 1, [dim time].[calendar].currentmember),[measures].[sales]) end my dim time.calendar has year-month-day levels. easy enough :)
when selecting months year total grand total of year, not total of selected months. when selecting days, month total grand total of month, not total of selected days.
edited add example:
year month day sales previous year sales 2015 04 03 74,154.56 € 135,156.41 € total 04 2,617,045.75 € 135,156.41 € total 2015 37,696,665.69 € 135,156.41 €
(unsure if should post answer because it's not yet solved, seems found right direction)
using suggestions here defined dynamic set (at cube definition time using ms sas):
create dynamic set currentcube.[dynset] [dim time].[calendar] and calculated member (on excel, easier test diferent syntax):
count([dynset]) now 1 value on rows, individual ones, subtotals, totals ... instead of expected days of selected month , total sum.
maybe better mdx knowledge can develop further.
i added cm using examples of post count(descendants , count(existing( ... of original [dim temps].[calendar] , get:
year month day previous sales sales countexisting countdescendants countdays 2015 04 03 74,154.56 € 135,156.41 € 1 1 1 04 132,992.88 € 152,179.24 € 1 1 1 05 130,651.80 € 128,971.65 € 1 1 1 total 04 2,617,045.75 € 416,307.30 € 31 31 1 total 2015 37,696,665.69 € 416,307.30 € 365 365 1 i cannot understand how use new dynamic set i'm not able access components, expected [dynset].[year] [month] , [day] exist use them on previous period expressions don't, unsure on how use purpose.
thks
edited:
tried define
create dynamic set currentcube.[dynset] [dim time].[calendar].[day] and last column i.e. count([dynset]) has value of 3 lines.
still no idea how use [dynset] levels ...
Comments
Post a Comment