Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get the first of the month for a given date in MDX as well as compound interest

Posted on 2011-03-16
4
Medium Priority
?
383 Views
Last Modified: 2014-05-04
How can I get the first non empty day from the calendar dimension.

Actually I am trying to implement a compount interest calculation


I can do that in two ways.  sum of total profit till date of month /principal as of first of date

I am not able to get the principal as of first date. I greatly appreciate is somebod has a code for it. I tried Opening Period but of no success. Getting Nulls at day level. Works at month level

the second way is

CREATE MEMBER CURRENTCUBE.[Measures].CUM_PNL_PCT
 AS ((1 + ([TradeDate].[TDHierarchy].PrevMember,Measures. [CUM_PNL_PCT])) * (1 + ([TradeDate].[TDHierarchy].CurrentMember, [Measures].[PNL Pct By Aum]))) - 1

The calc works if there are only time dimensions (Day on y axis and year and month of x axis).

If I have any other dimension it is failing.  Also I need to reset at any boundary (like new year).

Thanks.



0
Comment
Question by:obtek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 21

Accepted Solution

by:
Jason Yousef, MS earned 1000 total points
ID: 35156434
Hello,
just to let you get started...

The first day of the month is using the "OpenningPeriod"  function,

also check that it might help:
http://www.datawarehousingguide.com/microsoft-bi-interview-questions/26-mdx-interview-questions-time-based-function-.html


also these cheeats can help:
http://www.ssas-info.com/ssas-cheat-sheets


sorry can't help with the compound interest, hope someone else answers that.

Thanks
Jason
0
 
LVL 9

Assisted Solution

by:Hwkranger
Hwkranger earned 1000 total points
ID: 35307482
To get the first day of a reporting period i use HEAD.

i've included an example that takes two metrics at the first day of the month and does a calculation between them.
CREATE MEMBER CURRENTCUBE.[MEASURES].[Open@Beg]
 AS (HEAD(EXISTING [Date].[Calendar].[Date]
            ,1)
            .item(0)
            ,[Measures].[Active Relationship])
-
(HEAD(EXISTING [Date].[Calendar].[Date]
            ,1)
            .item(0)
            ,[Measures].[New Relationship]), 
FORMAT_STRING = "#,#;(#,#);0;\-", 
VISIBLE = 1;

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In this article, we’ll look at how to deploy ProxySQL.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question