excel - Year to Date and Quarter to Date calculations in SSAS -
i building ssas cube financial data , have ytd (year date) , qtd (quarter date) calculations. beginner in this, have googled around. many advice not use built in time intelligence, instead create mdx calculations. have read more , tried build using example. works, not sure if not overdoing it. also, use cubeformulas in excel extract values, current formual bit complicated, contains array... here example of excel formula : (=cubemember("servername";{"[dim date].[calhierarchy].[year].&[2014].&[2].&[4]"\"[timecalc].[timecalc].[ytd]"})) .
and here actual calculation script added cube:
calculate; -- create calculated members create member currentcube.[timecalc].[timecalc].[ytd] null, visible = 1; create member currentcube.[timecalc].[timecalc].[qtd] null, visible = 1; -- scope specific measures scope({[measures].[amount]}); scope([dim date].[quarter].[quarter].members,[dim date].[date key].members); -- qtd calculations ([timecalc].[qtd]= aggregate( crossjoin({[timecalc].[current period]}, periodstodate([dim date].[calhierarchy].[quarter], [dim date].[calhierarchy].currentmember) ) ) ); end scope; scope([dim date].[year].[year].members,[dim date].[date key].members); -- ytd calculations ([timecalc].[ytd]= aggregate( crossjoin({[timecalc].[current period]}, periodstodate([dim date].[calhierarchy].[year], [dim date].[calhierarchy].currentmember) ) ) ); end scope; end scope;
i have created 1 dimension called timecalc, linked main time dimension called "dim date". simpler if create 2 separate dimensions? 1 ytd calculation , 1 qtr calculation? perhaps retrieve formula not have complicated array structure?
Comments
Post a Comment