olap cube - MDX dimension usage in CASE statment -
i want check number of month , according divide number. problem code defaults else
statement. can spot issue? thanks.
create member currentcube.[measures].[sbbd] case [date].[calendar month number of year] when 2 [measures].[sb]/28 when 4 [measures].[sb]/30 when 6 [measures].[sb]/30 when 9 [measures].[sb]/30 when 11 [measures].[sb]/30 else [measures].[sb]/31 end, format_string = "standard", visible = 1 , associated_measure_group = 'lb';
try comparing member's value in condition of case
statement. comparing member [date].[calendar month number of year]
not seen numeric expression in mdx
, , comparing numeric expression (2, 4,...).
maybe following works better:
create member currentcube.[measures].[sbbd] case [date].[calendar month number of year].currentmember.member_value when 2 [measures].[sb]/28 when 4 [measures].[sb]/30 when 6 [measures].[sb]/30 when 9 [measures].[sb]/30 when 11 [measures].[sb]/30 else [measures].[sb]/31 end, format_string = "standard", visible = 1 , associated_measure_group = 'lb';
i'd more tempted create measure [measures].[numofmonth]
, feed case (chances splitting in 2 quicker):
create member currentcube.[measures].[numofmonth] [date].[calendar month number of year].currentmember.member_value, format_string = "standard", visible = 0 , associated_measure_group = 'lb'; create member currentcube.[measures].[sbbd] case [measures].[numofmonth] when 2 [measures].[sb]/28 when 4 [measures].[sb]/30 when 6 [measures].[sb]/30 when 9 [measures].[sb]/30 when 11 [measures].[sb]/30 else [measures].[sb]/31 end, format_string = "standard", visible = 1 , associated_measure_group = 'lb';
other side of coin
rather worrying values compare members. condition of case should use currentmember
function, , numbers replaced members:
create member currentcube.[measures].[sbbd] case [date].[calendar month number of year].currentmember when [date].[calendar month number of year].[2] [measures].[sb]/28 when [date].[calendar month number of year].[4] [measures].[sb]/30 when [date].[calendar month number of year].[6] [measures].[sb]/30 when [date].[calendar month number of year].[9] [measures].[sb]/30 when [date].[calendar month number of year].[11] [measures].[sb]/30 else[measures].[sb]/31 end, format_string = "standard", visible = 1 , associated_measure_group = 'lb';
Comments
Post a Comment