Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

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

$
0
0

Hi,

I'm new to MDX world and currently enhancing ssas cube where i need to develop few calculated members or MDX query.

I’m trying to create calculated member in SSAS cube to get Annualised Revenue(SUM of revenue for last 12 complete months) for each of device(product). As a start created below MDX query, but its showing only device names, Annualised Revenue shows (null).

Any correction needed for this MDX Query? or appreciate, if someone can give me an example based on AdventureWorks cube. 

Here is my MDX query:

WITH MEMBER [Measures].[Annualised Revenue]
AS 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
FROM [cube_txn]

Do i need to add where cluase as “where ( [Invoice Date].[Calendar Month].[Invoice Calendar Year].&[2013])”

Whenerver it runs it should pickup current month as base and calculate for last 12 months revune

I am expecting results as 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

Any help much appreciated.

Thanks, Niel


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>