ssas - Function to apply member function to set -
is there mdx function takes set argument , member function separate argument , returns set function applies members?
i have set of selected dates, , want return set same dates less 1 year, need use parallelperiod on each member.
this approach seems work ok:
with set [fewdays] [date].[calendar].[date].&[20070121] : [date].[calendar].[date].&[20070127] set [thedates] generate ( [fewdays] s ,{parallelperiod ( [date].[calendar].[calendar year] ,1 ,s.currentmember )} ) select {} on 0 ,[thedates] on 1 [adventure works];
i think prettier , avoids generate may faster:
with set [fewdays] [date].[calendar].[date].&[20070121] : [date].[calendar].[date].&[20070127] member [measures].[cntmembers] [fewdays].count set [lastmemlastyear] { parallelperiod ( [date].[calendar].[calendar year] ,1 ,tail([fewdays]).item(0) ) } set [thedates] [lastmemlastyear].item(0).lag( [measures].[cntmembers]) : [lastmemlastyear].item(0) select {} on 0 ,[thedates] on 1 [adventure works];
Comments
Post a Comment