Annualised Revenue - SUM of revenue for last 12 complete months SSAS mdx calculation -


i'm new mdx world , enhancing ssas cube.

i’m trying create calculated member in ssas cube annualised revenue(sum of revenue last 12 complete months) each of device(product). start created below mdx query, showing device names, annualised revenue shows (null).

any correction needed mdx query? or appreciate, if can give me example based on adventureworks cube.

here mdx query:

with    member [measures].[annualised revenue]      sum     (         closingperiod         (           [invoice date].[calendar month].[invoice calendar month]          ,[invoice date].[calendar month].[all periods]         ).lag(12)       :          closingperiod         (           [invoice date].[calendar month].[invoice calendar month]          ,[invoice date].[calendar month].[all periods]         )      ,[measures].[amount]     )  select    [measures].[annualised revenue] on 0  ,[terminal].[terminal id].members on 1 [cube_txn]; 

do need add cluase “where ( [invoice date].[calendar month].[invoice calendar year].&[2013])”

whenerver runs should pickup current month base , calculate last 12 months revune

i expecting results below(ignore jan14 & jan15):

deviceid    sumofannualisedrevenue  jan14   jan15 ---------   ----------------------  -----    ------ a10001      12,4500     5000   15000 a10003      45,50000    15000   78000 a10006      78,00       12000   890 a10008      8,945       450     120   

does help?

with    member [measures].[annualised revenue]      sum     (         closingperiod         (           [invoice date].[calendar month].[invoice calendar month]          ,[invoice date].[calendar month].[all periods]         ).lag(12).item(0).item(0)       :          closingperiod         (           [invoice date].[calendar month].[invoice calendar month]          ,[invoice date].[calendar month].[all periods]         ).item(0).item(0)      ,[measures].[amount]     )  select    [measures].[annualised revenue] on 0  ,[terminal].[terminal id].members on 1 [cube_txn]; 

if erroring [terminal].[terminal id].members try 1 of following instead (i cannot sure work without seeing db):

[terminal].[terminal id].[terminal id].members  [terminal].members [terminal id].[terminal id].members   

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -