Converting single result of an MDX set query to a calculated measure -
i have set calculated member returns me first invoice date of specific client id. set uses currentsalesperiod single result generated set.
the problem want find workaround i'm not forced use set on rows. make measure can use in columns , other purposes.
could me that? possible @ in mdx? query below working use in query not allowed put on rows.
set [first invoice date] iif( count( nonempty( [date invoice].[invoice date].[invoice date], [currentsalesperiod] * ytd(strtomember(@par_date).parent.lag(1).lastchild) * [point of sale].[client id].&[46] * {[measures].[ytd sales]} ) ) = 0, {[date invoice].[bonus calendar - week].[all].unknownmember.unknownmember}, head( nonempty( [date invoice].[invoice date].[invoice date], [currentsalesperiod] * ytd(strtomember(@par_date).parent.lag(1).lastchild) * [point of sale].[client id].&[46] * {[measures].[ytd sales]} ), 1 ) ) set [currentsalesperiod] tail( nonempty( [point of sale].[management period].[management period], {[measures].[sales amount]} * ytd(strtomember(@par_date)) * [point of sale].[client id].&[46] ), 1 )
pick dimension not going used, , tag on aggregated member aggregation of custom set - don't know cube try replacing [anotherdimension].[anotherhierarchy].
in following little used dim.hier in cube:
set [first invoice date] iif( count( nonempty( [date invoice].[invoice date].[invoice date], [currentsalesperiod] * ytd(strtomember(@par_date).parent.lag(1).lastchild) * [point of sale].[client id].&[46] * {[measures].[ytd sales]} ) ) = 0, {[date invoice].[bonus calendar - week].[all].unknownmember.unknownmember}, head( nonempty( [date invoice].[invoice date].[invoice date], [currentsalesperiod] * ytd(strtomember(@par_date).parent.lag(1).lastchild) * [point of sale].[client id].&[46] * {[measures].[ytd sales]} ), 1 ) ) set [currentsalesperiod] tail( nonempty( [point of sale].[management period].[management period], {[measures].[sales amount]} * ytd(strtomember(@par_date)) * [point of sale].[client id].&[46] ), 1 ) member [anotherdimension].[anotherhierarchy].[agg_firstinvoicedate] aggregate( [first invoice date] ) ... ...
Comments
Post a Comment