ssas - MDX: get attribute from a slowly changing dimension in a cell -


i need build report shows day-to-day changes in cube. e.g. account show balance on day x , balance on day y. achieve this:

with member oldbalance ([balance], [date].[date].[2013-05-01]) -- start date member newbalance ([balance], [date].[date].[2013-05-04]) -- end date select {oldbalance, newbalance} on columns [account].[accountnumber].[accountnumber] on rows thecube 

this shows 2 columns each account, everyone's happy:

        oldbalance   newbalance act123   1050.25        1048.29 act345    950.08        1421.92 

in addition account number, [account] dimension has salesrepname attribute, , value of salesrepname may change on time, making [account] changing dimension. want see along lines of:

        oldbalance   newbalance  oldsalesrep  newsalesrep act123   1050.25        1048.29  john smith   john smith act345    950.08        1421.92  john smith   george fisher 

but have no idea how achieve in mdx, , whether possible.

the trick use topcount , item:

with member [date].[date].startdate [date].[date].[2013-05-01] member [date].[date].enddate [date].[date].[2013-05-04] member oldbalance ([balance], [date].[date].startdate) member newbalance ([balance], [date].[date].enddate) member oldsalesrep      topcount(         nonempty(             ([account].[salesrep].[salesrep], [date].[date].startdate,              [account].[accountnumber].currentmember), [balance]),          1)     .item(0).item(0).properties("caption") member newsalesrep      topcount(         nonempty(             ([account].[salesrep].[salesrep], [date].[date].enddate,              [account].[accountnumber].currentmember), [balance]),          1)     .item(0).item(0).properties("caption") select {oldbalance, newbalance, oldsalesrep, newsalesrep} on columns [account].[accountnumber].[accountnumber] on rows thecube

keep in mind, however, on large cubes performance may not good.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -